• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

Fl_Tree_Item_Array.H

Go to the documentation of this file.
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_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 #if FLTK_ABI_VERSION >= 10303
00053   enum {                        
00054     MANAGE_ITEM = 1,            
00055   };
00056   char _flags;                  // flags to control behavior
00057 #endif
00058   void enlarge(int count);
00059 public:
00060   Fl_Tree_Item_Array(int new_chunksize = 10);           // CTOR
00061   ~Fl_Tree_Item_Array();                                // DTOR
00062   Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o);      // COPY CTOR
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   // NEW -- code moved to .cxx
00078   void swap(int ax, int bx);
00079 #else /*FLTK_ABI_VERSION*/
00080   // OLD
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 /*FLTK_ABI_VERSION*/
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 /*_FL_TREE_ITEM_ARRAY_H*/
00110 
00111 //
00112 // End of "$Id$".
00113 //
  • © 1998-2016 by Bill Spitzak and others.     FLTK

  • © 1998-2016 by Bill Spitzak and others.     FLTK

    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.