YSelectionWidget Class Reference

#include <YSelectionWidget.h>

Inheritance diagram for YSelectionWidget:

YWidget YComboBox YMultiSelectionBox YSelectionBox List of all members.

Public Member Functions

 YSelectionWidget (const YWidgetOpt &opt, YCPString label)
virtual char * widgetClass ()
virtual const char * shortcutProperty ()
void parseItemList (const YCPList &itemlist)

Static Public Member Functions

static bool parseItem (const YCPTerm &itemTerm, YCPValue &item_id_ret, YCPString &item_label_ret, YCPString &item_icon_ret, YCPBoolean &item_selected_ret, YCPList &sub_item_list_ret)

Protected Member Functions

virtual void itemAdded (const YCPString &string, int index, bool selected)=0
int itemWithId (const YCPValue &id, bool report_error)
int numItems () const
virtual void setLabel (const YCPString &label)
YCPString getLabel ()
virtual void addItem (const YCPValue &id, const YCPString &text, const YCPString &icon, bool selected)
virtual void deleteAllItems ()
virtual YCPValue changeLabel (const YCPValue &newValue)
virtual YCPValue changeItems (const YCPValue &newValue)
YCPString itemIcon (int item_no) const
bool hasIcons () const

Protected Attributes

YCPString label
YCPList item_ids
YCPList item_labels

Private Attributes

YCPList item_icons
bool _hasIcons

Detailed Description

class for all selection widgets like SelectionBox, Combobox and MultiselectionBox


Constructor & Destructor Documentation

YSelectionWidget::YSelectionWidget const YWidgetOpt opt,
YCPString  label
 

Constructor

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


Member Function Documentation

void YSelectionWidget::addItem const YCPValue id,
const YCPString text,
const YCPString icon,
bool  selected
[protected, virtual]
 

Adds one item

YCPValue YSelectionWidget::changeItems const YCPValue newValue  )  [protected, virtual]
 

Changes the widgets displayed items. Is used in every changeWidget(...) function in derived classes.

YCPValue YSelectionWidget::changeLabel const YCPValue newValue  )  [protected, virtual]
 

Changes the widgets label. Is used in every changeWidget(...) function in derived classes.

void YSelectionWidget::deleteAllItems  )  [protected, virtual]
 

Cleares the two lists item_ids and item_labels. This function is calles out of the corresponding YQ classes.

YCPString YSelectionWidget::getLabel  )  [protected]
 

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 YSelectionWidget::hasIcons  )  const [inline, protected]
 

Returns 'true' if any item of this widget has an icon

virtual void YSelectionWidget::itemAdded const YCPString string,
int  index,
bool  selected
[protected, pure virtual]
 

Called when an item has been added. Overload this to fill the ui specific widget with items.

Parameters:
string text of the new item
index index of the new item.
selected true if the item should be selected.

YCPString YSelectionWidget::itemIcon int  item_no  )  const [protected]
 

Returns the full path name for the icon that corresponds with item number item_no or YCPVoid() if there is none.

int YSelectionWidget::itemWithId const YCPValue id,
bool  report_error
[protected]
 

Searches for an item with a certain id or a certain label. Returns the index of the found item or -1 if none was found

Parameters:
report_error set this to true, if you want me to report an error if non item can be found.

int YSelectionWidget::numItems  )  const [protected]
 

Returns the current number of items

bool YSelectionWidget::parseItem const YCPTerm itemTerm,
YCPValue item_id_ret,
YCPString item_label_ret,
YCPString item_icon_ret,
YCPBoolean item_selected_ret,
YCPList sub_item_list_ret
[static]
 

Parse one `item() term with `id() [optional] `icon() [optional] string label [MANDATORY] bool selected [optional] list subItemList [optional]

Example:

`item( `id(`my_id), `icon( "colorful.png" ), "My Label", true )

The order of those parameters within `item() is arbitrary. The _ret Parameters are are return parameters that will be changed by this function.

If the subItemList is not desired, rejecting it is the caller's responsibility (check if ! .isNull() and issue error).

Returns 'true' on success, 'false' on error.

void YSelectionWidget::parseItemList const YCPList itemlist  ) 
 

Parses a given itemlist and calls addItem(...) to insert entries.

void YSelectionWidget::setLabel const YCPString label  )  [protected, virtual]
 

Change the label text. Overload this, but call YTextEntry::setLabel at the end of your own function.

virtual const char* YSelectionWidget::shortcutProperty  )  [inline, virtual]
 

The name of the widget property that holds the keyboard shortcut. Inherited from YWidget.

Reimplemented from YWidget.

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

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

Reimplemented from YWidget.

Reimplemented in YComboBox, YMultiSelectionBox, and YSelectionBox.


Member Data Documentation

bool YSelectionWidget::_hasIcons [private]
 

YCPList YSelectionWidget::item_icons [private]
 

The curent list of item icons. We make destructive changes to this variable, so make sure only one reference to it exists!

YCPList YSelectionWidget::item_ids [protected]
 

The current list of item ids

YCPList YSelectionWidget::item_labels [protected]
 

The current list of item labels

YCPString YSelectionWidget::label [protected]
 

The current label of the SelectionWidget


The documentation for this class was generated from the following files:
Generated on Fri Jun 16 18:07:47 2006 for yast2-core by  doxygen 1.4.6