libyui
|
#include <YItemSelector.h>
Scrollable item selector widget with not only a label for each item, but also a (possible multi-line) description and an optional icon.
This widget supports both 1-of-n or n-of-m selection, i.e. it can act as a (more verbose and more screen space consuming) replacement for YSelectionBox or YMultiSelectionBox.
Standard constructor.
Constructor for custom item status values.
This makes it possible to set a wider variety of values than just 0 or
Notice that this constructor is the only way to set custom status value descriptions; they cannot be changed anymore after initializing the widget. This is by design so that any derived widgets in concrete UIs do not have to bother with possibly recreating any subwidgets if this should change; this guarantees that it does not change, neither the fact that there are custom status values nor their number or indicator icons or texts.
This constructor implicitly sets 'enforceSingleSelection' to 'false'.
In this mode, the widget sends YMenuEvents (which include the item that the user changed) if the notify option is set. For anything beyond the simple status transitions that are defined here in 'customStates', it is highly recommended to set that notify option and to handle those YMenuEvents on the application level.
|
virtual |
Destructor.
Activate selected item. Can be used in tests to simulate user input.
Derived classes are required to implement this.
const YItemCustomStatus & YItemSelector::customStatus | ( | int | index | ) |
Return the custom status with the specified index (counting from 0).
Notice that this may throw a std::out_of_range exception if the index is invalid.
int YItemSelector::customStatusCount | ( | ) | const |
Return the number of custom status values or 0 if no custom status values are used.
Cycle through the custom status values according to the custom status table, i.e. return the 'nextStatus' field of table index 'oldStatus'. This may be -1 if no next status was specified there or if 'oldStatus' is out of range of that table.
|
virtual |
|
virtual |
Set the status of an item. Unlike YItem::setStatus(), this informs the widget of the change so it can set the corresponding status icon.
Reimplemented from YSelectionWidget.
Reimplemented from YSelectionWidget.
|
virtual |
Set the number of visible items. When changing this, make sure to recalculate the layout (YDialog::recalc()) so the change has any effect.
Derived classes are free to reimplement this, but they should call this base class method in the overloaded function.
Update the status indicator (status icon or text indicator) if this widget is using custom status values.
Derived classes should overwrite this.
bool YItemSelector::usingCustomStatus | ( | ) | const |
Return 'true' if this widget uses custom status values, 'false' if not (i.e. only 0 or 1).
Return 'true' if a custom status index is within the valid range, i.e. 0..customStatusCount()-1, 'false' otherwise.
int YItemSelector::visibleItems | ( | ) | const |
Return the number of visible items (i.e. items that are visible without scrolling). This is used to calculate the preferred height. If the widget gets more or less screen space than desired due to layout constraints, this number is not updated; this is purely the desired value for initializing layout negotiations.
Return a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YSelectionWidget.