FLTK 1.3.0
|
00001 // 00002 // "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $" 00003 // 00004 00005 #ifndef _FL_TREE_ITEM_ARRAY_H 00006 #define _FL_TREE_ITEM_ARRAY_H 00007 00008 #include "Fl_Export.H" 00009 00010 class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block 00011 // or doxygen will not document our class.. 00012 00014 // FL/Fl_Tree_Item_Array.H 00016 // 00017 // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK 00018 // Copyright (C) 2009-2010 by Greg Ercolano. 00019 // 00020 // This library is free software; you can redistribute it and/or 00021 // modify it under the terms of the GNU Library General Public 00022 // License as published by the Free Software Foundation; either 00023 // version 2 of the License, or (at your option) any later version. 00024 // 00025 // This library is distributed in the hope that it will be useful, 00026 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00027 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00028 // Library General Public License for more details. 00029 // 00030 // You should have received a copy of the GNU Library General Public 00031 // License along with this library; if not, write to the Free Software 00032 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00033 // USA. 00034 // 00035 00040 00050 00051 class FL_EXPORT Fl_Tree_Item_Array { 00052 Fl_Tree_Item **_items; // items array 00053 int _total; // #items in array 00054 int _size; // #items *allocated* for array 00055 int _chunksize; // #items to enlarge mem allocation 00056 void enlarge(int count); 00057 public: 00058 Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR 00059 ~Fl_Tree_Item_Array(); // DTOR 00060 Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR 00062 Fl_Tree_Item *operator[](int i) { 00063 return(_items[i]); 00064 } 00066 const Fl_Tree_Item *operator[](int i) const { 00067 return(_items[i]); 00068 } 00070 int total() const { 00071 return(_total); 00072 } 00074 void swap(int ax, int bx) { 00075 Fl_Tree_Item *asave = _items[ax]; 00076 _items[ax] = _items[bx]; 00077 _items[bx] = asave; 00078 } 00079 void clear(); 00080 void add(Fl_Tree_Item *val); 00081 void insert(int pos, Fl_Tree_Item *new_item); 00082 void remove(int index); 00083 int remove(Fl_Tree_Item *item); 00084 }; 00085 00086 #endif /*_FL_TREE_ITEM_ARRAY_H*/ 00087 00088 // 00089 // End of "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $". 00090 //