Browse Source

Added a method TreeViewItem::addSubItemSorted()

tags/2021-05-28
jules 11 years ago
parent
commit
020f138d20
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      modules/juce_gui_basics/widgets/juce_TreeView.h

+ 15
- 1
modules/juce_gui_basics/widgets/juce_TreeView.h View File

@@ -83,6 +83,20 @@ public:
*/
void addSubItem (TreeViewItem* newItem, int insertPosition = -1);
/** Adds a sub-item with a sort-comparator, assuming that the existing items are already sorted.
@param comparator the comparator object for sorting - see sortSubItems() for details about
the methods this class must provide.
@param newItem the object to add to the item's sub-item list. Once added, these can be
found using getSubItem(). When the items are later removed with
removeSubItem() (or when this item is deleted), they will be deleted.
*/
template <class ElementComparator>
void addSubItemSorted (ElementComparator& comparator, TreeViewItem* newItem)
{
addSubItem (newItem, findInsertIndexInSortedArray (comparator, subItems.begin(), newItem, 0, subItems.size()));
}
/** Removes one of the sub-items.
@param index the item to remove
@@ -519,7 +533,7 @@ private:
//==============================================================================
TreeView* ownerView;
TreeViewItem* parentItem;
OwnedArray <TreeViewItem> subItems;
OwnedArray<TreeViewItem> subItems;
int y, itemHeight, totalHeight, itemWidth, totalWidth;
int uid;
bool selected : 1;


Loading…
Cancel
Save