diff options
| author | Greg Ercolano <erco@seriss.com> | 2014-01-20 21:23:24 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2014-01-20 21:23:24 +0000 |
| commit | abdc83470530c5fa8e15370a2032093cd91dace7 (patch) | |
| tree | dea9946420c6788e8fde4bcabd839e599138666b /src/Fl_Tree_Item_Array.cxx | |
| parent | aa71c2f6e1d7c78acc4eb7c6603761423d859390 (diff) | |
o Added draw_item_content() to Fl_Tree_Item,
a volatile method that can be overridden by
subclasses to take drawing control of tree item's content.
This replaces the old "item_draw_callback()" technique
added a few months ago as an ABI feature; turned out the
new technique is a better way to go.
o The examples/tree-custom-draw-items.cxx demo adjusted
accordingly.
o Added missing docs for some methods that had none,
including label_[xywh]().
o Added related methods needed to implement this, including:
Fl_Tree_Item_Array::replace()
Fl_Tree_Item::replace()
Fl_Tree::root(item)
Fl_Tree::add() variations
Fl_Tree_Item::drawbgcolor()/drawfgcolor()
o Carefully worked the FLTK_ABI_VERSION macros so as to be
ABI compatible with 1.3.0.
o Verified 1.3.0 ABI compatibility with ABI Compliance Checker 1.99.8.5:
http://ispras.linuxbase.org/index.php/ABI_compliance_checker
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10071 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Tree_Item_Array.cxx')
| -rw-r--r-- | src/Fl_Tree_Item_Array.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Fl_Tree_Item_Array.cxx b/src/Fl_Tree_Item_Array.cxx index 2519cf226..d83b0be12 100644 --- a/src/Fl_Tree_Item_Array.cxx +++ b/src/Fl_Tree_Item_Array.cxx @@ -150,6 +150,29 @@ void Fl_Tree_Item_Array::add(Fl_Tree_Item *val) { insert(_total, val); } +/// Replace the item at \p index with \p newitem. +/// +/// Old item at index position will be destroyed, +/// and the new item will take it's place, and stitched into the linked list. +/// +void Fl_Tree_Item_Array::replace(int index, Fl_Tree_Item *newitem) { + if ( _items[index] ) { // delete if non-zero +#if FLTK_ABI_VERSION >= 10303 + if ( _flags & MANAGE_ITEM ) +#endif + // Destroy old item + delete _items[index]; + } + _items[index] = newitem; // install new item +#if FLTK_ABI_VERSION >= 10303 + if ( _flags & MANAGE_ITEM ) +#endif + { + // Restitch into linked list + _items[index]->update_prev_next(index); + } +} + /// Remove the item at \param[in] index from the array. /// /// The item will be delete'd (if non-NULL), so its destructor will be called. |
