FLTK 1.3.0
Fl_Tree_Item_Array.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $"
3 //
4 
5 #ifndef _FL_TREE_ITEM_ARRAY_H
6 #define _FL_TREE_ITEM_ARRAY_H
7 
8 #include "Fl_Export.H"
9 
10 class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
11  // or doxygen will not document our class..
12 
14 // FL/Fl_Tree_Item_Array.H
16 //
17 // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
18 // Copyright (C) 2009-2010 by Greg Ercolano.
19 //
20 // This library is free software; you can redistribute it and/or
21 // modify it under the terms of the GNU Library General Public
22 // License as published by the Free Software Foundation; either
23 // version 2 of the License, or (at your option) any later version.
24 //
25 // This library is distributed in the hope that it will be useful,
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 // Library General Public License for more details.
29 //
30 // You should have received a copy of the GNU Library General Public
31 // License along with this library; if not, write to the Free Software
32 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
33 // USA.
34 //
35 
40 
50 
51 class FL_EXPORT Fl_Tree_Item_Array {
52  Fl_Tree_Item **_items; // items array
53  int _total; // #items in array
54  int _size; // #items *allocated* for array
55  int _chunksize; // #items to enlarge mem allocation
56  void enlarge(int count);
57 public:
58  Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR
59  ~Fl_Tree_Item_Array(); // DTOR
60  Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR
63  return(_items[i]);
64  }
66  const Fl_Tree_Item *operator[](int i) const {
67  return(_items[i]);
68  }
70  int total() const {
71  return(_total);
72  }
74  void swap(int ax, int bx) {
75  Fl_Tree_Item *asave = _items[ax];
76  _items[ax] = _items[bx];
77  _items[bx] = asave;
78  }
79  void clear();
80  void add(Fl_Tree_Item *val);
81  void insert(int pos, Fl_Tree_Item *new_item);
82  void remove(int index);
83  int remove(Fl_Tree_Item *item);
84 };
85 
86 #endif /*_FL_TREE_ITEM_ARRAY_H*/
87 
88 //
89 // End of "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $".
90 //