YComboBox Class Reference
Implementation of the ComboBox widget.
More...
#include <YComboBox.h>
Inheritance diagram for YComboBox:
List of all members.
Detailed Description
Implementation of the ComboBox widget.
ComboBox
- string label list items the items contained in the combo box editable the user can enter any value. `ComboBox( `id( `pizza ), "select your Pizza:", [ "Margarita", `item( `id( `na ), "Napoli" ) ] ) ComboBox1.ycp ComboBox2.ycp ComboBox3.ycp ComboBox4.ycp
A combo box is a combination of a selection box and an input field. It gives the user a one-out-of-many choice from a list of items. Each item has a ( mandatory ) label and an ( optional ) id. When the 'editable' option is set, the user can also freely enter any value. By default, the user can only select an item already present in the list.
The items are very much like SelectionBox items: They can have an ( optional ) ID, they have a mandatory text to be displayed and an optional boolean parameter indicating the selected state. Only one of the items may have this parameter set to "true"; this will be the default selection on startup.
- Note:
- You can and should set a keyboard shortcut within the label. When the user presses the hotkey, the combo box will get the keyboard focus.
Constructor & Destructor Documentation
Member Function Documentation
| void YComboBox::addItem |
( |
const YCPValue & |
id, |
|
|
const YCPString & |
text, |
|
|
bool |
selected |
|
) |
|
|
|
|
Adds an item to the selection box. |
|
|
Implements the ui command changeWidget.
Reimplemented from YWidget. |
| bool YComboBox::editable |
( |
|
) |
const [inline] |
|
|
|
Returns whether or not any value ( not only from the list ) can be entered. |
| virtual int YComboBox::getCurrentItem |
( |
|
) |
const [protected, pure virtual] |
|
|
|
Returns the index of the currently selected item (from 0 on) 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. |
|
|
Get the valid input characters. |
| virtual YCPString YComboBox::getValue |
( |
|
) |
const [protected, pure virtual] |
|
|
|
Returns the ComboBox value. |
| void YComboBox::itemAdded |
( |
const YCPString & |
string, |
|
|
int |
index, |
|
|
bool |
selected |
|
) |
[protected, virtual] |
|
|
|
Is 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 YComboBox::itemWithId |
( |
const YCPValue & |
id, |
|
|
bool |
report_error |
|
) |
[private] |
|
|
|
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 YComboBox::numItems |
( |
|
) |
const [private] |
|
|
|
Returns the current number of items |
|
|
Implements the ui command queryWidget
Reimplemented from YWidget. |
| void YComboBox::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 YComboBox::setCurrentItem |
( |
int |
index |
) |
[protected, pure virtual] |
|
| void YComboBox::setLabel |
( |
const YCPString & |
label |
) |
[virtual] |
|
|
|
Change the label text. Overload this, but call YTextEntry::setLabel at the end of your own function. |
| void YComboBox::setValidChars |
( |
const YCPString & |
validChars |
) |
[virtual] |
|
| virtual void YComboBox::setValue |
( |
const YCPString & |
new_value |
) |
[protected, pure virtual] |
|
|
|
Sets the ComboBox value to a random value that is not already in the item list. Will be called for editable ComboBox widgets only. |
| const char* YComboBox::shortcutProperty |
( |
|
) |
[inline, virtual] |
|
|
|
The name of the widget property that holds the keyboard shortcut. Inherited from YWidget.
Reimplemented from YWidget. |
| virtual char* YComboBox::widgetClass |
( |
|
) |
[inline, virtual] |
|
|
|
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YWidget. |
Member Data Documentation
|
|
Any input ( not only from the list ) permitted? |
|
|
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:49 2005 for yast2-core by
1.4.1