Browse Source

UIElement::GetChildrenWithTag() that returns PODVector.

Rokas Kupstys 9 years ago
parent
commit
5d1ef7fdbb
2 changed files with 10 additions and 0 deletions
  1. 7 0
      Source/Urho3D/UI/UIElement.cpp
  2. 3 0
      Source/Urho3D/UI/UIElement.h

+ 7 - 0
Source/Urho3D/UI/UIElement.cpp

@@ -1743,6 +1743,13 @@ void UIElement::GetChildrenWithTag(PODVector<UIElement*>& dest, const String& ta
         GetChildrenWithTagRecursive(dest, tag);
         GetChildrenWithTagRecursive(dest, tag);
 }
 }
 
 
+PODVector<UIElement*> UIElement::GetChildrenWithTag(const String& tag, bool recursive) const
+{
+    PODVector<UIElement*> dest;
+    GetChildrenWithTag(dest, tag, recursive);
+    return dest;
+}
+
 void UIElement::GetChildrenWithTagRecursive(PODVector<UIElement*>& dest, const String& tag) const
 void UIElement::GetChildrenWithTagRecursive(PODVector<UIElement*>& dest, const String& tag) const
 {
 {
     for (Vector<SharedPtr<UIElement> >::ConstIterator i = children_.Begin(); i != children_.End(); ++i)
     for (Vector<SharedPtr<UIElement> >::ConstIterator i = children_.Begin(); i != children_.End(); ++i)

+ 3 - 0
Source/Urho3D/UI/UIElement.h

@@ -580,6 +580,9 @@ public:
     /// Return child elements with a specific tag either recursively or non-recursively.
     /// Return child elements with a specific tag either recursively or non-recursively.
     void GetChildrenWithTag(PODVector<UIElement*>& dest, const String& tag, bool recursive = false) const;
     void GetChildrenWithTag(PODVector<UIElement*>& dest, const String& tag, bool recursive = false) const;
 
 
+    /// Return child elements with a specific tag either recursively or non-recursively.
+    PODVector<UIElement*> GetChildrenWithTag(const String& tag, bool recursive = false) const;
+
     /// Return the drag button combo if this element is being dragged.
     /// Return the drag button combo if this element is being dragged.
     int GetDragButtonCombo() const { return dragButtonCombo_; }
     int GetDragButtonCombo() const { return dragButtonCombo_; }