Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YTree Class Reference

Implementation of the Tree widget. More...

#include <YTree.h>

Inheritance diagram for YTree:

YWidget List of all members.

Public Member Functions

 YTree (const YWidgetOpt &opt, YCPString label)
virtual ~YTree ()
virtual char * widgetClass ()
virtual void rebuildTree ()
YTreeItemaddItem (YTreeItem *parentItem, const YCPValue &id, const YCPString &text, bool open)
YTreeItemaddItem (YTreeItem *parentItem, const YCPString &text, 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 ()

Protected Member Functions

virtual const YTreeItemgetCurrentItem () const=0
virtual void setCurrentItem (YTreeItem *it)=0
YTreeItemfindItemWithId (const YCPValue &id)
YTreeItemfindItemWithText (const YCPString &text)

Protected Attributes

YTreeItemList items

Private Member Functions

virtual void saveUserInput (YMacroRecorder *macroRecorder)

Private Attributes

YCPString label

Detailed Description

Implementation of the Tree widget.

Tree

`Tree( `id( `treeID ), "treeLabel", [ "top1", "top2", "top3" ] ); Tree1.ycp Tree2.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.


Constructor & Destructor Documentation

YTree::YTree const YWidgetOpt opt,
YCPString  label
 

Constructor

Parameters:
opt the widget options
text the initial text of the label

YTree::~YTree  )  [virtual]
 

Destructor. Frees all tree items.


Member Function Documentation

YTreeItem * YTree::addItem YTreeItem parentItem,
const YCPString text,
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.

YTreeItem * YTree::addItem YTreeItem parentItem,
const YCPValue id,
const YCPString text,
bool  open
 

Adds an item to the selection box.

YCPValue YTree::changeWidget const YCPSymbol property,
const YCPValue newvalue
[virtual]
 

Implements the ui command changeWidget.

Reimplemented from YWidget.

YTreeItem * YTree::findItemWithId const YCPValue id  )  [protected]
 

Recursively search for an item with a given ID. Returns 0 if not found.

YTreeItem * YTree::findItemWithText const YCPString text  )  [protected]
 

Recursively search for an item with a given text. Returns 0 if not found.

virtual const YTreeItem* YTree::getCurrentItem  )  const [protected, pure virtual]
 

Returns the index of the currently selected item or -1 if no item is selected.

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.

YCPValue YTree::queryWidget const YCPSymbol property  )  [virtual]
 

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]
 

Selects an item.

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.

virtual char* YTree::widgetClass  )  [inline, virtual]
 

Returns a descriptive name of this widget class for logging, debugging etc.

Reimplemented from YWidget.


Member Data Documentation

YTreeItemList YTree::items [protected]
 

The items.

YCPString YTree::label [private]
 

The current label of the tree


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 18:15:25 2007 for yast2-core by doxygen 1.3.6