Browse Source

fix AddChild on UIScrollContainer

JimMarlowe 8 years ago
parent
commit
7b766a979a
2 changed files with 13 additions and 0 deletions
  1. 11 0
      Source/Atomic/UI/UIScrollContainer.cpp
  2. 2 0
      Source/Atomic/UI/UIScrollContainer.h

+ 11 - 0
Source/Atomic/UI/UIScrollContainer.cpp

@@ -117,4 +117,15 @@ bool UIScrollContainer::OnEvent(const tb::TBWidgetEvent &ev)
     return UIWidget::OnEvent(ev);
 }
 
+
+void UIScrollContainer::AddChild(UIWidget* child)
+{
+    if (!widget_ || !child || !child->GetInternalWidget() )
+        return;
+
+   ((TBScrollContainer*) widget_)->GetContentRoot()->AddChild(child->GetInternalWidget());
+}
+
+
+
 }

+ 2 - 0
Source/Atomic/UI/UIScrollContainer.h

@@ -65,6 +65,8 @@ public:
 
     void ScrollTo(int x, int y);
 
+    /// This is overriden to add children to the widget that is being scrolled rather than the container
+    virtual void AddChild(UIWidget* child);
 
 protected: