FLTK 1.4.4: Fl_Tree_Item_Array.H Source File

FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Tree_Item_Array.H
Go to the documentation of this file.
1//
2
3#ifndef _FL_TREE_ITEM_ARRAY_H
4#define _FL_TREE_ITEM_ARRAY_H
5
6#include <FL/Fl.H>
7#include "Fl_Export.H"
8
9class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
10 // or doxygen will not document our class..
11
13// FL/Fl_Tree_Item_Array.H
15//
16// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
17// Copyright (C) 2009-2010 by Greg Ercolano.
18//
19// This library is free software. Distribution and use rights are outlined in
20// the file "COPYING" which should have been included with this file. If this
21// file is missing or damaged, see the license at:
22//
23// https://www.fltk.org/COPYING.php
24//
25// Please see the following page on how to report bugs and issues:
26//
27// https://www.fltk.org/bugs.php
28//
29
34
44
45 class FL_EXPORT Fl_Tree_Item_Array {
46 Fl_Tree_Item **_items; // items array
47 int _total; // #items in array
48 int _size; // #items *allocated* for array
49 int _chunksize; // #items to enlarge mem allocation
50 enum {
51 MANAGE_ITEM = 1
52 };
53 char _flags; // flags to control behavior
54 void enlarge(int count);
55public:
56 Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR
57 ~Fl_Tree_Item_Array(); // DTOR
58 Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR
60 Fl_Tree_Item *operator[](int i) {
61 return(_items[i]);
62 }
63
64 const Fl_Tree_Item *operator[](int i) const {
65 return(_items[i]);
66 }
67
68 int total() const {
69 return(_total);
70 }
71
72 void swap(int ax, int bx);
73 int move(int to, int from);
74 int deparent(int pos);
75 int reparent(Fl_Tree_Item *item, Fl_Tree_Item *newparent, int pos);
76 void clear();
77 void add(Fl_Tree_Item *val);
78 void insert(int pos, Fl_Tree_Item *new_item);
79 void replace(int pos, Fl_Tree_Item *new_item);
80 void remove(int index);
81 int remove(Fl_Tree_Item *item);
85 void manage_item_destroy(int val) {
86 if ( val ) _flags |= MANAGE_ITEM; else _flags &= ~MANAGE_ITEM;
87 }
88 int manage_item_destroy() const {
89 return _flags & MANAGE_ITEM ? 1 : 0;
90 }
91};
92
93#endif /*_FL_TREE_ITEM_ARRAY_H*/
Fl.H
Fl static class.
Fl_Tree_Item_Array::manage_item_destroy
void manage_item_destroy(int val)
Option to control if Fl_Tree_Item_Array's destructor will also destroy the Fl_Tree_Item's.
Definition Fl_Tree_Item_Array.H:85
Fl_Tree_Item_Array::total
int total() const
Return the total items in the array, or 0 if empty.
Definition Fl_Tree_Item_Array.H:68
Fl_Tree_Item_Array::operator[]
Fl_Tree_Item * operator[](int i)
Return the item and index i.
Definition Fl_Tree_Item_Array.H:60
Fl_Tree_Item_Array::Fl_Tree_Item_Array
Fl_Tree_Item_Array(int new_chunksize=10)
Constructor; creates an empty array.
Definition Fl_Tree_Item_Array.cxx:33
Fl_Tree_Item_Array::operator[]
const Fl_Tree_Item * operator[](int i) const
Const version of operator[](int i).
Definition Fl_Tree_Item_Array.H:64
Fl_Tree_Item
Tree widget item.
Definition Fl_Tree_Item.H:65