fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Tree_Item Class Reference

Tree item. More...

#include <Fl_Tree_Item.H>

Collaboration diagram for Fl_Tree_Item:

List of all members.

Public Member Functions

 Fl_Tree_Item (const Fl_Tree_Prefs &prefs)
 ~Fl_Tree_Item ()
 Fl_Tree_Item (const Fl_Tree_Item *o)
 Copy constructor.
int x () const
int y () const
int w () const
int h () const
void draw (int X, int &Y, int W, Fl_Widget *tree, Fl_Tree_Item *itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1)
 Draw this item and its children.
void show_self (const char *indent="") const
void label (const char *val)
 Set the label. Makes a copy of the name.
const char * label () const
 Return the label.
void user_data (void *data)
 Set a user-data value for the item.
void * user_data () const
 Retrieve the user-data value that has been assigned to the item.
void labelfont (int val)
 Set item's label font face.
int labelfont () const
 Get item's label font face.
void labelsize (int val)
 Set item's label font size.
int labelsize () const
 Get item's label font size.
void labelfgcolor (Fl_Color val)
 Set item's label foreground text color.
void labelcolor (Fl_Color val)
 Set item's label text color.
Fl_Color labelcolor () const
 Return item's label text color.
Fl_Color labelfgcolor () const
 Return item's label foreground text color.
void labelbgcolor (Fl_Color val)
 Set item's label background color.
Fl_Color labelbgcolor () const
 Return item's background text color.
void widget (Fl_Widget *val)
 Assign an FLTK widget to this item.
Fl_Widgetwidget () const
 Return FLTK widget assigned to this item.
int children () const
 Return the number of children this item has.
Fl_Tree_Itemchild (int index)
 Return the child item for the given 'index'.
const Fl_Tree_Itemchild (int t) const
 Return the const child item for the given 'index'.
int has_children () const
 See if this item has children.
int find_child (const char *name)
int find_child (Fl_Tree_Item *item)
int remove_child (Fl_Tree_Item *item)
int remove_child (const char *new_label)
void clear_children ()
 Clear all the children for this item.
void swap_children (int ax, int bx)
int swap_children (Fl_Tree_Item *a, Fl_Tree_Item *b)
const Fl_Tree_Itemfind_child_item (char **arr) const
Fl_Tree_Itemfind_child_item (char **arr)
const Fl_Tree_Itemfind_item (char **arr) const
Fl_Tree_Itemfind_item (char **arr)
Fl_Tree_Itemadd (const Fl_Tree_Prefs &prefs, const char *new_label)
Fl_Tree_Itemadd (const Fl_Tree_Prefs &prefs, char **arr)
Fl_Tree_Iteminsert (const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0)
Fl_Tree_Iteminsert_above (const Fl_Tree_Prefs &prefs, const char *new_label)
int depth () const
Fl_Tree_Itemprev ()
Fl_Tree_Itemnext ()
Fl_Tree_Itemnext_sibling ()
Fl_Tree_Itemprev_sibling ()
Fl_Tree_Itemnext_displayed (Fl_Tree_Prefs &prefs)
Fl_Tree_Itemprev_displayed (Fl_Tree_Prefs &prefs)
Fl_Tree_Itemparent ()
 Return the parent for this item. Returns NULL if we are the root.
const Fl_Tree_Itemparent () const
 Return the const parent for this item. Returns NULL if we are the root.
void parent (Fl_Tree_Item *val)
void open ()
 Open this item and all its children.
void close ()
 Close this item and all its children.
int is_open () const
 See if the item is 'open'.
int is_close () const
 See if the item is 'closed'.
void open_toggle ()
 Toggle the item's open/closed state.
void select (int val=1)
void select_toggle ()
 Toggle the item's selection state.
int select_all ()
void deselect ()
 Disable the item's selection state.
int deselect_all ()
char is_selected () const
 See if the item is selected.
void activate (int val=1)
void deactivate ()
char is_activated () const
 See if the item is activated.
char is_active () const
 See if the item is activated.
int visible () const
 See if the item is visible.
int visible_r () const
void usericon (Fl_Image *val)
 Set the user icon's image. '0' will disable.
Fl_Imageusericon () const
 Get the user icon. Returns '0' if disabled.
