class Fl_ToggleTree


Class Hierarchy

Include Files

Description

Fl_ToggleTree is a tree widget that allows branch visibility to be toggled on and off, similar to a collapsible list widget that is found in most widget tool kits.

Methods

  • Fl_ToggleTree
  • add_next
  • add_sub
  • close
  • closed_pixmap
  • column_char
  • column_widths
  • current
  • end_edit
  • find
  • handle
  • indent_toggles
  • label_offset
  • open
  • opened_pixmap
  • pixmap_offset
  • remove
  • selected
  • selection
  • select_range
  • state
  • textfont
  • textsize
  • textcolor
  • color
  • alternate_color
  • trim_color
  • selection_color
  • selection_label_color
  • draw_lines
  • traverse_start
  • traverse_forward
  • traverse_up
  • unselect
  • Fl_ToggleTree::Fl_ToggleTree(int x, int y, int w, int h)

    The constructor makes an empty Fl_ToggleTree.

    void Fl_ToggleTree::add_next(Fl_Node *n)
    Fl_ToggleNode * Fl_ToggleTree::add_next(char* label=0, int can_open=1, Fl_Pixmap* pixmap=0, void * d=0)

    The first form inserts n as the next item after the current node. If the tree is empty, then n becomes the first node of the toggle tree.

    The second form is equivalent to add_next(new Fl_ToggleNode(label, can_open, pixmap, d)).

    void Fl_ToggleTree::add_sub(Fl_Node *n)
    Fl_ToggleNode * Fl_ToggleTree::add_sub(char* label=0, int can_open=1, Fl_Pixmap* pixmap=0, void * d=0)

    The first form inserts n as the next sub item after the current node. If the tree is empty, then n becomes the first node of the toggle tree.

    The second form is equivalent to add_sub(new Fl_ToggleNode(label, can_open, pixmap, d)).

    void Fl_ToggleTree::close(Fl_Node *n)

    Close node n. This hides any sub items belonging to n.

    Fl_Pixmap * Fl_ToggleTree::close_pixmap()
    void Fl_ToggleTree::close_pixmap(Fl_Pixmap *p)

    Get or set the pixmap that is drawn when a node is "closed".

    char Fl_ToggleTree::column_char()
    void Fl_ToggleTree::column_char(char d)

    The first form gets the current column separator character. By default this is '\t' (tab).

    The second form sets the column separator to c. This will only have an effect if you also set column_widths().

    const int * Fl_ToggleTree::column_widths()
    void Fl_ToggleTree::column_widths(const int* l)

    The first form gets the current column width array. This array is zero-terminated and specifies the widths in pixels of each column. The text is split at each column_char() and each part is formatted into it's own column. After the last column any remaining text is formatted into the space between the last column and the right edge of the Fl_ToggleTree wdiget, even if the text contains instances of column_char() . The default value is a one-element array of just a zero, which makes there are no columns.

    The second form sets the current array to w. Make sure the last entry is zero.

    Fl_ToggleNode * Fl_ToggleTree::current()

    Returns the current node (as set with the traversal functions).

    void Fl_ToggleTree::edit_callback(Fl_Callback* c, void* p)
    void Fl_ToggleTree::edit_callback(Fl_Callback* c) void Fl_ToggleTree::edit_callback(Fl_Callback0* c) void Fl_ToggleTree::edit_callback(Fl_Callback1* c, void* p)

    Set the edit callback. A user defined callback should be sure to call end_edit().

    void Fl_ToggleTree::end_edit()

    Stop editing the current node.

    Fl_ToggleNode * Fl_ToggleTree::find(void *d)
    Fl_ToggleNode * Fl_ToggleTree::find(char *c)

    The first form finds the first node in the tree that matches the string c. If no node matches c, then find returns 0.

    The second form finds the first node in the tree whose data pointer is equal to the pointer d. If no node matches d, then find returns 0.

    void Fl_ToggleTree::handle()

    To change how Fl_ToggleTree handles events passed to it, you can subclass Fl_ToggleTree and override the handle function.

    void Fl_ToggleTree::indent_toggles(int b)
    int Fl_ToggleTree::indent_toggles()

    Gets or sets if toggled items are indented or not.

    void Fl_ToggleTree::draw_lines(int b)
    int Fl_ToggleTree::draw_lines()

    Gets or sets if lines are drawn between toggle nodes.

    void Fl_ToggleTree::label_offset(int x)

    Set the horizontal label offset to x pixels.

    void Fl_ToggleTree::open(Fl_Node *n)

    Open node n. This reveals any sub items belonging to n.

    Fl_Pixmap * Fl_ToggleTree::opened_pixmap()
    void Fl_ToggleTree::opened_pixmap(Fl_Pixmap *p)

    Get or set the pixmap displayed when a node is "open".

    void Fl_ToggleTree::pixmap_offset(int x)

    Set the horizontal pixmap offset to x pixels.

    int Fl_ToggleTree::remove(Fl_ToggleNode *n)
    int Fl_ToggleTree::remove(void *d)
    int Fl_ToggleTree::remove(char *c)

    The first form removes n (and all of it's sub nodes) from the tree. If successful remove returns 1, otherwise it returns 0.

    The second form performs a find() with d as it's argument and remove()s the returned node if it exists.

    The third form performs a find() with the string c as it's argument and remove()s the returned node if it exists.

    Fl_ToggleNode * Fl_ToggleTree::selected()

    Return the selected node. If multiple nodes are selected, then selected() returns 0, and selection() should be checked. Note that the current() node is not necessarily equal to the selected() node. Fl_ToggleTree attempts to maintain the selected item even while the tree is being modified. Of course, if the node is unselected or deleted by some operation, selected() will return 0.

    Fl_ToggleNode * Fl_ToggleTree::selection()
    Fl_ToggleNode * Fl_ToggleTree::selection(int i)

    The first form traverses forward and returns the next selected node.

    The second form returns the i-th selected node.

    void Fl_ToggleTree::select_range(Fl_ToggleNode* start, Fl_ToggleNode* end, int add=0)

    Sets nodes between start and end as selected. add..

    Fl_ToggleNode * Fl_ToggleTree::state()

    Returns the state of the Fl_ToggleTree widget. Enumerated states include: FL_TOGGLE_NONE = 0, FL_TOGGLE_SELECT = 1, FL_TOGGLE_RESELECT = 2, FL_TOGGLE_SELECT_MASK = 3, FL_TOGGLE_OPENED = 4, FL_TOGGLE_CLOSED = 8, FL_TOGGLE_HIT = 16,

    Fl_Font Fl_ToggleTree::textfont()
    void Fl_ToggleTree::textfont(Fl_Font d)

    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_ToggleTree::textsize()
    void Fl_ToggleTree::textsize(uchar d)

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

    The second form sets the default text size to size.

    uchar Fl_ToggleTree::textcolor()
    void Fl_ToggleTree::textcolor(uchar d)

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

    The second form sets the default text color to color

    uchar Fl_ToggleTree::color()
    void Fl_ToggleTree::color(uchar d)

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

    The second form sets the default background color to color

    uchar Fl_ToggleTree::alternate_color()
    void Fl_ToggleTree::alternate_color(uchar d)

    The first form gets the alternating background color for the lines in the browser.

    The second form sets the alternating background color to color

    uchar Fl_ToggleTree::trim_color()
    void Fl_ToggleTree::trim_color(uchar d)

    The first form gets the trim color that seperates lines of text in the browser.

    The second form sets the trim color.

    uchar Fl_ToggleTree::selection_color()
    void Fl_ToggleTree::selection_color(uchar d)

    The first form gets the selection background color for the lines in the browser.

    The second form sets the selection background color to color

    uchar Fl_ToggleTree::selection_label_color()
    void Fl_ToggleTree::selection_label_color(uchar d)

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

    The second form sets the selection text color to color

    void Fl_ToggleTree::traverse_start(Fl_Node* t)
    Fl_ToggleNode* Fl_ToggleTree::traverse_start()

    The first form of this method sets the current pointer to t. The second form of this method, sets the traversal pointer to first() and then returns first(). The second form is provided for convenience.

    Fl_ToggleNode* Fl_ToggleTree::traverse_forward(int visible, int &depth)
    Fl_ToggleNode* Fl_ToggleTree::traverse_forward()

    This method traverses forward through the tree. Traversal through the node tree is done by a depth first traversal that updates the current node pointer. If traverse_forward returns 0, then the current node pointer has reached the end of the tree. Otherwise, traverse_forward returns the next node in the tree.

    The visible flag should be set to 1 if you want to restrict traversal to the visible tree (the Fl_Nodes that are not closed). The depth variable is updated with the new node depth, if the old node depth is passed to traverse_forward.

    The second form of the method is the same as traverse_forward(0, temp).

    Fl_Node* Fl_ToggleTree::traverse_up()

    If the current node has an up pointer, traverse_up returns this pointer and sets it as the current node.

    void Fl_ToggleTree::unselect()

    Unselects all selected items.