summaryrefslogtreecommitdiff
path: root/FL/Fl_Tree_Item.H
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-01 18:03:10 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-06 20:28:20 +0200
commitf09e17c3c564e8310125a10c03397cbf473ff643 (patch)
tree8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /FL/Fl_Tree_Item.H
parentb0e0c355edaa2e23148cb0260ada907aec930f05 (diff)
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files - update .fl files and generated files accordingly - replace 'http://www.fltk.org' URL's with 'https://...' - replace bug report URL 'str.php' with 'bugs.php' - remove trailing whitespace - fix other whitespace errors flagged by Git - add and/or fix missing or wrong standard headers - convert tabs to spaces in all source files The only relevant code changes are in the fluid/ folder where some .fl files and other source files were used to generate the '$Id' headers and footers.
Diffstat (limited to 'FL/Fl_Tree_Item.H')
-rw-r--r--FL/Fl_Tree_Item.H134
1 files changed, 64 insertions, 70 deletions
diff --git a/FL/Fl_Tree_Item.H b/FL/Fl_Tree_Item.H
index 99d52a4b9..d0e68d4e7 100644
--- a/FL/Fl_Tree_Item.H
+++ b/FL/Fl_Tree_Item.H
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
#ifndef FL_TREE_ITEM_H
#define FL_TREE_ITEM_H
@@ -24,11 +22,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
///
@@ -65,31 +63,31 @@
///
class Fl_Tree;
class FL_EXPORT Fl_Tree_Item {
- Fl_Tree *_tree; // parent tree
- const char *_label; // label (memory managed)
- Fl_Font _labelfont; // label's font face
- Fl_Fontsize _labelsize; // label's font size
- Fl_Color _labelfgcolor; // label's fg color
- Fl_Color _labelbgcolor; // label's bg color (0xffffffff is 'transparent')
+ Fl_Tree *_tree; // parent tree
+ const char *_label; // label (memory managed)
+ Fl_Font _labelfont; // label's font face
+ Fl_Fontsize _labelsize; // label's font size
+ Fl_Color _labelfgcolor; // label's fg color
+ Fl_Color _labelbgcolor; // label's bg color (0xffffffff is 'transparent')
/// \enum Fl_Tree_Item_Flags
enum Fl_Tree_Item_Flags {
- OPEN = 1<<0, ///> item is open
- VISIBLE = 1<<1, ///> item is visible
- ACTIVE = 1<<2, ///> item is active
- SELECTED = 1<<3 ///> item is selected
+ OPEN = 1<<0, ///> item is open
+ VISIBLE = 1<<1, ///> item is visible
+ ACTIVE = 1<<2, ///> item is active
+ SELECTED = 1<<3 ///> item is selected
};
- unsigned short _flags; // misc flags
- int _xywh[4]; // xywh of this widget (if visible)
- int _collapse_xywh[4]; // xywh of collapse icon (if visible)
- int _label_xywh[4]; // xywh of label
- Fl_Widget *_widget; // item's label widget (optional)
- Fl_Image *_usericon; // item's user-specific icon (optional)
- Fl_Image *_userdeicon; // deactivated usericon
- Fl_Tree_Item_Array _children; // array of child items
- Fl_Tree_Item *_parent; // parent item (=0 if root)
- void *_userdata; // user data that can be associated with an item
- Fl_Tree_Item *_prev_sibling; // previous sibling (same level)
- Fl_Tree_Item *_next_sibling; // next sibling (same level)
+ unsigned short _flags; // misc flags
+ int _xywh[4]; // xywh of this widget (if visible)
+ int _collapse_xywh[4]; // xywh of collapse icon (if visible)
+ int _label_xywh[4]; // xywh of label
+ Fl_Widget *_widget; // item's label widget (optional)
+ Fl_Image *_usericon; // item's user-specific icon (optional)
+ Fl_Image *_userdeicon; // deactivated usericon
+ Fl_Tree_Item_Array _children; // array of child items
+ Fl_Tree_Item *_parent; // parent item (=0 if root)
+ void *_userdata; // user data that can be associated with an item
+ Fl_Tree_Item *_prev_sibling; // previous sibling (same level)
+ Fl_Tree_Item *_next_sibling; // next sibling (same level)
// Protected methods
protected:
void _Init(const Fl_Tree_Prefs &prefs, Fl_Tree *tree);
@@ -103,10 +101,10 @@ protected:
Fl_Color drawbgcolor() const;
public:
- Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR -- backwards compatible
- Fl_Tree_Item(Fl_Tree *tree); // CTOR -- ABI 1.3.3+
- virtual ~Fl_Tree_Item(); // DTOR -- ABI 1.3.3+
- Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR
+ Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR -- backwards compatible
+ Fl_Tree_Item(Fl_Tree *tree); // CTOR -- ABI 1.3.3+
+ virtual ~Fl_Tree_Item(); // DTOR -- ABI 1.3.3+
+ Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR
/// The item's x position relative to the window
int x() const { return(_xywh[0]); }
/// The item's y position relative to the window
@@ -130,8 +128,8 @@ public:
/// \version 1.3.3
int label_h() const { return(_label_xywh[3]); }
virtual int draw_item_content(int render);
- void draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
- int &tree_item_xmax, int lastchild=1, int render=1);
+ void draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
+ int &tree_item_xmax, int lastchild=1, int render=1);
void show_self(const char *indent = "") const;
void label(const char *val);
const char *label() const;
@@ -141,11 +139,11 @@ public:
/// Retrieve the user-data value that has been assigned to the item.
inline void* user_data() const { return _userdata; }
-
+
/// Set item's label font face.
void labelfont(Fl_Font val) {
- _labelfont = val;
- recalc_tree(); // may change tree geometry
+ _labelfont = val;
+ recalc_tree(); // may change tree geometry
}
/// Get item's label font face.
Fl_Font labelfont() const {
@@ -153,8 +151,8 @@ public:
}
/// Set item's label font size.
void labelsize(Fl_Fontsize val) {
- _labelsize = val;
- recalc_tree(); // may change tree geometry
+ _labelsize = val;
+ recalc_tree(); // may change tree geometry
}
/// Get item's label font size.
Fl_Fontsize labelsize() const {
@@ -162,11 +160,11 @@ public:
}
/// Set item's label foreground text color.
void labelfgcolor(Fl_Color val) {
- _labelfgcolor = val;
+ _labelfgcolor = val;
}
/// Return item's label foreground text color.
Fl_Color labelfgcolor() const {
- return(_labelfgcolor);
+ return(_labelfgcolor);
}
/// Set item's label text color. Alias for labelfgcolor(Fl_Color)).
void labelcolor(Fl_Color val) {
@@ -174,42 +172,42 @@ public:
}
/// Return item's label text color. Alias for labelfgcolor() const).
Fl_Color labelcolor() const {
- return labelfgcolor();
+ return labelfgcolor();
}
/// Set item's label background color.
/// A special case is made for color 0xffffffff which uses the parent tree's bg color.
void labelbgcolor(Fl_Color val) {
- _labelbgcolor = val;
+ _labelbgcolor = val;
}
/// Return item's label background text color.
/// If the color is 0xffffffff, the default behavior is the parent tree's
/// bg color will be used. (An overloaded draw_item_content() can override
/// this behavior.)
Fl_Color labelbgcolor() const {
- return(_labelbgcolor);
+ return(_labelbgcolor);
}
/// Assign an FLTK widget to this item.
void widget(Fl_Widget *val) {
- _widget = val;
- recalc_tree(); // may change tree geometry
+ _widget = val;
+ recalc_tree(); // may change tree geometry
}
/// Return FLTK widget assigned to this item.
Fl_Widget *widget() const {
- return(_widget);
+ return(_widget);
}
/// Return the number of children this item has.
int children() const {
- return(_children.total());
+ return(_children.total());
}
/// Return the child item for the given 'index'.
Fl_Tree_Item *child(int index) {
- return(_children[index]);
+ return(_children[index]);
}
/// Return the const child item for the given 'index'.
const Fl_Tree_Item *child(int t) const;
/// See if this item has children.
int has_children() const {
- return(children());
+ return(children());
}
int find_child(const char *name);
int find_child(Fl_Tree_Item *item);
@@ -228,15 +226,15 @@ public:
// Adding items
//////////////////
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
- const char *new_label,
- Fl_Tree_Item *newitem);
+ const char *new_label,
+ Fl_Tree_Item *newitem);
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
- const char *new_label);
+ const char *new_label);
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
- char **arr,
- Fl_Tree_Item *newitem);
+ char **arr,
+ Fl_Tree_Item *newitem);
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
- char **arr);
+ char **arr);
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 *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0);
@@ -254,11 +252,11 @@ public:
Fl_Tree_Item *next_sibling();
Fl_Tree_Item *prev_sibling();
void update_prev_next(int index);
- Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs); // deprecated
- Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs); // deprecated
+ Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs); // deprecated
+ Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs); // deprecated
Fl_Tree_Item *next_visible(Fl_Tree_Prefs &prefs);
Fl_Tree_Item *prev_visible(Fl_Tree_Prefs &prefs);
-
+
/// Return the parent for this item. Returns NULL if we are the root.
Fl_Tree_Item *parent() {
return(_parent);
@@ -299,7 +297,7 @@ public:
}
/// Toggle the item's open/closed state.
void open_toggle() {
- is_open()?close():open(); // handles calling recalc_tree()
+ is_open()?close():open(); // handles calling recalc_tree()
}
/// Change the item's selection state to the optionally specified 'val'.
/// If 'val' is not specified, the item will be selected.
@@ -310,9 +308,9 @@ public:
/// Toggle the item's selection state.
void select_toggle() {
if ( is_selected() ) {
- deselect(); // deselect if selected
+ deselect(); // deselect if selected
} else {
- select(); // select if deselected
+ select(); // select if deselected
}
}
/// Select item and all its children.
@@ -355,7 +353,7 @@ public:
}
/// Change the item's activation state to the optionally specified 'val'.
///
- /// When deactivated, the item will be 'grayed out'; the callback()
+ /// When deactivated, the item will be 'grayed out'; the callback()
/// won't be invoked if the user clicks on the label. If a widget()
/// is associated with the item, its activation state will be changed as well.
///
@@ -365,9 +363,9 @@ public:
set_flag(ACTIVE,val);
if ( _widget && val != (int)_widget->active() ) {
if ( val ) {
- _widget->activate();
+ _widget->activate();
} else {
- _widget->deactivate();
+ _widget->deactivate();
}
_widget->redraw();
}
@@ -407,7 +405,7 @@ public:
///
void usericon(Fl_Image *val) {
_usericon = val;
- 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.
Fl_Image *usericon() const {
@@ -467,7 +465,7 @@ protected:
/// Set a flag to an on or off value. val is 0 or 1.
inline void set_flag(unsigned short flag,int val) {
if ( flag==OPEN || flag==VISIBLE ) {
- recalc_tree(); // may change tree geometry
+ recalc_tree(); // may change tree geometry
}
if ( val ) _flags |= flag; else _flags &= ~flag;
}
@@ -479,7 +477,3 @@ protected:
};
#endif /*FL_TREE_ITEM_H*/
-
-//
-// End of "$Id$".
-//