const Fl_Tree_Itemfind_clicked (const Fl_Tree_Prefs &prefs) const
Fl_Tree_Itemfind_clicked (const Fl_Tree_Prefs &prefs)
int event_on_collapse_icon (const Fl_Tree_Prefs &prefs) const
int event_on_label (const Fl_Tree_Prefs &prefs) const
int is_root () const
 Is this item the root of the tree?

Protected Member Functions

void show_widgets ()
void hide_widgets ()
void draw_vertical_connector (int x, int y1, int y2, const Fl_Tree_Prefs &prefs)
 Internal: Vertical connector line based on preference settings.
void draw_horizontal_connector (int x1, int x2, int y, const Fl_Tree_Prefs &prefs)
 Internal: Horizontal connector line based on preference settings.

Detailed Description

Tree item.

This class is a single tree item, and manages all of the item's attributes. Fl_Tree_Item is used by Fl_Tree, which is comprised of many instances of Fl_Tree_Item.

Fl_Tree_Item is hierarchical; it dynamically manages an Fl_Tree_Item_Array of children that are themselves instances of Fl_Tree_Item. Each item can have zero or more children. When an item has children, close() and open() can be used to hide or show them.

Items have their own attributes; font size, face, color. Items maintain their own hierarchy of children.

When you make changes to items, you'll need to tell the tree to redraw() for the changes to show up.

Definition at line 59 of file Fl_Tree_Item.H.


Constructor & Destructor Documentation

Fl_Tree_Item::Fl_Tree_Item ( const Fl_Tree_Prefs prefs)

Constructor. Makes a new instance of Fl_Tree_Item using defaults from 'prefs'.

Definition at line 43 of file Fl_Tree_Item.cxx.

References Fl_Tree_Prefs::bgcolor(), Fl_Tree_Prefs::fgcolor(), Fl_Tree_Prefs::labelfont(), and Fl_Tree_Prefs::labelsize().

Referenced by add(), and insert().

Fl_Tree_Item::~Fl_Tree_Item ( )

Definition at line 72 of file Fl_Tree_Item.cxx.

Fl_Tree_Item::Fl_Tree_Item ( const Fl_Tree_Item o)

Copy constructor.

Definition at line 83 of file Fl_Tree_Item.cxx.

References label(), labelbgcolor(), labelfgcolor(), labelfont(), labelsize(), user_data(), usericon(), and widget().


Member Function Documentation

void Fl_Tree_Item::activate ( int  val = 1) [inline]

Change the item's activation state to the optionally specified 'val'.

When deactivated, the item will be 'grayed out'; the callback() won't be invoked if the user clicks on the label. If the item has a widget() associated with the item, its activation state will be changed as well.

If 'val' is not specified, the item will be activated.

Definition at line 281 of file Fl_Tree_Item.H.

References val.

Fl_Tree_Item * Fl_Tree_Item::add ( const Fl_Tree_Prefs prefs,
const char *  new_label 
)

Add a new child to this item with the name 'new_label', with defaults from 'prefs'. An internally managed copy is made of the label string. Adds the item based on the value of prefs.sortorder().

Definition at line 260 of file Fl_Tree_Item.cxx.

References Fl_Tree_Item_Array::add(), Fl_Tree_Item(), FL_TREE_SORT_ASCENDING, FL_TREE_SORT_DESCENDING, FL_TREE_SORT_NONE, Fl_Tree_Item_Array::insert(), label(), Fl_Tree_Prefs::sortorder(), and Fl_Tree_Item_Array::total().

Referenced by add(), and Fl_Tree::add().

Fl_Tree_Item * Fl_Tree_Item::add ( const Fl_Tree_Prefs prefs,
char **  arr 
)

Descend into the path specified by arr, and add a new child there. Should be used only by Fl_Tree's internals. Adds the item based on the value of prefs.sortorder().

Returns:
the item added.

Definition at line 300 of file Fl_Tree_Item.cxx.

References add(), child(), and find_child().

Fl_Tree_Item* Fl_Tree_Item::child ( int  index) [inline]

Return the child item for the given 'index'.

Definition at line 154 of file Fl_Tree_Item.H.

Referenced by add(), find_child(), find_child_item(), insert_above(), Fl_Tree::last(), next(), next_sibling(), prev(), prev_sibling(), remove_child(), and show_self().

const Fl_Tree_Item * Fl_Tree_Item::child ( int  t) const

