From 33ab9cfed1693a3cb9577c680e1d504354cd98c0 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Wed, 6 Nov 2013 20:44:47 +0000 Subject: Fl_Tree: o Added new method Fl_Tree::get_selected_items() o Modified Fl_Tree_Item_Array to usable in a general way (i.e. beyond Fl_Tree's internal use) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10016 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Tree_Item_Array.H | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'FL/Fl_Tree_Item_Array.H') diff --git a/FL/Fl_Tree_Item_Array.H b/FL/Fl_Tree_Item_Array.H index a8de00dcc..802381f7f 100644 --- a/FL/Fl_Tree_Item_Array.H +++ b/FL/Fl_Tree_Item_Array.H @@ -49,6 +49,12 @@ class FL_EXPORT Fl_Tree_Item_Array { int _total; // #items in array int _size; // #items *allocated* for array int _chunksize; // #items to enlarge mem allocation +#if FLTK_ABI_VERSION >= 10303 + enum { + MANAGE_ITEM = 1, ///> manage the Fl_Tree_Item's internals (internal use only) + }; + char _flags; // flags to control behavior +#endif void enlarge(int count); public: Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR @@ -83,6 +89,17 @@ public: void insert(int pos, Fl_Tree_Item *new_item); void remove(int index); int remove(Fl_Tree_Item *item); +#if FLTK_ABI_VERSION >= 10303 + /// Option to control if Fl_Tree_Item_Array's destructor will also destroy the Fl_Tree_Item's. + /// If set: items and item array is destroyed. + /// If clear: only the item array is destroyed, not items themselves. + void manage_item_destroy(int val) { + if ( val ) _flags |= MANAGE_ITEM; else _flags &= ~MANAGE_ITEM; + } + int manage_item_destroy() const { + return _flags & MANAGE_ITEM ? 1 : 0; + } +#endif }; #endif /*_FL_TREE_ITEM_ARRAY_H*/ -- cgit v1.2.3