csTreeBox Class Reference
[Tree box]
The csTreeBox class is a rectangle which contains a number of subrectangles, each of which is recursively similar to its parent.
More...
#include <cstree.h>
Inheritance diagram for csTreeBox:

Public Methods | |
csTreeBox (csComponent *iParent, int iStyle=CSTS_DEFAULTVALUE, csTreeFrameStyle iFrameStyle=cstfsThickRect) | |
Create input line object. | |
virtual | ~csTreeBox () |
Destroy the tree box. | |
virtual bool | HandleEvent (iEvent &Event) |
Handle external events and generate timeouts. | |
virtual void | Draw () |
Draw the tree. | |
void | PlaceItems (int sbFlags=CSTS_HSCROLL|CSTS_VSCROLL) |
Find a place for each tree item, and optionally set scrollbar parameters. | |
virtual bool | SetRect (int xmin, int ymin, int xmax, int ymax) |
Resize child items on parent window resize. | |
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'. | |
virtual void | SetState (int mask, bool enable) |
Override SetState method to toggle scrollbars together with CSS_SELECTED. | |
virtual void | Insert (csComponent *comp) |
Set fPlaceItems since a item has been inserted. | |
virtual void | ExpandAll () |
Expand all items. | |
virtual void | CollapseAll () |
Collapse all items. | |
int | GetStyle () |
Query tree box style. | |
csTreeFrameStyle | GetFrameStyle () |
Query tree box frame style. | |
void | SetStyle (int iStyle, csTreeFrameStyle iFrameStyle) |
Change tree box style. | |
Protected Methods | |
void | PrepareButton (csButton *iButton, bool iOpen) |
Set the imagess for expand/collapse button. | |
void | MakeItemVisible (csComponent *iItem, bool iChildren=false) |
Make a tree item visible (the functionality for cscmdTreeMakeVisible). | |
void | FocusItem (csTreeItem *iItem) |
Focus a item (and defocus all other items). | |
void | VScroll (int iDelta, bool iMoveCaret) |
Scroll vertically by iDelta pixels, possibly preserving caret's relative Y. | |
void | PlaceScrollbars () |
Place scrollbars and the csTreeView. |
Detailed Description
The csTreeBox class is a rectangle which contains a number of subrectangles, each of which is recursively similar to its parent.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:
- Up/Down
- Select previous/next tree item
- Left/Right
- Scroll tree horizontally (if meaningful)
- Ctrl+Left/Right
- Scroll horizontally in big steps
- PgUp/PgDn
- Go to the previous/next page of the tree.
- Shift+PgUp/PgDn
- Show the previous/next page of the tree (does not move the caret).
- Ctrl+PgUp/PgDn
- Go to the first/last tree item
- Home/End
- Scroll to left/right margin.
- Ctrl+Home/End
- Scroll to the beginning/end of the tree (does not move the caret).
- Keypad PLUS/MINUS
- Expand/collapse current branch.
- Ctrl+Keypad PLUS/MINUS
- Expand/collapse all branches at once.
- Shift+Keypad PLUS/MINUS
- Expand/collapse all the items contained in the current branch.
- Space
- Toggle expand/collapse current branch
- Any other symbols
- Find the next item that starts with given character. For example, pressing 'a' will find the first item following current which starts with 'A' or 'a'; if there is no one until the end of tree, the search is restarted from top; if there is no such item at all, the cursor stays still.
Definition at line 427 of file cstree.h.
Constructor & Destructor Documentation
|
Create input line object.
|
|
Destroy the tree box.
|
Member Function Documentation
|
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.
|
The documentation for this class was generated from the following file:
- csws/cstree.h
Generated for Crystal Space by doxygen 1.2.18