Return the const child item for the given 'index'.

Return child item for the specified 'index'.

Definition at line 142 of file Fl_Tree_Item.cxx.

int Fl_Tree_Item::children ( ) const [inline]

Return the number of children this item has.

Definition at line 150 of file Fl_Tree_Item.H.

Referenced by draw(), find_child(), find_child_item(), find_clicked(), find_item(), insert_above(), Fl_Tree::last(), next(), next_sibling(), prev(), remove_child(), show_self(), and swap_children().

void Fl_Tree_Item::clear_children ( )

Clear all the children for this item.

Definition at line 147 of file Fl_Tree_Item.cxx.

References Fl_Tree_Item_Array::clear().

Referenced by Fl_Tree::clear_children(), and remove_child().

void Fl_Tree_Item::close ( )

Close this item and all its children.

Definition at line 753 of file Fl_Tree_Item.cxx.

References Fl_Tree_Item_Array::total().

Referenced by Fl_Tree::close().

void Fl_Tree_Item::deactivate ( ) [inline]

Deactivate the item; the callback() won't be invoked when clicked. Same as activate(0)

Definition at line 295 of file Fl_Tree_Item.H.

int Fl_Tree_Item::depth ( ) const

Returns how many levels deep this item is in the hierarchy.

For instance; root has a depth of zero, and its immediate children would have a depth of 1, and so on.

Definition at line 766 of file Fl_Tree_Item.cxx.

References parent().

Referenced by show_self().

void Fl_Tree_Item::deselect ( ) [inline]

Disable the item's selection state.

Definition at line 250 of file Fl_Tree_Item.H.

Referenced by Fl_Tree::deselect().

int Fl_Tree_Item::deselect_all ( ) [inline]

Deselect self and all children Returns count of how many items were in the 'selected' state, ie. how many items were "changed".

Definition at line 257 of file Fl_Tree_Item.H.

References deselect().

void Fl_Tree_Item::draw_horizontal_connector ( int  x1,
int  x2,
int  y,
const Fl_Tree_Prefs prefs 
) [protected]

Internal: Horizontal connector line based on preference settings.

Definition at line 408 of file Fl_Tree_Item.cxx.

References Fl_Tree_Prefs::connectorcolor(), Fl_Tree_Prefs::connectorstyle(), fl_color(), fl_line(), fl_point(), FL_TREE_CONNECTOR_DOTTED, FL_TREE_CONNECTOR_NONE, and FL_TREE_CONNECTOR_SOLID.

Referenced by draw().

void Fl_Tree_Item::draw_vertical_connector ( int  x,
int  y1,
int  y2,
const Fl_Tree_Prefs prefs 
) [protected]

Internal: Vertical connector line based on preference settings.

Definition at line 429 of file Fl_Tree_Item.cxx.

References Fl_Tree_Prefs::connectorcolor(), Fl_Tree_Prefs::connectorstyle(), fl_color(), fl_line(), fl_point(), FL_TREE_CONNECTOR_DOTTED, FL_TREE_CONNECTOR_NONE, and FL_TREE_CONNECTOR_SOLID.

Referenced by draw().

int Fl_Tree_Item::event_on_collapse_icon ( const Fl_Tree_Prefs prefs) const

Was the event on the 'collapse' button?

Definition at line 703 of file Fl_Tree_Item.cxx.

References has_children(), and Fl_Tree_Prefs::showcollapse().

Referenced by Fl_Tree::handle().

int Fl_Tree_Item::event_on_label ( const Fl_Tree_Prefs prefs) const

Was event on the label()?

Definition at line 713 of file Fl_Tree_Item.cxx.

Referenced by Fl_Tree::handle().

int Fl_Tree_Item::find_child ( Fl_Tree_Item item)

Find the index number for the specified 'item' in the current item's list of children.

Returns:
the index, or -1 if not found.

Definition at line 247 of file Fl_Tree_Item.cxx.

References child(), and children().

int Fl_Tree_Item::find_child ( const char *  name)

Return the index of the immediate child of this item that has the label 'name'.

Returns:
index of found item, or -1 if not found.

Definition at line 155 of file Fl_Tree_Item.cxx.

References child(), children(), and label().

Referenced by add(), next(), next_sibling(), prev(), and prev_sibling().

Fl_Tree_Item * Fl_Tree_Item::find_child_item ( char **  arr)

