00001
00002
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_Tree_Item;
00012
00013
00015
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00036
00046
00047 class FL_EXPORT Fl_Tree_Item_Array {
00048 Fl_Tree_Item **_items;
00049 int _total;
00050 int _size;
00051 int _chunksize;
00052 #if FLTK_ABI_VERSION >= 10303
00053 enum {
00054 MANAGE_ITEM = 1,
00055 };
00056 char _flags;
00057 #endif
00058 void enlarge(int count);
00059 public:
00060 Fl_Tree_Item_Array(int new_chunksize = 10);
00061 ~Fl_Tree_Item_Array();
00062 Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o);
00064 Fl_Tree_Item *operator[](int i) {
00065 return(_items[i]);
00066 }
00068 const Fl_Tree_Item *operator[](int i) const {
00069 return(_items[i]);
00070 }
00072 int total() const {
00073 return(_total);
00074 }
00076 #if FLTK_ABI_VERSION >= 10301
00077
00078 void swap(int ax, int bx);
00079 #else
00080
00081 void swap(int ax, int bx) {
00082 Fl_Tree_Item *asave = _items[ax];
00083 _items[ax] = _items[bx];
00084 _items[bx] = asave;
00085 }
00086 #endif
00087 int move(int to, int from);
00088 int deparent(int pos);
00089 int reparent(Fl_Tree_Item *item, Fl_Tree_Item *newparent, int pos);
00090 void clear();
00091 void add(Fl_Tree_Item *val);
00092 void insert(int pos, Fl_Tree_Item *new_item);
00093 void replace(int pos, Fl_Tree_Item *new_item);
00094 void remove(int index);
00095 int remove(Fl_Tree_Item *item);
00096 #if FLTK_ABI_VERSION >= 10303
00100 void manage_item_destroy(int val) {
00101 if ( val ) _flags |= MANAGE_ITEM; else _flags &= ~MANAGE_ITEM;
00102 }
00103 int manage_item_destroy() const {
00104 return _flags & MANAGE_ITEM ? 1 : 0;
00105 }
00106 #endif
00107 };
00108
00109 #endif
00110
00111
00112
00113