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

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 |
| YSelectionWidget::YSelectionWidget | ( | const YWidgetOpt & | opt, | |
| YCPString | label | |||
| ) |
Constructor
| text | the initial text of the SelectionWidget label | |
| opt | the widget options |
| 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.
| virtual const char* YSelectionWidget::shortcutProperty | ( | ) | [inline, virtual] |
| void YSelectionWidget::parseItemList | ( | const YCPList & | itemlist | ) |
Parses a given itemlist and calls addItem(...) to insert entries.
| 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.
| 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.
| string | text of the new item | |
| index | index of the new item. | |
| selected | true if the item should be selected. |
| 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
| 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
| void YSelectionWidget::setLabel | ( | const YCPString & | label | ) | [protected, virtual] |
Change the label text. Overload this, but call YSelectionWidget::setLabel at the end of your own function.
| 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.
| void YSelectionWidget::addItem | ( | const YCPValue & | id, | |
| const YCPString & | text, | |||
| const YCPString & | icon, | |||
| bool | selected | |||
| ) | [protected, virtual] |
Adds one item
| void YSelectionWidget::deleteAllItems | ( | ) | [protected, virtual] |
Cleares the two lists item_ids and item_labels. This function is calles out of the corresponding YQ classes.
Changes the widgets label. Is used in every changeWidget(...) function in derived classes.
Changes the widgets displayed items. Is used in every changeWidget(...) function in derived classes.
| 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.
| bool YSelectionWidget::hasIcons | ( | ) | const [inline, protected] |
Returns 'true' if any item of this widget has an icon
YCPString YSelectionWidget::label [protected] |
The current label of the SelectionWidget
YCPList YSelectionWidget::item_ids [protected] |
The current list of item ids
YCPList YSelectionWidget::item_labels [protected] |
The current list of item labels
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!
bool YSelectionWidget::_hasIcons [private] |
1.5.0