Find child item by descending array of names. Does not include self in search. Only Fl_Tree should need this method. Use Fl_Tree::find_item() instead.

Returns:
item, or 0 if not found

Definition at line 193 of file Fl_Tree_Item.cxx.

References child(), children(), find_item(), and label().

const Fl_Tree_Item * Fl_Tree_Item::find_child_item ( char **  arr) const

Find child item by descending array of names. Does not include self in search. Only Fl_Tree should need this method.

Returns:
item, or 0 if not found

Definition at line 173 of file Fl_Tree_Item.cxx.

References child(), children(), find_item(), and label().

Referenced by find_item().

const Fl_Tree_Item * Fl_Tree_Item::find_clicked ( const Fl_Tree_Prefs prefs) const

Find the item that the last event was over.

Returns the item if its visible, and mouse is over it. Works even if widget deactivated. Use event_on_collapse_icon() to determine if collapse button was pressed.

Returns:
const visible item under the event if found, or 0 if none.

Definition at line 459 of file Fl_Tree_Item.cxx.

References children(), is_open(), is_root(), NULL, and Fl_Tree_Prefs::showroot().

Referenced by find_clicked(), Fl_Tree::find_clicked(), and Fl_Tree::handle().

Fl_Tree_Item * Fl_Tree_Item::find_clicked ( const Fl_Tree_Prefs prefs)

Non-const version of the above. Find the item that the last event was over.

Returns the item if its visible, and mouse is over it. Works even if widget deactivated. Use event_on_collapse_icon() to determine if collapse button was pressed.

Returns:
the visible item under the event if found, or 0 if none.

Definition at line 489 of file Fl_Tree_Item.cxx.

References children(), find_clicked(), is_open(), is_root(), NULL, and Fl_Tree_Prefs::showroot().

const Fl_Tree_Item * Fl_Tree_Item::find_item ( char **  names) const

Find item by descending array of names. Includes self in search. Only Fl_Tree should need this method. Use Fl_Tree::find_item() instead.

Returns:
item, or 0 if not found

Definition at line 213 of file Fl_Tree_Item.cxx.

References children(), find_child_item(), and label().

Referenced by find_child_item(), and Fl_Tree::find_item().

Fl_Tree_Item * Fl_Tree_Item::find_item ( char **  names)

Find item by descending array of names. Includes self in search. Only Fl_Tree should need this method.

Returns:
item, or 0 if not found

Definition at line 230 of file Fl_Tree_Item.cxx.

References children(), find_child_item(), and label().

int Fl_Tree_Item::h ( ) const [inline]
int Fl_Tree_Item::has_children ( ) const [inline]

See if this item has children.

Definition at line 160 of file Fl_Tree_Item.H.

Referenced by Fl_Tree::clear_children(), draw(), event_on_collapse_icon(), Fl_Tree::last(), next(), next_displayed(), and prev().

void Fl_Tree_Item::hide_widgets ( ) [protected]

Internal: Hide the FLTK widget() for this item and all children. Used by close() to hide widgets.

Definition at line 736 of file Fl_Tree_Item.cxx.

References Fl_Widget::hide(), and Fl_Tree_Item_Array::total().

Fl_Tree_Item * Fl_Tree_Item::insert ( const Fl_Tree_Prefs prefs,
const char *  new_label,
int  pos = 0 
)

Insert a new item into current item's children at a specified position.

Returns:
the new item inserted.

Definition at line 318 of file Fl_Tree_Item.cxx.

References Fl_Tree_Item(), Fl_Tree_Item_Array::insert(), and label().

Referenced by Fl_Tree::insert(), and insert_above().

Fl_Tree_Item * Fl_Tree_Item::insert_above ( const Fl_Tree_Prefs prefs,
const char *  new_label 
)

Insert a new item above this item.

Returns:
the new item inserted, or 0 if an error occurred.

Definition at line 329 of file Fl_Tree_Item.cxx.

References child(), children(), and insert().

Referenced by Fl_Tree::insert_above().

char Fl_Tree_Item::is_activated ( ) const [inline]

See if the item is activated.

Definition at line 299 of file Fl_Tree_Item.H.

char Fl_Tree_Item::is_active ( ) const [inline]

See if the item is activated.

Definition at line 303 of file Fl_Tree_Item.H.

