![]() |
Public API Reference |
#include <cstree.h>
Inheritance diagram for csTreeBox:
Public Methods | |
csTreeBox (csComponent *iParent, int iStyle=CSTS_DEFAULTVALUE, csTreeFrameStyle iFrameStyle=cstfsThickRect) | |
Create input line object. More... | |
virtual | ~csTreeBox () |
Destroy the tree box. More... | |
virtual bool | HandleEvent (iEvent &Event) |
Handle external events and generate timeouts. More... | |
virtual void | Draw () |
Draw the tree. More... | |
void | PlaceItems (int sbFlags=CSTS_HSCROLL|CSTS_VSCROLL) |
Find a place for each tree item, and optionally set scrollbar parameters. More... | |
virtual bool | SetRect (int xmin, int ymin, int xmax, int ymax) |
Resize child items on parent window resize. More... | |
csTreeItem * | ForEachItem (bool(*func)(csTreeItem *child, void *param), void *param=0, bool iOnlyOpen=false) |
For each tree item call a function with a optional arg Function returns the first child on which func returnes 'true'. More... | |
virtual void | SetState (int mask, bool enable) |
Override SetState method to toggle scrollbars together with CSS_SELECTED. More... | |
virtual void | Insert (csComponent *comp) |
Set fPlaceItems since a item has been inserted. More... | |
virtual void | ExpandAll () |
Expand all items. More... | |
virtual void | CollapseAll () |
Collapse all items. More... | |
int | GetStyle () |
Query tree box style. More... | |
csTreeFrameStyle | GetFrameStyle () |
Query tree box frame style. More... | |
void | SetStyle (int iStyle, csTreeFrameStyle iFrameStyle) |
Change tree box style. More... | |
Protected Methods | |
void | PrepareButton (csButton *iButton, bool iOpen) |
Set the imagess for expand/collapse button. More... | |
void | MakeItemVisible (csComponent *iItem, bool iChildren=false) |
Make a tree item visible (the functionality for cscmdTreeMakeVisible). More... | |
void | FocusItem (csTreeItem *iItem) |
Focus a item (and defocus all other items). More... | |
void | VScroll (int iDelta, bool iMoveCaret) |
Scroll vertically by iDelta pixels, possibly preserving caret's relative Y. More... | |
void | PlaceScrollbars () |
Place scrollbars and the csTreeView. More... | |
Friends | |
class | csTreeItem |
In other words, every tree item can contain a subtree itself. In very other words, the tree is a graph, every vertex of which has one incoming and several outgoing edges. The csTreeBox control can hold several trees at once (e.g. it can have several "roots"). csTreeBox control ALWAYS contains just one selected item at a time; multiple selection mode is not implemented (I don't see why this may be useful anyway).
Every csTreeItem that is inserted into the tree is queried for its preferred size (in particular its preffered height), and the next item is positioned at the bottom of every previous item. Every csTreeItem asks in turn all his child nodes (if the tree node is "open") or just returns its own height without child nodes.
Example code how to create a tree:
csTreeBox *tree = new csTreeBox (app); tree->SetRect (0, 0, 200, 400); csTreeItem *item1, *item2, *item3; item1 = new csTreeItem (tree, "My Computer"); item2 = new csTreeItem (item1, "C:\"); item3 = new csTreeItem (item2, "Blindows"); item3 = new csTreeItem (item2, "Suxx"); item2 = new csTreeItem (item1, "D:\"); item3 = new csTreeItem (item2, "My Documents"); item3 = new csTreeItem (item2, "My Toys"); item3 = new csTreeItem (item2, "My Mom Told Me - Dont Run Windows"); item2 = new csTreeItem (item1, "\\SAMBA\RULEZ\FOREVER\"); item3 = new csTreeItem (item2, "Home directory"); item3 = new csTreeItem (item2, "Public stuff"); *Keyboard navigation:
Definition at line 425 of file cstree.h.
|
Create input line object.
|
|
Destroy the tree box.
|
|
Collapse all items.
|
|
Draw the tree.
Reimplemented from csComponent. |
|
Expand all items.
|
|
Focus a item (and defocus all other items).
|
|
For each tree item call a function with a optional arg Function returns the first child on which func returnes 'true'.
|
|
Query tree box frame style.
|
|
Query tree box style.
|
|
Handle external events and generate timeouts.
Reimplemented from csComponent. |
|
Set fPlaceItems since a item has been inserted.
Reimplemented from csComponent. |
|
Make a tree item visible (the functionality for cscmdTreeMakeVisible).
|
|
Find a place for each tree item, and optionally set scrollbar parameters.
|
|
Place scrollbars and the csTreeView.
|
|
Set the imagess for expand/collapse button.
|
|
Resize child items on parent window resize.
Reimplemented from csComponent. |
|
Override SetState method to toggle scrollbars together with CSS_SELECTED.
Reimplemented from csComponent. |
|
Change tree box style.
|
|
Scroll vertically by iDelta pixels, possibly preserving caret's relative Y.
|