#include <YComboBox.h>
Inheritance diagram for YComboBox:
Public Member Functions | |
YComboBox (const YWidgetOpt &opt, YCPString label) | |
bool | editable () const |
virtual char * | widgetClass () |
void | addItem (const YCPValue &id, const YCPString &text, bool selected) |
YCPValue | changeWidget (const YCPSymbol &property, const YCPValue &newvalue) |
YCPValue | queryWidget (const YCPSymbol &property) |
virtual void | setLabel (const YCPString &label) |
YCPString | getLabel () |
virtual void | setValidChars (const YCPString &validChars) |
YCPString | getValidChars () |
const char * | shortcutProperty () |
Protected Member Functions | |
virtual void | itemAdded (const YCPString &string, int index, bool selected) |
virtual YCPString | getValue () const=0 |
virtual void | setValue (const YCPString &new_value)=0 |
virtual int | getCurrentItem () const=0 |
virtual void | setCurrentItem (int index)=0 |
Private Member Functions | |
int | numItems () const |
int | itemWithId (const YCPValue &id, bool report_error) |
virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
Private Attributes | |
YCPString | label |
YCPString | validChars |
YCPList | item_ids |
YCPList | item_labels |
bool | _editable |
ComboBox
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.
Notice: 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 |
|
Adds an item to the selection box. |
|
Implements the ui command changeWidget. string Label The label above the ComboBox describing what it is all about string Value The current value of the ComboBox. If this is a list item which has an ID, the ID will be used rather than the corresponding text. For editable ComboBox widgets it is OK to set any value - even if it doesn't exist in the list. string ValidChars valid input characters Reimplemented from YWidget. |
|
Returns whether or not any value ( not only from the list ) can be entered. |
|
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. |
|
Returns the ComboBox value. |
|
Is called, when an item has been added. Overload this to fill the ui specific widget with items.
|
|
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
|
|
Returns the current number of items |
|
Implements the ui command queryWidget Reimplemented from YWidget. |
|
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. |
|
Selects an item from the list. Notice there intentionally is no corresponding getCurrentItem() method - use getValue() instead. |
|
Change the label text. Overload this, but call YTextEntry::setLabel at the end of your own function. |
|
Change the valid input characters. Overload this, but call YComboBox::setValidChars at the end of your own method. |
|
Sets the ComboBox value to a random value that is not already in the item list. Will be called for editable ComboBox widgets only. |
|
The name of the widget property that holds the keyboard shortcut. Inherited from YWidget. Reimplemented from YWidget. |
|
Returns a descriptive name of this widget class for logging, debugging etc. Reimplemented from YWidget. |
|
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 |
|
Valid input characters |