Browse Source

Add internal layout functions for ListView.

Eugene Kozlov 8 years ago
parent
commit
8d49cbba00
2 changed files with 28 additions and 0 deletions
  1. 21 0
      Source/Urho3D/UI/ListView.cpp
  2. 7 0
      Source/Urho3D/UI/ListView.h

+ 21 - 0
Source/Urho3D/UI/ListView.cpp

@@ -323,6 +323,27 @@ void ListView::OnResize(const IntVector2& newSize, const IntVector2& delta)
         overlayContainer_->SetSize(scrollPanel_->GetSize());
 }
 
+void ListView::UpdateInternalLayout()
+{
+    if (overlayContainer_)
+        overlayContainer_->UpdateLayout();
+    contentElement_->UpdateLayout();
+}
+
+void ListView::DisableInternalLayoutUpdate()
+{
+    if (overlayContainer_)
+        overlayContainer_->DisableLayoutUpdate();
+    contentElement_->DisableLayoutUpdate();
+}
+
+void ListView::EnableInternalLayoutUpdate()
+{
+    if (overlayContainer_)
+        overlayContainer_->EnableLayoutUpdate();
+    contentElement_->EnableLayoutUpdate();
+}
+
 void ListView::AddItem(UIElement* item)
 {
     InsertItem(M_MAX_UNSIGNED, item);

+ 7 - 0
Source/Urho3D/UI/ListView.h

@@ -56,6 +56,13 @@ public:
     /// React to resize.
     virtual void OnResize(const IntVector2& newSize, const IntVector2& delta) override;
 
+    /// Manually update layout on internal elements.
+    void UpdateInternalLayout();
+    /// Disable automatic layout update for internal elements.
+    void DisableInternalLayoutUpdate();
+    /// Enable automatic layout update for internal elements.
+    void EnableInternalLayoutUpdate();
+
     /// Add item to the end of the list.
     void AddItem(UIElement* item);
     /// \brief Insert item at a specific index. In hierarchy mode, the optional parameter will be used to determine the child's indent level in respect to its parent.