int Fl_Tree_Item::is_close ( ) const [inline]

See if the item is 'closed'.

Definition at line 213 of file Fl_Tree_Item.H.

Referenced by Fl_Tree::close(), Fl_Tree::handle(), Fl_Tree::is_close(), next_displayed(), and prev_displayed().

int Fl_Tree_Item::is_open ( ) const [inline]

See if the item is 'open'.

Definition at line 209 of file Fl_Tree_Item.H.

Referenced by draw(), find_clicked(), Fl_Tree::handle(), Fl_Tree::is_open(), Fl_Tree::open(), Fl_Tree::open_toggle(), and show_widgets().

int Fl_Tree_Item::is_root ( ) const [inline]

Is this item the root of the tree?

Definition at line 328 of file Fl_Tree_Item.H.

Referenced by draw(), find_clicked(), Fl_Tree::item_pathname(), next_displayed(), and prev_displayed().

char Fl_Tree_Item::is_selected ( ) const [inline]
void Fl_Tree_Item::label ( const char *  val)

Set the label. Makes a copy of the name.

Definition at line 131 of file Fl_Tree_Item.cxx.

Referenced by add(), Fl_Tree::add(), find_child(), find_child_item(), Fl_Tree::Fl_Tree(), Fl_Tree_Item(), insert(), Fl_Tree::item_pathname(), and remove_child().

const char * Fl_Tree_Item::label ( ) const

Return the label.

Definition at line 137 of file Fl_Tree_Item.cxx.

Referenced by find_child(), find_child_item(), find_item(), remove_child(), and show_self().

void Fl_Tree_Item::labelbgcolor ( Fl_Color  val) [inline]

Set item's label background color.

Definition at line 134 of file Fl_Tree_Item.H.

References val.

Referenced by Fl_Tree_Item().

Fl_Color Fl_Tree_Item::labelbgcolor ( ) const [inline]

Return item's background text color.

Definition at line 138 of file Fl_Tree_Item.H.

void Fl_Tree_Item::labelcolor ( Fl_Color  val) [inline]

Set item's label text color.

Definition at line 122 of file Fl_Tree_Item.H.

References val.

Fl_Color Fl_Tree_Item::labelcolor ( ) const [inline]

Return item's label text color.

Definition at line 126 of file Fl_Tree_Item.H.

Fl_Color Fl_Tree_Item::labelfgcolor ( ) const [inline]

Return item's label foreground text color.

Definition at line 130 of file Fl_Tree_Item.H.

void Fl_Tree_Item::labelfgcolor ( Fl_Color  val) [inline]

Set item's label foreground text color.

Definition at line 118 of file Fl_Tree_Item.H.

References val.

Referenced by Fl_Tree_Item().

int Fl_Tree_Item::labelfont ( ) const [inline]

Get item's label font face.

Definition at line 106 of file Fl_Tree_Item.H.

void Fl_Tree_Item::labelfont ( int  val) [inline]

Set item's label font face.

Definition at line 102 of file Fl_Tree_Item.H.

References val.

Referenced by Fl_Tree_Item().

void Fl_Tree_Item::labelsize ( int  val) [inline]

Set item's label font size.

Definition at line 110 of file Fl_Tree_Item.H.

References val.

Referenced by Fl_Tree_Item().

int Fl_Tree_Item::labelsize ( ) const [inline]

Get item's label font size.

Definition at line 114 of file Fl_Tree_Item.H.

Fl_Tree_Item * Fl_Tree_Item::next ( )

Return the next item in the tree.

This method can be used to walk the tree forward. For an example of how to use this method, see Fl_Tree::first().

Returns:
the next item in the tree, or 0 if there's no more items.

Definition at line 783 of file Fl_Tree_Item.cxx.

References child(), children(), find_child(), has_children(), NULL, and parent().

Referenced by Fl_Tree::next(), next_displayed(), Fl_Tree::next_selected_item(), and Fl_Tree::select_only().

Fl_Tree_Item * Fl_Tree_Item::next_displayed ( Fl_Tree_Prefs prefs)

Return the next visible item. (If this item has children and is closed, children are skipped)

This method can be used to walk the tree forward, skipping items that are not currently visible to the user.

Returns:
the next visible item below us, or 0 if there's no more items.

Definition at line 857 of file Fl_Tree_Item.cxx.

