YTree Class Reference
Implementation of the Tree widget.
More...
#include <YTree.h>
Inheritance diagram for YTree:
List of all members.
|
Public Member Functions |
| YTree (const YWidgetOpt &opt, YCPString label) |
virtual | ~YTree () |
virtual char * | widgetClass () |
virtual void | rebuildTree () |
YTreeItem * | addItem (YTreeItem *parentItem, const YCPValue &id, const YCPString &text, const YCPString &iconName, bool open) |
YTreeItem * | addItem (YTreeItem *parentItem, const YCPString &text, const YCPString &iconName, void *data, bool open) |
YCPValue | changeWidget (const YCPSymbol &property, const YCPValue &newvalue) |
YCPValue | queryWidget (const YCPSymbol &property) |
virtual void | setLabel (const YCPString &label) |
YCPString | getLabel () |
const char * | shortcutProperty () |
const char * | userInputProperty () |
bool | parseItemList (const YCPList &itemList, YTreeItem *parentItem=0) |
bool | hasIcons () const |
YCPValue | currentBranch () const |
Protected Member Functions |
virtual const YTreeItem * | getCurrentItem () const =0 |
virtual void | setCurrentItem (YTreeItem *it)=0 |
YTreeItem * | findItemWithId (const YCPValue &id) |
YTreeItem * | findItemWithText (const YCPString &text) |
YCPList | itemsTermList (YTreeItemList items) |
void | findOpenItems (YCPMap &openItems, YTreeItemList items) |
virtual void | deleteAllItems () |
Static Protected Member Functions |
static void | branchToList (YCPList &branchList, const YTreeItem *item) |
Protected Attributes |
YTreeItemList | items |
Private Member Functions |
virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
Private Attributes |
YCPString | label |
bool | _hasIcons |
Friends |
class | YTreeItem |
Detailed Description
Implementation of the Tree widget.
Tree
- string label itemList items the items contained in the tree
itemList ::= [ item [ , item ] [ , item ] ... ] item ::= string | `item( [ `id( string ),] string [ , true | false ] [ , itemList ] )
The boolean parameter inside `item() indicates whether or not the respective tree item should be opened by default - if it has any subitems and if the respective UI is capable of closing and opening subtrees. If the UI cannot handle this, all subtrees will always be open.
`Tree( `id( `treeID ), "treeLabel", [ "top1", "top2", "top3" ] ); Tree1.ycp Tree2.ycp Tree3.ycp Tree-icons.ycp Tree-replace-items.ycp Wizard4.ycp
A tree widget provides a selection from a hierarchical tree structure. The semantics are very much like those of a SelectionBox. Unlike the SelectionBox, however, tree items may have subitems that in turn may have subitems etc.
Each item has a label string, optionally preceded by an ID. If the item has subitems, they are specified as a list of items after the string.
The tree widget will not perform any sorting on its own: The items are always sorted by insertion order. The application needs to handle sorting itself, if desired.
Note: The Qt version of the Wizard widget also provides a built-in tree with an API that is (sometimes) easier to use.
Constructor & Destructor Documentation
|
Constructor - Parameters:
-
| opt | the widget options |
| text | the initial text of the label |
|
YTree::~YTree |
( |
|
) |
[virtual] |
|
|
Destructor. Frees all tree items. |
Member Function Documentation
|
Adds an item to the selection box.
Uses an opaque data pointer for application use. Use YTreeItem::data() to retrieve this kind of data. The application is responsible for the data contents - and of course for avoiding dangling pointers. |
|
Adds an item to the selection box. |
void YTree::branchToList |
( |
YCPList & |
branchList, |
|
|
const YTreeItem * |
item |
|
) |
[static, protected] |
|
|
Recursively add items to list 'branchList' from 'item' up to the tree's root |
|
Implements the ui command changeWidget.
Reimplemented from YWidget. |
|
Returns a list of the current item and all its ancestors from the root item to the current item - either the respective IDs or, for items that don't have IDs, the item text. If no item is currently selected, YCPVoid ('nil') is returned. |
void YTree::deleteAllItems |
( |
|
) |
[protected, virtual] |
|
|
Cleares the YTreeItemList. This function is calles out of the corresponding YQ classes. |
|
Recursively search for an item with a given ID. Returns 0 if not found. |
|
Recursively search for an item with a given text. Returns 0 if not found. |
|
Recursively fills a map 'openItems' with items that are open. |
virtual const YTreeItem* YTree::getCurrentItem |
( |
|
) |
const [protected, pure virtual] |
|
|
Returns the index of the currently selected item or -1 if no item is selected. |
|
Get the current label text. This method cannot be overidden.
The value of the label cannot be changed other than by calling setLabel, i.e. not by the ui. Therefore setLabel stores the current label in label. |
bool YTree::hasIcons |
( |
|
) |
const [inline] |
|
|
Returns 'true' if any item of this widget has an icon |
|
Returns a YCPList of items in the format needed for creating a tree widget. |
bool YTree::parseItemList |
( |
const YCPList & |
itemList, |
|
|
YTreeItem * |
parentItem = 0 |
|
) |
|
|
|
Parses a given item list and calls addItem(...) to insert entries.
Returns 'true' on succes, 'false' on error. |
|
Implements the ui command queryWidget.
Reimplemented from YWidget. |
void YTree::rebuildTree |
( |
|
) |
[virtual] |
|
|
Called once after items have been added.
Overload this to fill the ui specific widget with items. |
void YTree::saveUserInput |
( |
YMacroRecorder * |
macroRecorder |
) |
[private, virtual] |
|
|
Save the widget's user input to a macro recorder. Intentionally declared as "private" so all macro recording internals are handled by the abstract libyui level, not by a specific UI.
Reimplemented from YWidget. |
virtual void YTree::setCurrentItem |
( |
YTreeItem * |
it |
) |
[protected, pure virtual] |
|
void YTree::setLabel |
( |
const YCPString & |
label |
) |
[virtual] |
|
|
Change the label text. Overload this, but call YTextEntry::setLabel at the end of your own function. |
const char* YTree::shortcutProperty |
( |
|
) |
[inline, virtual] |
|
|
The name of the widget property that holds the keyboard shortcut. Inherited from YWidget.
Reimplemented from YWidget. |
const char* YTree::userInputProperty |
( |
|
) |
[inline, virtual] |
|
|
The name of the widget property that will return user input. Inherited from YWidget.
Reimplemented from YWidget. |
virtual char* YTree::widgetClass |
( |
|
) |
[inline, virtual] |
|
|
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YWidget. |
Friends And Related Function Documentation
Member Data Documentation
The documentation for this class was generated from the following files:
Generated on Fri Jun 16 18:07:47 2006 for yast2-core by
1.4.6