|
fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) ![]() |
Manages an array of Fl_Tree_Item pointers. More...
#include <Fl_Tree_Item_Array.H>

Public Member Functions | |
| Fl_Tree_Item_Array (int new_chunksize=10) | |
| ~Fl_Tree_Item_Array () | |
| Destructor. Calls each item's destructor, destroys internal _items array. | |
| Fl_Tree_Item_Array (const Fl_Tree_Item_Array *o) | |
| Copy constructor. Makes new copy of array, with new instances of each item. | |
| Fl_Tree_Item * | operator[] (int i) |
Return the item and index i. | |
| const Fl_Tree_Item * | operator[] (int i) const |
| Const version of operator[](int i) | |
| int | total () const |
| Return the total items in the array, or 0 if empty. | |
| void | swap (int ax, int bx) |
Swap the two items at index positions ax and bx. | |
| void | clear () |
| void | add (Fl_Tree_Item *val) |
| void | insert (int pos, Fl_Tree_Item *new_item) |
| void | remove (int index) |
| int | remove (Fl_Tree_Item *item) |
Manages an array of Fl_Tree_Item pointers.
Because FLTK 1.x.x. has mandated that templates and STL not be used, we use this class to dynamically manage the arrays.
None of the methods do range checking on index values; the caller must be sure that index values are within the range 0<index<total() (unless otherwise noted).
Definition at line 51 of file Fl_Tree_Item_Array.H.
| Fl_Tree_Item_Array::Fl_Tree_Item_Array | ( | int | new_chunksize = 10 | ) |
Constructor; creates an empty array.
The optional 'chunksize' can be specified to optimize memory allocation for potentially large arrays. Default chunksize is 10.
Definition at line 40 of file Fl_Tree_Item_Array.cxx.
| Fl_Tree_Item_Array::~Fl_Tree_Item_Array | ( | ) |
Destructor. Calls each item's destructor, destroys internal _items array.
Definition at line 48 of file Fl_Tree_Item_Array.cxx.
References clear().
| Fl_Tree_Item_Array::Fl_Tree_Item_Array | ( | const Fl_Tree_Item_Array * | o | ) |
Copy constructor. Makes new copy of array, with new instances of each item.
Definition at line 53 of file Fl_Tree_Item_Array.cxx.
References Fl_Tree_Item.
| void Fl_Tree_Item_Array::add | ( | Fl_Tree_Item * | val | ) |
Add an item* to the end of the array.
Assumes the item was created with 'new', and will remain allocated.. Fl_Tree_Item_Array will handle calling the item's destructor when the array is cleared or the item remove()'ed.
Definition at line 123 of file Fl_Tree_Item_Array.cxx.
References insert().
Referenced by Fl_Tree_Item::add().
| void Fl_Tree_Item_Array::clear | ( | ) |
Clear the entire array.
Each item will be deleted (destructors will be called), and the array will be cleared. total() will return 0.
Definition at line 68 of file Fl_Tree_Item_Array.cxx.
Referenced by Fl_Tree_Item::clear_children(), and ~Fl_Tree_Item_Array().
| void Fl_Tree_Item_Array::insert | ( | int | pos, |
| Fl_Tree_Item * | new_item | ||
| ) |
Insert an item at index position pos.
Handles enlarging array if needed, total increased by 1. If pos == total(), an empty item is appended to the array.
Definition at line 106 of file Fl_Tree_Item_Array.cxx.
Referenced by add(), Fl_Tree_Item::add(), and Fl_Tree_Item::insert().
| Fl_Tree_Item* Fl_Tree_Item_Array::operator[] | ( | int | i | ) | [inline] |
Return the item and index i.
Definition at line 62 of file Fl_Tree_Item_Array.H.
| const Fl_Tree_Item* Fl_Tree_Item_Array::operator[] | ( | int | i | ) | const [inline] |
Const version of operator[](int i)
Definition at line 66 of file Fl_Tree_Item_Array.H.
| void Fl_Tree_Item_Array::remove | ( | int | index | ) |
Remove the item at
| [in] | index | from the array. |
The item will be delete'd (if non-NULL), so its destructor will be called.
Definition at line 131 of file Fl_Tree_Item_Array.cxx.
Referenced by Fl_Tree_Item::remove_child().
| int Fl_Tree_Item_Array::remove | ( | Fl_Tree_Item * | item | ) |
Remove the item from the array.
Definition at line 145 of file Fl_Tree_Item_Array.cxx.
| void Fl_Tree_Item_Array::swap | ( | int | ax, |
| int | bx | ||
| ) | [inline] |
Swap the two items at index positions ax and bx.
Definition at line 74 of file Fl_Tree_Item_Array.H.
Referenced by Fl_Tree_Item::swap_children().
| int Fl_Tree_Item_Array::total | ( | ) | const [inline] |
Return the total items in the array, or 0 if empty.
Definition at line 70 of file Fl_Tree_Item_Array.H.
Referenced by Fl_Tree_Item::add(), Fl_Tree_Item::close(), Fl_Tree_Item::hide_widgets(), Fl_Tree_Item::open(), and Fl_Tree_Item::show_widgets().