#include <YTree.h>
Inheritance diagram for YTree:

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 |
Tree
itemList ::= [ item [ , item ] [ , item ] ... ] item ::= string | `item( [ `id( string ),] string [ , true | false ] [ , itemList ] ) `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.
| YTree::YTree | ( | const YWidgetOpt & | opt, | |
| YCPString | label | |||
| ) |
Constructor
| opt | the widget options | |
| text | the initial text of the label |
| YTree::~YTree | ( | ) | [virtual] |
Destructor. Frees all tree items.
| virtual char* YTree::widgetClass | ( | ) | [inline, virtual] |
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YWidget.
| void YTree::rebuildTree | ( | ) | [virtual] |
Called once after items have been added.
Overload this to fill the ui specific widget with items.
| YTreeItem * YTree::addItem | ( | YTreeItem * | parentItem, | |
| const YCPValue & | id, | |||
| const YCPString & | text, | |||
| const YCPString & | iconName, | |||
| bool | open | |||
| ) |
Adds an item to the selection box.
| YTreeItem * YTree::addItem | ( | YTreeItem * | parentItem, | |
| const YCPString & | text, | |||
| const YCPString & | iconName, | |||
| void * | data, | |||
| bool | open | |||
| ) |
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.
Implements the ui command queryWidget.
Reimplemented from YWidget.
| void YTree::setLabel | ( | const YCPString & | label | ) | [virtual] |
Change the label text. Overload this, but call YTree::setLabel at the end of your own function.
| YCPString YTree::getLabel | ( | ) |
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.
| const char* YTree::shortcutProperty | ( | ) | [inline, virtual] |
| const char* YTree::userInputProperty | ( | ) | [inline, virtual] |
Parses a given item list and calls addItem(...) to insert entries.
Returns 'true' on succes, 'false' on error.
| bool YTree::hasIcons | ( | ) | const [inline] |
Returns 'true' if any item of this widget has an icon
| YCPValue YTree::currentBranch | ( | ) | const |
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.
| virtual const YTreeItem* YTree::getCurrentItem | ( | ) | const [protected, pure virtual] |
Returns the index of the currently selected item or NULL if no item is selected.
| virtual void YTree::setCurrentItem | ( | YTreeItem * | it | ) | [protected, pure virtual] |
Selects an item.
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.
| YCPList YTree::itemsTermList | ( | YTreeItemList | items | ) | [protected] |
Returns a YCPList of items in the format needed for creating a tree widget.
| void YTree::findOpenItems | ( | YCPMap & | openItems, | |
| YTreeItemList | items | |||
| ) | [protected] |
Recursively fills a map 'openItems' with items that are open.
| void YTree::deleteAllItems | ( | ) | [protected, virtual] |
Cleares the YTreeItemList. This function is calles out of the corresponding YQ classes.
Recursively add items to list 'branchList' from 'item' up to the tree's root
| void YTree::saveUserInput | ( | YMacroRecorder * | macroRecorder | ) | [private, virtual] |
friend class YTreeItem [friend] |
YTreeItemList YTree::items [protected] |
YCPString YTree::label [private] |
bool YTree::_hasIcons [private] |
1.5.0