FLTK 1.3.0
|
00001 // 00002 // "$Id$" 00003 // 00004 00005 #ifndef _FL_TREE_ITEM_ARRAY_H 00006 #define _FL_TREE_ITEM_ARRAY_H 00007 00008 #include <FL/Fl.H> 00009 #include "Fl_Export.H" 00010 00011 class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block 00012 // or doxygen will not document our class.. 00013 00015 // FL/Fl_Tree_Item_Array.H 00017 // 00018 // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK 00019 // Copyright (C) 2009-2010 by Greg Ercolano. 00020 // 00021 // This library is free software. Distribution and use rights are outlined in 00022 // the file "COPYING" which should have been included with this file. If this 00023 // file is missing or damaged, see the license at: 00024 // 00025 // http://www.fltk.org/COPYING.php 00026 // 00027 // Please report all bugs and problems on the following page: 00028 // 00029 // http://www.fltk.org/str.php 00030 // 00031 00036 00046 00047 class FL_EXPORT Fl_Tree_Item_Array { 00048 Fl_Tree_Item **_items; // items array 00049 int _total; // #items in array 00050 int _size; // #items *allocated* for array 00051 int _chunksize; // #items to enlarge mem allocation 00052 void enlarge(int count); 00053 public: 00054 Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR 00055 ~Fl_Tree_Item_Array(); // DTOR 00056 Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR 00058 Fl_Tree_Item *operator[](int i) { 00059 return(_items[i]); 00060 } 00062 const Fl_Tree_Item *operator[](int i) const { 00063 return(_items[i]); 00064 } 00066 int total() const { 00067 return(_total); 00068 } 00070 #if FLTK_ABI_VERSION >= 10302 00071 // NEW -- code moved to .cxx 00072 void swap(int ax, int bx); 00073 #else /*FLTK_ABI_VERSION*/ 00074 // OLD 00075 void swap(int ax, int bx) { 00076 Fl_Tree_Item *asave = _items[ax]; 00077 _items[ax] = _items[bx]; 00078 _items[bx] = asave; 00079 } 00080 #endif /*FLTK_ABI_VERSION*/ 00081 void clear(); 00082 void add(Fl_Tree_Item *val); 00083 void insert(int pos, Fl_Tree_Item *new_item); 00084 void remove(int index); 00085 int remove(Fl_Tree_Item *item); 00086 }; 00087 00088 #endif /*_FL_TREE_ITEM_ARRAY_H*/ 00089 00090 // 00091 // End of "$Id$". 00092 //