Remove #if FLTK_ABI_VERSION >= xxx directives.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11679 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
5ec684f236
commit
a56124c20b
51
FL/Fl_Tree.H
51
FL/Fl_Tree.H
@ -313,9 +313,7 @@ enum Fl_Tree_Reason {
|
|||||||
FL_TREE_REASON_NONE=0, ///< unknown reason
|
FL_TREE_REASON_NONE=0, ///< unknown reason
|
||||||
FL_TREE_REASON_SELECTED, ///< an item was selected
|
FL_TREE_REASON_SELECTED, ///< an item was selected
|
||||||
FL_TREE_REASON_DESELECTED, ///< an item was de-selected
|
FL_TREE_REASON_DESELECTED, ///< an item was de-selected
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
FL_TREE_REASON_RESELECTED, ///< an item was re-selected (e.g. double-clicked)
|
FL_TREE_REASON_RESELECTED, ///< an item was re-selected (e.g. double-clicked)
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
FL_TREE_REASON_OPENED, ///< an item was opened
|
FL_TREE_REASON_OPENED, ///< an item was opened
|
||||||
FL_TREE_REASON_CLOSED, ///< an item was closed
|
FL_TREE_REASON_CLOSED, ///< an item was closed
|
||||||
FL_TREE_REASON_DRAGGED ///< an item was dragged into a new place
|
FL_TREE_REASON_DRAGGED ///< an item was dragged into a new place
|
||||||
@ -329,17 +327,11 @@ class FL_EXPORT Fl_Tree : public Fl_Group {
|
|||||||
Fl_Tree_Reason _callback_reason; // reason for the callback
|
Fl_Tree_Reason _callback_reason; // reason for the callback
|
||||||
Fl_Tree_Prefs _prefs; // all the tree's settings
|
Fl_Tree_Prefs _prefs; // all the tree's settings
|
||||||
int _scrollbar_size; // size of scrollbar trough
|
int _scrollbar_size; // size of scrollbar trough
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
// NEW:
|
|
||||||
Fl_Tree_Item *_lastselect;
|
Fl_Tree_Item *_lastselect;
|
||||||
#else /*FLTK_ABI_VERSION*/
|
|
||||||
// OLD: static data inside handle() method
|
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
void fix_scrollbar_order();
|
void fix_scrollbar_order();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Fl_Scrollbar *_vscroll; ///< Vertical scrollbar
|
Fl_Scrollbar *_vscroll; ///< Vertical scrollbar
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Scrollbar *_hscroll; ///< Horizontal scrollbar
|
Fl_Scrollbar *_hscroll; ///< Horizontal scrollbar
|
||||||
int _tox,_toy,_tow,_toh; ///< Tree widget outer xywh dimension: outside scrollbars, inside widget border
|
int _tox,_toy,_tow,_toh; ///< Tree widget outer xywh dimension: outside scrollbars, inside widget border
|
||||||
int _tix,_tiy,_tiw,_tih; ///< Tree widget inner xywh dimension: inside borders + scrollbars
|
int _tix,_tiy,_tiw,_tih; ///< Tree widget inner xywh dimension: inside borders + scrollbars
|
||||||
@ -348,17 +340,10 @@ protected:
|
|||||||
int _tree_w;
|
int _tree_w;
|
||||||
/// the calculated height of the entire tree hierarchy. See calc_tree()
|
/// the calculated height of the entire tree hierarchy. See calc_tree()
|
||||||
int _tree_h;
|
int _tree_h;
|
||||||
#endif
|
|
||||||
void item_clicked(Fl_Tree_Item* val);
|
void item_clicked(Fl_Tree_Item* val);
|
||||||
void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason);
|
void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason);
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
// next_visible_item() and extend_selection() moved to 'public' in ABI 1.3.3
|
// next_visible_item() and extend_selection() moved to 'public' in ABI 1.3.3
|
||||||
// undocmented draw_tree() dropped -- draw() does all the work now
|
// undocmented draw_tree() dropped -- draw() does all the work now
|
||||||
#else
|
|
||||||
Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir);
|
|
||||||
void extend_selection(Fl_Tree_Item *from, Fl_Tree_Item *to);
|
|
||||||
int draw_tree();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Fl_Tree(int X, int Y, int W, int H, const char *L=0);
|
Fl_Tree(int X, int Y, int W, int H, const char *L=0);
|
||||||
@ -379,12 +364,7 @@ public:
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// Item creation/removal methods
|
// Item creation/removal methods
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Tree_Item *add(const char *path, Fl_Tree_Item *newitem=0);
|
Fl_Tree_Item *add(const char *path, Fl_Tree_Item *newitem=0);
|
||||||
#else
|
|
||||||
Fl_Tree_Item *add(const char *path);
|
|
||||||
Fl_Tree_Item *add(const char *path, Fl_Tree_Item *newitem);
|
|
||||||
#endif
|
|
||||||
Fl_Tree_Item* add(Fl_Tree_Item *parent_item, const char *name);
|
Fl_Tree_Item* add(Fl_Tree_Item *parent_item, const char *name);
|
||||||
Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name);
|
Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name);
|
||||||
Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
|
Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
|
||||||
@ -398,13 +378,8 @@ public:
|
|||||||
Fl_Tree_Item *find_item(const char *path);
|
Fl_Tree_Item *find_item(const char *path);
|
||||||
const Fl_Tree_Item *find_item(const char *path) const;
|
const Fl_Tree_Item *find_item(const char *path) const;
|
||||||
int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const;
|
int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const;
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
const Fl_Tree_Item* find_clicked(int yonly=0) const;
|
const Fl_Tree_Item* find_clicked(int yonly=0) const;
|
||||||
Fl_Tree_Item* find_clicked(int yonly=0);
|
Fl_Tree_Item* find_clicked(int yonly=0);
|
||||||
#else
|
|
||||||
const Fl_Tree_Item *find_clicked() const;
|
|
||||||
Fl_Tree_Item *find_clicked();
|
|
||||||
#endif
|
|
||||||
Fl_Tree_Item *item_clicked();
|
Fl_Tree_Item *item_clicked();
|
||||||
Fl_Tree_Item *first();
|
Fl_Tree_Item *first();
|
||||||
Fl_Tree_Item *first_visible(); // deprecated in ABI 10303
|
Fl_Tree_Item *first_visible(); // deprecated in ABI 10303
|
||||||
@ -414,19 +389,12 @@ public:
|
|||||||
Fl_Tree_Item *last();
|
Fl_Tree_Item *last();
|
||||||
Fl_Tree_Item *last_visible(); // deprecated in ABI 10303
|
Fl_Tree_Item *last_visible(); // deprecated in ABI 10303
|
||||||
Fl_Tree_Item *last_visible_item();
|
Fl_Tree_Item *last_visible_item();
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir); // made public in 1.3.3 ABI
|
Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir); // made public in 1.3.3 ABI
|
||||||
#endif
|
|
||||||
Fl_Tree_Item *first_selected_item();
|
Fl_Tree_Item *first_selected_item();
|
||||||
Fl_Tree_Item *last_selected_item();
|
Fl_Tree_Item *last_selected_item();
|
||||||
Fl_Tree_Item *next_item(Fl_Tree_Item *item, int dir=FL_Down, bool visible=false);
|
Fl_Tree_Item *next_item(Fl_Tree_Item *item, int dir=FL_Down, bool visible=false);
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0, int dir=FL_Down);
|
Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0, int dir=FL_Down);
|
||||||
int get_selected_items(Fl_Tree_Item_Array &items);
|
int get_selected_items(Fl_Tree_Item_Array &items);
|
||||||
#else
|
|
||||||
Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0);
|
|
||||||
Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item, int dir);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Item open/close methods
|
// Item open/close methods
|
||||||
@ -457,21 +425,10 @@ public:
|
|||||||
int dir,
|
int dir,
|
||||||
int val,
|
int val,
|
||||||
bool visible);
|
bool visible);
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
int extend_selection(Fl_Tree_Item *from,
|
int extend_selection(Fl_Tree_Item *from,
|
||||||
Fl_Tree_Item *to,
|
Fl_Tree_Item *to,
|
||||||
int val=1,
|
int val=1,
|
||||||
bool visible=false);
|
bool visible=false);
|
||||||
#else
|
|
||||||
private:
|
|
||||||
// Adding overload if not at least one overload breaks ABI, so avoid
|
|
||||||
// by keeping private until we can break ABI. ref: http://www.ros.org/reps/rep-0009.html
|
|
||||||
int extend_selection__(Fl_Tree_Item *from,
|
|
||||||
Fl_Tree_Item *to,
|
|
||||||
int val,
|
|
||||||
bool visible);
|
|
||||||
public:
|
|
||||||
#endif
|
|
||||||
void set_item_focus(Fl_Tree_Item *item);
|
void set_item_focus(Fl_Tree_Item *item);
|
||||||
Fl_Tree_Item *get_item_focus() const;
|
Fl_Tree_Item *get_item_focus() const;
|
||||||
int is_selected(Fl_Tree_Item *item) const;
|
int is_selected(Fl_Tree_Item *item) const;
|
||||||
@ -494,10 +451,8 @@ public:
|
|||||||
void marginleft(int val);
|
void marginleft(int val);
|
||||||
int margintop() const;
|
int margintop() const;
|
||||||
void margintop(int val);
|
void margintop(int val);
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
int marginbottom() const;
|
int marginbottom() const;
|
||||||
void marginbottom(int val);
|
void marginbottom(int val);
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
int linespacing() const;
|
int linespacing() const;
|
||||||
void linespacing(int val);
|
void linespacing(int val);
|
||||||
int openchild_marginbottom() const;
|
int openchild_marginbottom() const;
|
||||||
@ -506,10 +461,8 @@ public:
|
|||||||
void usericonmarginleft(int val);
|
void usericonmarginleft(int val);
|
||||||
int labelmarginleft() const;
|
int labelmarginleft() const;
|
||||||
void labelmarginleft(int val);
|
void labelmarginleft(int val);
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
int widgetmarginleft() const;
|
int widgetmarginleft() const;
|
||||||
void widgetmarginleft(int val);
|
void widgetmarginleft(int val);
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
int connectorwidth() const;
|
int connectorwidth() const;
|
||||||
void connectorwidth(int val);
|
void connectorwidth(int val);
|
||||||
Fl_Image* usericon() const;
|
Fl_Image* usericon() const;
|
||||||
@ -530,17 +483,13 @@ public:
|
|||||||
void selectbox(Fl_Boxtype val);
|
void selectbox(Fl_Boxtype val);
|
||||||
Fl_Tree_Select selectmode() const;
|
Fl_Tree_Select selectmode() const;
|
||||||
void selectmode(Fl_Tree_Select val);
|
void selectmode(Fl_Tree_Select val);
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
Fl_Tree_Item_Reselect_Mode item_reselect_mode() const;
|
Fl_Tree_Item_Reselect_Mode item_reselect_mode() const;
|
||||||
void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode);
|
void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode);
|
||||||
Fl_Tree_Item_Draw_Mode item_draw_mode() const;
|
Fl_Tree_Item_Draw_Mode item_draw_mode() const;
|
||||||
void item_draw_mode(Fl_Tree_Item_Draw_Mode mode);
|
void item_draw_mode(Fl_Tree_Item_Draw_Mode mode);
|
||||||
void item_draw_mode(int mode);
|
void item_draw_mode(int mode);
|
||||||
#endif
|
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
void calc_dimensions();
|
void calc_dimensions();
|
||||||
void calc_tree();
|
void calc_tree();
|
||||||
#endif
|
|
||||||
void recalc_tree();
|
void recalc_tree();
|
||||||
int displayed(Fl_Tree_Item *item);
|
int displayed(Fl_Tree_Item *item);
|
||||||
void show_item(Fl_Tree_Item *item, int yoff);
|
void show_item(Fl_Tree_Item *item, int yoff);
|
||||||
|
@ -65,51 +65,31 @@
|
|||||||
///
|
///
|
||||||
class Fl_Tree;
|
class Fl_Tree;
|
||||||
class FL_EXPORT Fl_Tree_Item {
|
class FL_EXPORT Fl_Tree_Item {
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Tree *_tree; // parent tree
|
Fl_Tree *_tree; // parent tree
|
||||||
#endif
|
|
||||||
const char *_label; // label (memory managed)
|
const char *_label; // label (memory managed)
|
||||||
Fl_Font _labelfont; // label's font face
|
Fl_Font _labelfont; // label's font face
|
||||||
Fl_Fontsize _labelsize; // label's font size
|
Fl_Fontsize _labelsize; // label's font size
|
||||||
Fl_Color _labelfgcolor; // label's fg color
|
Fl_Color _labelfgcolor; // label's fg color
|
||||||
Fl_Color _labelbgcolor; // label's bg color (0xffffffff is 'transparent')
|
Fl_Color _labelbgcolor; // label's bg color (0xffffffff is 'transparent')
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
/// \enum Fl_Tree_Item_Flags
|
/// \enum Fl_Tree_Item_Flags
|
||||||
enum Fl_Tree_Item_Flags {
|
enum Fl_Tree_Item_Flags {
|
||||||
#else
|
|
||||||
/// \enum
|
|
||||||
enum {
|
|
||||||
#endif
|
|
||||||
OPEN = 1<<0, ///> item is open
|
OPEN = 1<<0, ///> item is open
|
||||||
VISIBLE = 1<<1, ///> item is visible
|
VISIBLE = 1<<1, ///> item is visible
|
||||||
ACTIVE = 1<<2, ///> item is active
|
ACTIVE = 1<<2, ///> item is active
|
||||||
SELECTED = 1<<3 ///> item is selected
|
SELECTED = 1<<3 ///> item is selected
|
||||||
};
|
};
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
// NEW
|
|
||||||
unsigned short _flags; // misc flags
|
unsigned short _flags; // misc flags
|
||||||
#else /*FLTK_ABI_VERSION*/
|
|
||||||
// OLD: this will go away after 1.3.x
|
|
||||||
char _open; // item is open?
|
|
||||||
char _visible; // item is visible?
|
|
||||||
char _active; // item activated?
|
|
||||||
char _selected; // item selected?
|
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
int _xywh[4]; // xywh of this widget (if visible)
|
int _xywh[4]; // xywh of this widget (if visible)
|
||||||
int _collapse_xywh[4]; // xywh of collapse icon (if visible)
|
int _collapse_xywh[4]; // xywh of collapse icon (if visible)
|
||||||
int _label_xywh[4]; // xywh of label
|
int _label_xywh[4]; // xywh of label
|
||||||
Fl_Widget *_widget; // item's label widget (optional)
|
Fl_Widget *_widget; // item's label widget (optional)
|
||||||
Fl_Image *_usericon; // item's user-specific icon (optional)
|
Fl_Image *_usericon; // item's user-specific icon (optional)
|
||||||
#if FLTK_ABI_VERSION >= 10304
|
|
||||||
Fl_Image *_userdeicon; // deactivated usericon
|
Fl_Image *_userdeicon; // deactivated usericon
|
||||||
#endif
|
|
||||||
Fl_Tree_Item_Array _children; // array of child items
|
Fl_Tree_Item_Array _children; // array of child items
|
||||||
Fl_Tree_Item *_parent; // parent item (=0 if root)
|
Fl_Tree_Item *_parent; // parent item (=0 if root)
|
||||||
void *_userdata; // user data that can be associated with an item
|
void *_userdata; // user data that can be associated with an item
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
Fl_Tree_Item *_prev_sibling; // previous sibling (same level)
|
Fl_Tree_Item *_prev_sibling; // previous sibling (same level)
|
||||||
Fl_Tree_Item *_next_sibling; // next sibling (same level)
|
Fl_Tree_Item *_next_sibling; // next sibling (same level)
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
// Protected methods
|
// Protected methods
|
||||||
protected:
|
protected:
|
||||||
void _Init(const Fl_Tree_Prefs &prefs, Fl_Tree *tree);
|
void _Init(const Fl_Tree_Prefs &prefs, Fl_Tree *tree);
|
||||||
@ -119,19 +99,13 @@ protected:
|
|||||||
void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs);
|
void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs);
|
||||||
void recalc_tree();
|
void recalc_tree();
|
||||||
int calc_item_height(const Fl_Tree_Prefs &prefs) const;
|
int calc_item_height(const Fl_Tree_Prefs &prefs) const;
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Color drawfgcolor() const;
|
Fl_Color drawfgcolor() const;
|
||||||
Fl_Color drawbgcolor() const;
|
Fl_Color drawbgcolor() const;
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR -- backwards compatible
|
Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR -- backwards compatible
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Tree_Item(Fl_Tree *tree); // CTOR -- ABI 1.3.3+
|
Fl_Tree_Item(Fl_Tree *tree); // CTOR -- ABI 1.3.3+
|
||||||
virtual ~Fl_Tree_Item(); // DTOR -- ABI 1.3.3+
|
virtual ~Fl_Tree_Item(); // DTOR -- ABI 1.3.3+
|
||||||
#else
|
|
||||||
~Fl_Tree_Item(); // DTOR -- backwards compatible
|
|
||||||
#endif
|
|
||||||
Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR
|
Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR
|
||||||
/// The item's x position relative to the window
|
/// The item's x position relative to the window
|
||||||
int x() const { return(_xywh[0]); }
|
int x() const { return(_xywh[0]); }
|
||||||
@ -155,14 +129,9 @@ public:
|
|||||||
/// The item's label height
|
/// The item's label height
|
||||||
/// \version 1.3.3
|
/// \version 1.3.3
|
||||||
int label_h() const { return(_label_xywh[3]); }
|
int label_h() const { return(_label_xywh[3]); }
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
virtual int draw_item_content(int render);
|
virtual int draw_item_content(int render);
|
||||||
void draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
|
void draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
|
||||||
int &tree_item_xmax, int lastchild=1, int render=1);
|
int &tree_item_xmax, int lastchild=1, int render=1);
|
||||||
#else
|
|
||||||
void draw(int X, int &Y, int W, Fl_Widget *tree,
|
|
||||||
Fl_Tree_Item *itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1);
|
|
||||||
#endif
|
|
||||||
void show_self(const char *indent = "") const;
|
void show_self(const char *indent = "") const;
|
||||||
void label(const char *val);
|
void label(const char *val);
|
||||||
const char *label() const;
|
const char *label() const;
|
||||||
@ -268,10 +237,8 @@ public:
|
|||||||
Fl_Tree_Item *newitem);
|
Fl_Tree_Item *newitem);
|
||||||
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
|
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
|
||||||
char **arr);
|
char **arr);
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Tree_Item *replace(Fl_Tree_Item *new_item);
|
Fl_Tree_Item *replace(Fl_Tree_Item *new_item);
|
||||||
Fl_Tree_Item *replace_child(Fl_Tree_Item *olditem, Fl_Tree_Item *newitem);
|
Fl_Tree_Item *replace_child(Fl_Tree_Item *olditem, Fl_Tree_Item *newitem);
|
||||||
#endif
|
|
||||||
Fl_Tree_Item *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0);
|
Fl_Tree_Item *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0);
|
||||||
Fl_Tree_Item *insert_above(const Fl_Tree_Prefs &prefs, const char *new_label);
|
Fl_Tree_Item *insert_above(const Fl_Tree_Prefs &prefs, const char *new_label);
|
||||||
Fl_Tree_Item* deparent(int index);
|
Fl_Tree_Item* deparent(int index);
|
||||||
@ -306,13 +273,11 @@ public:
|
|||||||
void parent(Fl_Tree_Item *val) {
|
void parent(Fl_Tree_Item *val) {
|
||||||
_parent = val;
|
_parent = val;
|
||||||
}
|
}
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
const Fl_Tree_Prefs& prefs() const;
|
const Fl_Tree_Prefs& prefs() const;
|
||||||
/// Return the tree for this item.
|
/// Return the tree for this item.
|
||||||
const Fl_Tree *tree() const {
|
const Fl_Tree *tree() const {
|
||||||
return(_tree);
|
return(_tree);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// State
|
// State
|
||||||
//////////////////
|
//////////////////
|
||||||
@ -428,7 +393,6 @@ public:
|
|||||||
/// Set the item's user icon to an Fl_Image. '0' will disable.
|
/// Set the item's user icon to an Fl_Image. '0' will disable.
|
||||||
void usericon(Fl_Image *val) {
|
void usericon(Fl_Image *val) {
|
||||||
_usericon = val;
|
_usericon = val;
|
||||||
#if FLTK_ABI_VERSION >= 10304
|
|
||||||
// Update deactivated version of icon..
|
// Update deactivated version of icon..
|
||||||
if ( _userdeicon ) delete _userdeicon;
|
if ( _userdeicon ) delete _userdeicon;
|
||||||
if ( _usericon ) {
|
if ( _usericon ) {
|
||||||
@ -437,30 +401,22 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
_userdeicon = 0;
|
_userdeicon = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
recalc_tree(); // may change tree geometry
|
recalc_tree(); // may change tree geometry
|
||||||
}
|
}
|
||||||
/// Get the item's user icon as an Fl_Image. Returns '0' if disabled.
|
/// Get the item's user icon as an Fl_Image. Returns '0' if disabled.
|
||||||
Fl_Image *usericon() const {
|
Fl_Image *usericon() const {
|
||||||
return(_usericon);
|
return(_usericon);
|
||||||
}
|
}
|
||||||
#if FLTK_ABI_VERSION >= 10304
|
|
||||||
/// Return the deactivated version of the user icon, if any.
|
/// Return the deactivated version of the user icon, if any.
|
||||||
/// Returns 0 if none.
|
/// Returns 0 if none.
|
||||||
Fl_Image* userdeicon() const {
|
Fl_Image* userdeicon() const {
|
||||||
return _userdeicon;
|
return _userdeicon;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// Events
|
// Events
|
||||||
//////////////////
|
//////////////////
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
const Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0) const;
|
const Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0) const;
|
||||||
Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0);
|
Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0);
|
||||||
#else
|
|
||||||
const Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs) const;
|
|
||||||
Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs);
|
|
||||||
#endif
|
|
||||||
int event_on_collapse_icon(const Fl_Tree_Prefs &prefs) const;
|
int event_on_collapse_icon(const Fl_Tree_Prefs &prefs) const;
|
||||||
int event_on_label(const Fl_Tree_Prefs &prefs) const;
|
int event_on_label(const Fl_Tree_Prefs &prefs) const;
|
||||||
/// Is this item the root of the tree?
|
/// Is this item the root of the tree?
|
||||||
@ -471,7 +427,6 @@ public:
|
|||||||
// Protected methods
|
// Protected methods
|
||||||
// TODO: move these to top 'protected:' section
|
// TODO: move these to top 'protected:' section
|
||||||
protected:
|
protected:
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
/// Set a flag to an on or off value. val is 0 or 1.
|
/// Set a flag to an on or off value. val is 0 or 1.
|
||||||
inline void set_flag(unsigned short flag,int val) {
|
inline void set_flag(unsigned short flag,int val) {
|
||||||
if ( flag==OPEN || flag==VISIBLE ) {
|
if ( flag==OPEN || flag==VISIBLE ) {
|
||||||
@ -483,27 +438,6 @@ protected:
|
|||||||
inline int is_flag(unsigned short val) const {
|
inline int is_flag(unsigned short val) const {
|
||||||
return(_flags & val ? 1 : 0);
|
return(_flags & val ? 1 : 0);
|
||||||
}
|
}
|
||||||
#else /*FLTK_ABI_VERSION*/
|
|
||||||
/// Set a flag to an on or off value. val is 0 or 1.
|
|
||||||
void set_flag(unsigned short flag,int val) {
|
|
||||||
switch (flag) {
|
|
||||||
case OPEN: _open = val; break;
|
|
||||||
case VISIBLE: _visible = val; break;
|
|
||||||
case ACTIVE: _active = val; break;
|
|
||||||
case SELECTED: _selected = val; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// See if flag set. Returns 0 or 1.
|
|
||||||
int is_flag(unsigned short flag) const {
|
|
||||||
switch (flag) {
|
|
||||||
case OPEN: return(_open ? 1 : 0);
|
|
||||||
case VISIBLE: return(_visible ? 1 : 0);
|
|
||||||
case ACTIVE: return(_active ? 1 : 0);
|
|
||||||
case SELECTED: return(_selected ? 1 : 0);
|
|
||||||
default: return(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,12 +49,10 @@ class FL_EXPORT Fl_Tree_Item_Array {
|
|||||||
int _total; // #items in array
|
int _total; // #items in array
|
||||||
int _size; // #items *allocated* for array
|
int _size; // #items *allocated* for array
|
||||||
int _chunksize; // #items to enlarge mem allocation
|
int _chunksize; // #items to enlarge mem allocation
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
enum {
|
||||||
enum {
|
|
||||||
MANAGE_ITEM = 1, ///> manage the Fl_Tree_Item's internals (internal use only)
|
MANAGE_ITEM = 1, ///> manage the Fl_Tree_Item's internals (internal use only)
|
||||||
};
|
};
|
||||||
char _flags; // flags to control behavior
|
char _flags; // flags to control behavior
|
||||||
#endif
|
|
||||||
void enlarge(int count);
|
void enlarge(int count);
|
||||||
public:
|
public:
|
||||||
Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR
|
Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR
|
||||||
@ -73,17 +71,7 @@ public:
|
|||||||
return(_total);
|
return(_total);
|
||||||
}
|
}
|
||||||
/// Swap the two items at index positions \p ax and \p bx.
|
/// Swap the two items at index positions \p ax and \p bx.
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
// NEW -- code moved to .cxx
|
|
||||||
void swap(int ax, int bx);
|
void swap(int ax, int bx);
|
||||||
#else /*FLTK_ABI_VERSION*/
|
|
||||||
// OLD
|
|
||||||
void swap(int ax, int bx) {
|
|
||||||
Fl_Tree_Item *asave = _items[ax];
|
|
||||||
_items[ax] = _items[bx];
|
|
||||||
_items[bx] = asave;
|
|
||||||
}
|
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
int move(int to, int from);
|
int move(int to, int from);
|
||||||
int deparent(int pos);
|
int deparent(int pos);
|
||||||
int reparent(Fl_Tree_Item *item, Fl_Tree_Item *newparent, int pos);
|
int reparent(Fl_Tree_Item *item, Fl_Tree_Item *newparent, int pos);
|
||||||
@ -93,7 +81,6 @@ public:
|
|||||||
void replace(int pos, Fl_Tree_Item *new_item);
|
void replace(int pos, Fl_Tree_Item *new_item);
|
||||||
void remove(int index);
|
void remove(int index);
|
||||||
int remove(Fl_Tree_Item *item);
|
int remove(Fl_Tree_Item *item);
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
/// Option to control if Fl_Tree_Item_Array's destructor will also destroy the Fl_Tree_Item's.
|
/// Option to control if Fl_Tree_Item_Array's destructor will also destroy the Fl_Tree_Item's.
|
||||||
/// If set: items and item array is destroyed.
|
/// If set: items and item array is destroyed.
|
||||||
/// If clear: only the item array is destroyed, not items themselves.
|
/// If clear: only the item array is destroyed, not items themselves.
|
||||||
@ -103,7 +90,6 @@ public:
|
|||||||
int manage_item_destroy() const {
|
int manage_item_destroy() const {
|
||||||
return _flags & MANAGE_ITEM ? 1 : 0;
|
return _flags & MANAGE_ITEM ? 1 : 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*_FL_TREE_ITEM_ARRAY_H*/
|
#endif /*_FL_TREE_ITEM_ARRAY_H*/
|
||||||
|
@ -73,7 +73,6 @@ enum Fl_Tree_Select {
|
|||||||
///< reordered by mouse drag.
|
///< reordered by mouse drag.
|
||||||
};
|
};
|
||||||
|
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
/// \enum Fl_Tree_Item_Reselect_Mode
|
/// \enum Fl_Tree_Item_Reselect_Mode
|
||||||
/// Defines the ways an item can be (re) selected
|
/// Defines the ways an item can be (re) selected
|
||||||
/// via item_reselect_mode().
|
/// via item_reselect_mode().
|
||||||
@ -93,12 +92,9 @@ enum Fl_Tree_Item_Draw_Mode {
|
|||||||
FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET=1, ///< If widget() defined, include label to the left of the widget
|
FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET=1, ///< If widget() defined, include label to the left of the widget
|
||||||
FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2 ///< If widget() defined, widget()'s height controls item's height
|
FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2 ///< If widget() defined, widget()'s height controls item's height
|
||||||
};
|
};
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
|
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
class Fl_Tree_Item;
|
class Fl_Tree_Item;
|
||||||
typedef void (Fl_Tree_Item_Draw_Callback)(Fl_Tree_Item*, void*);
|
typedef void (Fl_Tree_Item_Draw_Callback)(Fl_Tree_Item*, void*);
|
||||||
#endif
|
|
||||||
|
|
||||||
/// \class Fl_Tree_Prefs
|
/// \class Fl_Tree_Prefs
|
||||||
///
|
///
|
||||||
@ -113,15 +109,11 @@ class FL_EXPORT Fl_Tree_Prefs {
|
|||||||
Fl_Fontsize _labelsize; // label's font size
|
Fl_Fontsize _labelsize; // label's font size
|
||||||
int _margintop; // --
|
int _margintop; // --
|
||||||
int _marginleft; // |- tree's controllable margins
|
int _marginleft; // |- tree's controllable margins
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
int _marginbottom; // --
|
int _marginbottom; // --
|
||||||
#endif
|
|
||||||
int _openchild_marginbottom; // extra space below an open child tree
|
int _openchild_marginbottom; // extra space below an open child tree
|
||||||
int _usericonmarginleft; // space to left of user icon (if any)
|
int _usericonmarginleft; // space to left of user icon (if any)
|
||||||
int _labelmarginleft; // space to left of label
|
int _labelmarginleft; // space to left of label
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
int _widgetmarginleft; // space to left of widget
|
int _widgetmarginleft; // space to left of widget
|
||||||
#endif
|
|
||||||
int _connectorwidth; // connector width (right of open/close icon)
|
int _connectorwidth; // connector width (right of open/close icon)
|
||||||
int _linespacing; // vertical space between lines
|
int _linespacing; // vertical space between lines
|
||||||
// Colors
|
// Colors
|
||||||
@ -132,29 +124,21 @@ class FL_EXPORT Fl_Tree_Prefs {
|
|||||||
Fl_Image *_openimage; // the 'open' icon [+]
|
Fl_Image *_openimage; // the 'open' icon [+]
|
||||||
Fl_Image *_closeimage; // the 'close' icon [-]
|
Fl_Image *_closeimage; // the 'close' icon [-]
|
||||||
Fl_Image *_userimage; // user's own icon
|
Fl_Image *_userimage; // user's own icon
|
||||||
#if FLTK_ABI_VERSION >= 10304
|
|
||||||
Fl_Image *_opendeimage; // deactivated 'open' icon
|
Fl_Image *_opendeimage; // deactivated 'open' icon
|
||||||
Fl_Image *_closedeimage; // deactivated 'close' icon
|
Fl_Image *_closedeimage; // deactivated 'close' icon
|
||||||
Fl_Image *_userdeimage; // deactivated user icon
|
Fl_Image *_userdeimage; // deactivated user icon
|
||||||
#endif
|
|
||||||
char _showcollapse; // 1=show collapse icons, 0=don't
|
char _showcollapse; // 1=show collapse icons, 0=don't
|
||||||
char _showroot; // show the root item as part of the tree
|
char _showroot; // show the root item as part of the tree
|
||||||
Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
|
Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
|
||||||
Fl_Boxtype _selectbox; // selection box type
|
Fl_Boxtype _selectbox; // selection box type
|
||||||
Fl_Tree_Select _selectmode; // selection mode
|
Fl_Tree_Select _selectmode; // selection mode
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
Fl_Tree_Item_Reselect_Mode _itemreselectmode; // controls item selection callback() behavior
|
Fl_Tree_Item_Reselect_Mode _itemreselectmode; // controls item selection callback() behavior
|
||||||
Fl_Tree_Item_Draw_Mode _itemdrawmode; // controls how items draw label + widget()
|
Fl_Tree_Item_Draw_Mode _itemdrawmode; // controls how items draw label + widget()
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
Fl_Tree_Item_Draw_Callback *_itemdrawcallback; // callback to handle drawing items (0=none)
|
Fl_Tree_Item_Draw_Callback *_itemdrawcallback; // callback to handle drawing items (0=none)
|
||||||
void *_itemdrawuserdata; // data for drawing items (0=none)
|
void *_itemdrawuserdata; // data for drawing items (0=none)
|
||||||
#endif
|
|
||||||
public:
|
public:
|
||||||
Fl_Tree_Prefs();
|
Fl_Tree_Prefs();
|
||||||
#if FLTK_ABI_VERSION >= 10304
|
|
||||||
~Fl_Tree_Prefs();
|
~Fl_Tree_Prefs();
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Labels
|
// Labels
|
||||||
@ -171,7 +155,6 @@ public:
|
|||||||
inline Fl_Color item_labelfgcolor() const { return(_labelfgcolor); }
|
inline Fl_Color item_labelfgcolor() const { return(_labelfgcolor); }
|
||||||
/// Set the default label foreground color
|
/// Set the default label foreground color
|
||||||
inline void item_labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
|
inline void item_labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
/// Get the default label background color.
|
/// Get the default label background color.
|
||||||
/// This returns the Fl_Tree::color() unless item_labelbgcolor()
|
/// This returns the Fl_Tree::color() unless item_labelbgcolor()
|
||||||
/// has been set explicitly.
|
/// has been set explicitly.
|
||||||
@ -185,16 +168,6 @@ public:
|
|||||||
inline void item_labelbgcolor(Fl_Color val) {
|
inline void item_labelbgcolor(Fl_Color val) {
|
||||||
_labelbgcolor = val;
|
_labelbgcolor = val;
|
||||||
}
|
}
|
||||||
#else /*FLTK_ABI_VERSION*/
|
|
||||||
/// Get the default label background color
|
|
||||||
inline Fl_Color item_labelbgcolor() const {
|
|
||||||
return(_labelbgcolor);
|
|
||||||
}
|
|
||||||
/// Set the default label background color
|
|
||||||
inline void item_labelbgcolor(Fl_Color val) {
|
|
||||||
_labelbgcolor = val;
|
|
||||||
}
|
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Obsolete names - for 1.3.0 backwards compat
|
// Obsolete names - for 1.3.0 backwards compat
|
||||||
@ -235,7 +208,6 @@ public:
|
|||||||
inline void margintop(int val) {
|
inline void margintop(int val) {
|
||||||
_margintop = val;
|
_margintop = val;
|
||||||
}
|
}
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
/// Get the bottom margin's value in pixels.
|
/// Get the bottom margin's value in pixels.
|
||||||
/// This is the extra distance the vertical scroller lets you travel.
|
/// This is the extra distance the vertical scroller lets you travel.
|
||||||
inline int marginbottom() const {
|
inline int marginbottom() const {
|
||||||
@ -246,7 +218,6 @@ public:
|
|||||||
inline void marginbottom(int val) {
|
inline void marginbottom(int val) {
|
||||||
_marginbottom = val;
|
_marginbottom = val;
|
||||||
}
|
}
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
/// Get the margin below an open child in pixels
|
/// Get the margin below an open child in pixels
|
||||||
inline int openchild_marginbottom() const {
|
inline int openchild_marginbottom() const {
|
||||||
return(_openchild_marginbottom);
|
return(_openchild_marginbottom);
|
||||||
@ -271,7 +242,6 @@ public:
|
|||||||
inline void labelmarginleft(int val) {
|
inline void labelmarginleft(int val) {
|
||||||
_labelmarginleft = val;
|
_labelmarginleft = val;
|
||||||
}
|
}
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
/// Get the widget()'s left margin value in pixels
|
/// Get the widget()'s left margin value in pixels
|
||||||
inline int widgetmarginleft() const {
|
inline int widgetmarginleft() const {
|
||||||
return(_widgetmarginleft);
|
return(_widgetmarginleft);
|
||||||
@ -280,7 +250,6 @@ public:
|
|||||||
inline void widgetmarginleft(int val) {
|
inline void widgetmarginleft(int val) {
|
||||||
_widgetmarginleft = val;
|
_widgetmarginleft = val;
|
||||||
}
|
}
|
||||||
#endif /*FLTK_ABI_VERSION*/
|
|
||||||
/// Get the line spacing value in pixels
|
/// Get the line spacing value in pixels
|
||||||
inline int linespacing() const {
|
inline int linespacing() const {
|
||||||
return(_linespacing);
|
return(_linespacing);
|
||||||
@ -348,7 +317,6 @@ public:
|
|||||||
///
|
///
|
||||||
inline void usericon(Fl_Image *val) {
|
inline void usericon(Fl_Image *val) {
|
||||||
_userimage = val;
|
_userimage = val;
|
||||||
#if FLTK_ABI_VERSION >= 10304
|
|
||||||
// Update deactivated version of icon..
|
// Update deactivated version of icon..
|
||||||
if ( _userdeimage ) delete _userdeimage;
|
if ( _userdeimage ) delete _userdeimage;
|
||||||
if ( _userimage ) {
|
if ( _userimage ) {
|
||||||
@ -357,10 +325,8 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
_userdeimage = 0;
|
_userdeimage = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FLTK_ABI_VERSION >= 10304
|
|
||||||
/// Return the deactivated version of the open icon, if any.
|
/// Return the deactivated version of the open icon, if any.
|
||||||
/// Returns 0 if none.
|
/// Returns 0 if none.
|
||||||
inline Fl_Image *opendeicon() const {
|
inline Fl_Image *opendeicon() const {
|
||||||
@ -376,7 +342,6 @@ public:
|
|||||||
inline Fl_Image *userdeicon() const {
|
inline Fl_Image *userdeicon() const {
|
||||||
return _userdeimage;
|
return _userdeimage;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Options
|
// Options
|
||||||
@ -438,7 +403,6 @@ public:
|
|||||||
inline void selectmode(Fl_Tree_Select val) {
|
inline void selectmode(Fl_Tree_Select val) {
|
||||||
_selectmode = val;
|
_selectmode = val;
|
||||||
}
|
}
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
|
||||||
/// Returns the current item re/selection mode
|
/// Returns the current item re/selection mode
|
||||||
Fl_Tree_Item_Reselect_Mode item_reselect_mode() const {
|
Fl_Tree_Item_Reselect_Mode item_reselect_mode() const {
|
||||||
return _itemreselectmode;
|
return _itemreselectmode;
|
||||||
@ -459,8 +423,6 @@ public:
|
|||||||
inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) {
|
inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) {
|
||||||
_itemdrawmode = val;
|
_itemdrawmode = val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
|
||||||
void item_draw_callback(Fl_Tree_Item_Draw_Callback *cb, void *data=0) {
|
void item_draw_callback(Fl_Tree_Item_Draw_Callback *cb, void *data=0) {
|
||||||
_itemdrawcallback = cb;
|
_itemdrawcallback = cb;
|
||||||
_itemdrawuserdata = data;
|
_itemdrawuserdata = data;
|
||||||
@ -474,7 +436,6 @@ public:
|
|||||||
void do_item_draw_callback(Fl_Tree_Item *o) const {
|
void do_item_draw_callback(Fl_Tree_Item *o) const {
|
||||||
_itemdrawcallback(o, _itemdrawuserdata);
|
_itemdrawcallback(o, _itemdrawuserdata);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*FL_TREE_PREFS_H*/
|
#endif /*FL_TREE_PREFS_H*/
|
||||||
|
Loading…
Reference in New Issue
Block a user