YSelectionBox Class Reference
Implementation of the SelectionBox widget.
More...
#include <YSelectionBox.h>
Inheritance diagram for YSelectionBox:
List of all members.
Detailed Description
Implementation of the SelectionBox widget.
SelectionBox
- string label list items the items contained in the selection box shrinkable make the widget very small immediate make `notify trigger immediately when the selected item changes `SelectionBox( `id( `pizza ), "select your Pizza:", [ "Margarita", `item( `id( `na ), "Napoli" ) ] ) SelectionBox1.ycp SelectionBox2.ycp SelectionBox3.ycp SelectionBox4.ycp
A selection box offers the user to select an item out of a list. Each item has a label and an optional id. When constructing the list of items, you have two way of specifying an item. Either you give a plain string, in which case the string is used both for the id and the label of the item. Or you specify a term `item( term id, string label ) or `item( term id, string label, boolean selected ), where you give an id of the form `id( any v ) where you can store an aribtrary value as id. The third argument controls whether the item is the selected item.
Constructor & Destructor Documentation
|
|
Constructor - Parameters:
-
| text | the initial text of the SelectionBox label |
| opt | the widget options |
|
Member Function Documentation
| void YSelectionBox::addItem |
( |
const YCPValue & |
id, |
|
|
const YCPString & |
text, |
|
|
bool |
selected |
|
) |
|
|
|
|
Adds an item to the selection box. |
|
|
Implements the ui command changeWidget.
Reimplemented from YWidget. |
| virtual int YSelectionBox::getCurrentItem |
( |
|
) |
[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. |
| void YSelectionBox::itemAdded |
( |
const YCPString & |
string, |
|
|
int |
index, |
|
|
bool |
selected |
|
) |
[protected, 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. |
|
| int YSelectionBox::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 YSelectionBox::numItems |
( |
|
) |
const [protected] |
|
|
|
Returns the current number of items |
|
|
Implements the ui command queryWidget
Reimplemented from YWidget. |
| void YSelectionBox::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 YSelectionBox::setCurrentItem |
( |
int |
index |
) |
[protected, pure virtual] |
|
|
|
Selects an item from the list. |
| void YSelectionBox::setLabel |
( |
const YCPString & |
label |
) |
[virtual] |
|
|
|
Change the label text. Overload this, but call YTextEntry::setLabel at the end of your own function. |
| const char* YSelectionBox::shortcutProperty |
( |
|
) |
[inline, virtual] |
|
|
|
The name of the widget property that holds the keyboard shortcut. Inherited from YWidget.
Reimplemented from YWidget. |
| virtual char* YSelectionBox::widgetClass |
( |
|
) |
[inline, virtual] |
|
|
|
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YWidget. |
Member Data Documentation
|
|
The current list of item ids. We make destructive changes to this variable, so make sure only one reference to it exists! |
|
|
The current list of item labels. We make destructive changes to this variable, so make sure only one reference to it exists! |
|
|
The current label of the selectionbox |
The documentation for this class was generated from the following files:
Generated on Tue Mar 22 11:35:50 2005 for yast2-core by
1.4.1