class Fl_Tree


Class Hierarchy

Include Files

Description

This is the base class for Trees. Struct Fl_Menu_Item array is used as data input. You should subclass it to handle your specific data structure.

Methods

Fl_Tree::Fl_Tree(int, int, int, int, const char * = 0)

The constructor makes a default Tree widget.

Fl_Tree::~Fl_Tree(void)

The destructor calls item_free() for all tree items and destroys the Tree.

Fl_Tree::bbox(int &x, int &y, int &w, int &h) const

This method returns the bounding box for the interior of the list, inside the scrollbars.

Fl_Tree::deleting(void *a)

This method should be used when an item is deleted from the list. It allows the Fl_Tree to discard any cached data it has on the item.

int Fl_Tree::deselect(int docb=0)

Deselects all items in the list and returns 1 if the state changed or 0 if it did not.

If docb is non-zero, deselect tries to call the callback function for the widget.

Fl_Tree::display(void *p)

Displays item p, scrolling the list as necessary.

int Fl_Tree::displayed(void *p) const

This method returns non-zero if item p is currently visible in the list.

Fl_Tree::draw()
Fl_Tree::draw(int x, int y, int w, int h)

The first form draws the list within the normal widget bounding box.

The second form draws the contents of the browser within the specified bounding box.

void *Fl_Tree::find_item(int my)

This method returns the item under mouse at my. If no item is displayed at that position then NULL is returned.

virtual int Fl_Tree::full_height()

This method may be provided by the subclass to indicate the full height of the item list in pixels. The default implementation computes the full height from the item heights.

Fl_Tree::full_width()

This method may be provided by the subclass to indicate the full width of the item list in pixels. The default implementation computes the full width from the item widths.

Fl_Tree::handle(int event)
Fl_Tree::handle(int event, int x, int y, int w, int h)

The first form handles an event within the normal widget bounding box.

The second form handles an event within the specified bounding box.

void Fl_Tree::has_scrollbar(int h)

By default you can scroll in both directions, and the scrollbars disappear if the data will fit in the widget. has_scrollbar() changes this based on the value of h:

int Fl_Tree::hposition() const
Fl_Tree::hposition(int h)

Gets or sets the horizontal scrolling position of the list.

virtual int Fl_Tree::incr_height()

This method may be provided to return the average height of all items, to be used for scrolling. The default implementation uses the height of the first item.

Fl_Tree::inserting(void *a, void *b)

This method should be used when an item is added to the list. It allows the Fl_Tree to update its cache data as needed.

virtual void Fl_Tree::item_draw(void *p, int x, int y, int w, int h)

This method must be provided by the subclass to draw the item p in the area indicated by x, y, w, and h.

virtual void *Fl_Tree::item_first() const

This method must be provided by the subclass to return the first item in the list.

virtual int Fl_Tree::item_height(void *p)

This method must be provided by the subclass to return the height of the item p in pixels. Allow for two additional pixels for the list selection box.

virtual void *Fl_Tree::item_next(void *p) const

This method must be provided by the subclass to return the item in the list after p.

virtual void *Fl_Tree::item_prev(void *p) const

This method must be provided by the subclass to return the item in the list before p.

virtual int Fl_Tree::item_quick_height(void *p)

This method may be provided by the subclass to return the height of the item p in pixels. Allow for two additional pixels for the list selection box. This method differs from item_height in that it is only called for selection and scrolling operations. The default implementation calls item_height.

virtual void Fl_Tree::item_select(void *p, int s=1)

This method must be implemented by the subclass if it supports multiple selections in the browser. The s argument specifies the selection state for item p: 0 = off, 1 = on.

virtual int Fl_Tree::item_selected(void *p) const

This method must be implemented by the subclass if it supports multiple selections in the browser. The method should return 1 if p is selected and 0 otherwise.

virtual int Fl_Tree::item_width(void *p)

This method must be provided by the subclass to return the width of the item p in pixels. Allow for two additional pixels for the list selection box.

int Fl_Tree::leftedge() const

This method returns the X position of the left edge of the list area after adjusting for the scrollbar and border, if any.

Fl_Tree::new_list()

This method should be called when the list data is completely replaced or cleared. It informs the Fl_Tree widget that any cached information it has concerning the items is invalid.

int Fl_Tree::position() const
Fl_Tree::position(int v) const

Gets or sets the vertical scrolling position of the list.

Fl_Tree::redraw_line(void *p)

This method should be called when the contents of an item have changed but not changed the height of the item.

Fl_Tree::redraw_lines()

This method will cause the entire list to be redrawn.

Fl_Tree::replacing(void *a, void *b)

This method should be used when an item is replaced in the list. It allows the Fl_Tree to update its cache data as needed.

Fl_Tree::resize(int x, int y, int w, int h)

Repositions and/or resizes the browser.

Fl_Tree::scrollbar_left()

This method moves the vertical scrollbar to the lefthand side of the list.

Fl_Tree::scrollbar_right()

This method moves the vertical scrollbar to the righthand side of the list.

int Fl_Tree::select(void *p, int s=1, int docb=0)

Sets the selection state of item p to s and returns 1 if the state changed or 0 if it did not.

If docb is non-zero, select tries to call the callback function for the widget.

Fl_Tree::select_only(void *p, int docb=0)

Selects item p and returns 1 if the state changed or 0 if it did not. Any other items in the list are deselected.

If docb is non-zero, select_only tries to call the callback function for the widget.

void *Fl_Tree::selection() const

Returns the item currently selected, or NULL if there is no selection. For multiple selection browsers this call returns the last item that was selected.

Fl_Color Fl_Tree::textcolor() const
void Fl_Tree::textcolor(Fl_Color color)

The first form gets the default text color for the lines in the browser.

The second form sets the default text color to color

Fl_Font Fl_Tree::textfont() const
void Fl_Tree::textfont(Fl_Font font)

The first form gets the default text font for the lines in the browser.

The second form sets the default text font to font

uchar Fl_Tree::textsize() const
void Fl_Tree::textsize(uchar size)

The first form gets the default text size for the lines in the browser.

The second form sets the default text size to size

void *Fl_Tree::top() const

Returns the item the appears at the top of the list.