References has_children(), is_close(), is_root(), next(), next_sibling(), parent(), Fl_Tree_Prefs::showroot(), and visible().

Referenced by Fl_Tree::next_visible_item().

Fl_Tree_Item * Fl_Tree_Item::next_sibling ( )

Return this item's next sibling.

Moves to the next item below us at the same level (sibling). Use this to move down the tree without moving deeper into the tree, effectively skipping over this item's children/descendents.

Returns:
item's next sibling, or 0 if none.

Definition at line 826 of file Fl_Tree_Item.cxx.

References child(), children(), find_child(), and parent().

Referenced by next_displayed().

void Fl_Tree_Item::open ( )

Open this item and all its children.

Definition at line 744 of file Fl_Tree_Item.cxx.

References Fl_Tree_Item_Array::total().

Referenced by Fl_Tree::open().

void Fl_Tree_Item::open_toggle ( ) [inline]

Toggle the item's open/closed state.

Definition at line 217 of file Fl_Tree_Item.H.

void Fl_Tree_Item::parent ( Fl_Tree_Item val) [inline]

Set the parent for this item. Should only be used by Fl_Tree's internals.

Definition at line 200 of file Fl_Tree_Item.H.

References val.

Fl_Tree_Item* Fl_Tree_Item::parent ( ) [inline]

Return the parent for this item. Returns NULL if we are the root.

Definition at line 190 of file Fl_Tree_Item.H.

Referenced by Fl_Tree::add(), depth(), Fl_Tree::Fl_Tree(), Fl_Tree::item_pathname(), next(), next_displayed(), next_sibling(), prev(), prev_displayed(), prev_sibling(), Fl_Tree::remove(), and visible_r().

const Fl_Tree_Item* Fl_Tree_Item::parent ( ) const [inline]

Return the const parent for this item. Returns NULL if we are the root.

Definition at line 194 of file Fl_Tree_Item.H.

Fl_Tree_Item * Fl_Tree_Item::prev ( )

Return the previous item in the tree.

This method can be used to walk the tree backwards. For an example of how to use this method, see Fl_Tree::last().

Returns:
the previous item in the tree, or 0 if there's no item above this one (hit the root).

Definition at line 804 of file Fl_Tree_Item.cxx.

References child(), children(), find_child(), has_children(), and parent().

Referenced by Fl_Tree::prev(), and prev_displayed().

Fl_Tree_Item * Fl_Tree_Item::prev_displayed ( Fl_Tree_Prefs prefs)

Return the previous visible item. (If this item above us has children and is closed, its children are skipped)

This method can be used to walk the tree backward, skipping items that are not currently visible to the user.

Returns:
the previous visible item above us, or 0 if there's no more items.

Definition at line 895 of file Fl_Tree_Item.cxx.

References is_close(), is_root(), parent(), prev(), Fl_Tree_Prefs::showroot(), and visible().

Referenced by Fl_Tree::next_visible_item().

Fl_Tree_Item * Fl_Tree_Item::prev_sibling ( )

Return this item's previous sibling.

Moves to the previous item above us at the same level (sibling). Use this to move up the tree without moving deeper into the tree.

Returns:
This item's previous sibling, or 0 if none.

Definition at line 842 of file Fl_Tree_Item.cxx.

References child(), find_child(), and parent().

int Fl_Tree_Item::remove_child ( Fl_Tree_Item item)

Remove child by item.

Returns:
0 if removed, -1 if item not an immediate child.

Definition at line 345 of file Fl_Tree_Item.cxx.

References child(), children(), clear_children(), and Fl_Tree_Item_Array::remove().

Referenced by Fl_Tree::remove().

int Fl_Tree_Item::remove_child ( const char *  name)

Remove immediate child (and its children) by its label 'name'.

Returns:
0 if removed, -1 if not found.

Definition at line 359 of file Fl_Tree_Item.cxx.

References child(), children(), label(), and Fl_Tree_Item_Array::remove().

void Fl_Tree_Item::select ( int  val = 1) [inline]

Change the item's selection state to the optionally specified 'val'. If 'val' is not specified, the item will be selected.

Definition at line 223 of file Fl_Tree_Item.H.

References val.

Referenced by Fl_Tree::select().

int Fl_Tree_Item::select_all ( ) [inline]

