1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a method TreeViewItem::addSubItemSorted()

This commit is contained in:
jules 2013-10-25 18:17:40 +01:00
parent 98ef0eb4a5
commit 020f138d20

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;