FLTK 1.3.2
Fl_Tree_Item_Array.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Tree_Item_Array.H 9706 2012-11-06 20:46:14Z matt $"
3 //
4 
5 #ifndef _FL_TREE_ITEM_ARRAY_H
6 #define _FL_TREE_ITEM_ARRAY_H
7 
8 #include <FL/Fl.H>
9 #include "Fl_Export.H"
10 
11 class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
12  // or doxygen will not document our class..
13 
15 // FL/Fl_Tree_Item_Array.H
17 //
18 // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
19 // Copyright (C) 2009-2010 by Greg Ercolano.
20 //
21 // This library is free software. Distribution and use rights are outlined in
22 // the file "COPYING" which should have been included with this file. If this
23 // file is missing or damaged, see the license at:
24 //
25 // http://www.fltk.org/COPYING.php
26 //
27 // Please report all bugs and problems on the following page:
28 //
29 // http://www.fltk.org/str.php
30 //
31 
36 
46 
47 class FL_EXPORT Fl_Tree_Item_Array {
48  Fl_Tree_Item **_items; // items array
49  int _total; // #items in array
50  int _size; // #items *allocated* for array
51  int _chunksize; // #items to enlarge mem allocation
52  void enlarge(int count);
53 public:
54  Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR
55  ~Fl_Tree_Item_Array(); // DTOR
56  Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR
59  return(_items[i]);
60  }
62  const Fl_Tree_Item *operator[](int i) const {
63  return(_items[i]);
64  }
66  int total() const {
67  return(_total);
68  }
70 #if FLTK_ABI_VERSION >= 10301
71  // NEW -- code moved to .cxx
72  void swap(int ax, int bx);
73 #else /*FLTK_ABI_VERSION*/
74  // OLD
75  void swap(int ax, int bx) {
76  Fl_Tree_Item *asave = _items[ax];
77  _items[ax] = _items[bx];
78  _items[bx] = asave;
79  }
80 #endif /*FLTK_ABI_VERSION*/
81  void clear();
82  void add(Fl_Tree_Item *val);
83  void insert(int pos, Fl_Tree_Item *new_item);
84  void remove(int index);
85  int remove(Fl_Tree_Item *item);
86 };
87 
88 #endif /*_FL_TREE_ITEM_ARRAY_H*/
89 
90 //
91 // End of "$Id: Fl_Tree_Item_Array.H 9706 2012-11-06 20:46:14Z matt $".
92 //
Fl_Tree_Item * operator[](int i)
Return the item and index i.
Definition: Fl_Tree_Item_Array.H:58
Fl static class.
void swap(int ax, int bx)
Swap the two items at index positions ax and bx.
Definition: Fl_Tree_Item_Array.H:75
const Fl_Tree_Item * operator[](int i) const
Const version of operator[](int i)
Definition: Fl_Tree_Item_Array.H:62
Tree item.
Definition: Fl_Tree_Item.H:54
int total() const
Return the total items in the array, or 0 if empty.
Definition: Fl_Tree_Item_Array.H:66
Manages an array of Fl_Tree_Item pointers.
Definition: Fl_Tree_Item_Array.H:47