Select self and all children Returns count of how many items were in the 'deselected' state, ie. how many items were "changed".

Definition at line 238 of file Fl_Tree_Item.H.

References select().

void Fl_Tree_Item::select_toggle ( ) [inline]

Toggle the item's selection state.

Definition at line 227 of file Fl_Tree_Item.H.

References deselect(), and select().

Referenced by Fl_Tree::select_toggle().

void Fl_Tree_Item::show_self ( const char *  indent = "") const

Print the tree as 'ascii art' to stdout. Used mainly for debugging.

Definition at line 114 of file Fl_Tree_Item.cxx.

References child(), children(), depth(), label(), and show_self().

Referenced by show_self().

void Fl_Tree_Item::show_widgets ( ) [protected]

Internal: Show the FLTK widget() for this item and all children. Used by open() to re-show widgets that were hidden by a previous close()

Definition at line 724 of file Fl_Tree_Item.cxx.

References is_open(), Fl_Widget::show(), and Fl_Tree_Item_Array::total().

void Fl_Tree_Item::swap_children ( int  ax,
int  bx 
)

Swap two of our children, given two child index values. Use this eg. for sorting.

This method is FAST, and does not involve lookups.

No range checking is done on either index value.

Returns:
  • 0 : OK
  • -1 : failed: 'a' or 'b' is not our immediate child

Definition at line 382 of file Fl_Tree_Item.cxx.

References Fl_Tree_Item_Array::swap().

Referenced by swap_children().

int Fl_Tree_Item::swap_children ( Fl_Tree_Item a,
Fl_Tree_Item b 
)

Swap two of our children, given item pointers. Use this eg. for sorting.

This method is SLOW because it involves linear lookups. For speed, use swap_children(int,int) instead.

Returns:
  • 0 : OK
  • -1 : failed: 'a' or 'b' is not our immediate child

Definition at line 396 of file Fl_Tree_Item.cxx.

References children(), and swap_children().

void* Fl_Tree_Item::user_data ( ) const [inline]

Retrieve the user-data value that has been assigned to the item.

Definition at line 99 of file Fl_Tree_Item.H.

void Fl_Tree_Item::user_data ( void *  data) [inline]

Set a user-data value for the item.

Definition at line 96 of file Fl_Tree_Item.H.

References data.

Referenced by Fl_Tree_Item().

Fl_Image* Fl_Tree_Item::usericon ( ) const [inline]

Get the user icon. Returns '0' if disabled.

Definition at line 317 of file Fl_Tree_Item.H.

Referenced by draw().

void Fl_Tree_Item::usericon ( Fl_Image val) [inline]

Set the user icon's image. '0' will disable.

Definition at line 313 of file Fl_Tree_Item.H.

References val.

Referenced by Fl_Tree_Item().

int Fl_Tree_Item::visible ( ) const [inline]

See if the item is visible.

Definition at line 307 of file Fl_Tree_Item.H.

Referenced by next_displayed(), and prev_displayed().

int Fl_Tree_Item::visible_r ( ) const

Returns if item and all its parents are visible. Also takes into consideration if any parent is close()ed.

Returns:
1 -- item and its parents are visible/open() 0 -- item (or parents) invisible or close()ed.

Definition at line 921 of file Fl_Tree_Item.cxx.

References parent().

Referenced by Fl_Tree::next_visible_item().

int Fl_Tree_Item::w ( ) const [inline]

Definition at line 88 of file Fl_Tree_Item.H.

Referenced by draw().

void Fl_Tree_Item::widget ( Fl_Widget val) [inline]

Assign an FLTK widget to this item.

Definition at line 142 of file Fl_Tree_Item.H.

References val.

Referenced by Fl_Tree_Item(), and Fl_Tree::handle().

Fl_Widget* Fl_Tree_Item::widget ( ) const [inline]

Return FLTK widget assigned to this item.

Definition at line 146 of file Fl_Tree_Item.H.

Referenced by draw().

int Fl_Tree_Item::x ( ) const [inline]

Definition at line 86 of file Fl_Tree_Item.H.

Referenced by draw().

int Fl_Tree_Item::y ( ) const [inline]

Definition at line 87 of file Fl_Tree_Item.H.

Referenced by Fl_Tree::displayed(), draw(), Fl_Tree::handle(), and Fl_Tree::show_item().


The documentation for this class was generated from the following files: