#include <YSelectionWidget.h>
Public Member Functions | |
virtual | ~YSelectionWidget () |
virtual const char * | widgetClass () const |
std::string | label () const |
virtual void | setLabel (const std::string &newLabel) |
virtual void | addItem (YItem *item_disown) |
void | addItem (const std::string &itemLabel, bool selected=false) |
void | addItem (const std::string &itemLabel, const std::string &iconName, bool selected=false) |
virtual void | addItems (const YItemCollection &itemCollection) |
virtual void | deleteAllItems () |
void | setItems (const YItemCollection &itemCollection) |
YItemIterator | itemsBegin () |
YItemConstIterator | itemsBegin () const |
YItemIterator | itemsEnd () |
YItemConstIterator | itemsEnd () const |
bool | hasItems () const |
int | itemsCount () const |
YItem * | itemAt (int index) const |
YItem * | firstItem () const |
virtual YItem * | selectedItem () |
virtual YItemCollection | selectedItems () |
bool | hasSelectedItem () |
virtual void | selectItem (YItem *item, bool selected=true) |
virtual void | setItemStatus (YItem *item, int status) |
virtual void | deselectAllItems () |
void | setIconBasePath (const std::string &basePath) |
std::string | iconBasePath () const |
std::string | iconFullPath (const std::string &iconName) const |
std::string | iconFullPath (YItem *item) const |
bool | itemsContain (YItem *item) const |
YItem * | findItem (const std::string &itemLabel) const |
void | dumpItems () const |
bool | enforceSingleSelection () const |
virtual void | shortcutChanged () |
virtual std::string | shortcutString () const |
virtual void | setShortcutString (const std::string &str) |
![]() | |
virtual | ~YWidget () |
virtual std::string | debugLabel () const |
std::string | helpText () const |
void | setHelpText (const std::string &helpText) |
virtual const YPropertySet & | propertySet () |
virtual bool | setProperty (const std::string &propertyName, const YPropertyValue &val) |
virtual YPropertyValue | getProperty (const std::string &propertyName) |
bool | hasChildren () const |
YWidget * | firstChild () const |
YWidget * | lastChild () const |
YWidgetListIterator | childrenBegin () const |
YWidgetListIterator | childrenEnd () const |
YWidgetListConstIterator | childrenConstBegin () const |
YWidgetListConstIterator | childrenConstEnd () const |
YWidgetListIterator | begin () |
YWidgetListIterator | end () |
int | childrenCount () const |
bool | contains (YWidget *child) const |
virtual void | addChild (YWidget *child) |
virtual void | removeChild (YWidget *child) |
void | deleteChildren () |
YWidget * | parent () const |
bool | hasParent () const |
void | setParent (YWidget *newParent) |
YDialog * | findDialog () |
YWidget * | findWidget (YWidgetID *id, bool doThrow=true) const |
virtual int | preferredWidth ()=0 |
virtual int | preferredHeight ()=0 |
virtual int | preferredSize (YUIDimension dim) |
virtual void | setSize (int newWidth, int newHeight)=0 |
bool | isValid () const |
bool | beingDestroyed () const |
void * | widgetRep () const |
void | setWidgetRep (void *toolkitWidgetRep) |
bool | hasId () const |
YWidgetID * | id () const |
void | setId (YWidgetID *newId_disown) |
virtual void | setEnabled (bool enabled=true) |
void | setDisabled () |
virtual bool | isEnabled () const |
virtual bool | stretchable (YUIDimension dim) const |
void | setStretchable (YUIDimension dim, bool newStretch) |
void | setDefaultStretchable (YUIDimension dim, bool newStretch) |
virtual int | weight (YUIDimension dim) |
bool | hasWeight (YUIDimension dim) |
void | setWeight (YUIDimension dim, int weight) |
void | setNotify (bool notify=true) |
bool | notify () const |
void | setNotifyContextMenu (bool notifyContextMenu=true) |
bool | notifyContextMenu () const |
bool | sendKeyEvents () const |
void | setSendKeyEvents (bool doSend) |
bool | autoShortcut () const |
void | setAutoShortcut (bool _newAutoShortcut) |
int | functionKey () const |
bool | hasFunctionKey () const |
virtual void | setFunctionKey (int fkey_no) |
virtual bool | setKeyboardFocus () |
virtual const char * | userInputProperty () |
void | dumpWidgetTree (int indentationLevel=0) |
void | dumpDialogWidgetTree () |
void | setChildrenEnabled (bool enabled) |
virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
void * | operator new (size_t size) |
void | operator delete (void *ptr) noexcept |
virtual void | startMultipleChanges () |
virtual void | doneMultipleChanges () |
Base class for various kinds of multi-value widgets.
See also https://github.com/libyui/libyui-ncurses/blob/master/doc/nctable-and-nctree.md
|
protected |
Constructor.
'enforceSingleSelection' indicates if this base class should enforce single selection when items are added or when items are selected from the application. Note that single selection can also mean that no item is selected.
|
virtual |
Destructor.
void YSelectionWidget::addItem | ( | const std::string & | itemLabel, |
bool | selected = false ) |
Overloaded for convenience: Add an item by string.
void YSelectionWidget::addItem | ( | const std::string & | itemLabel, |
const std::string & | iconName, | ||
bool | selected = false ) |
Overloaded for convenience: Add an item with a text and an icon. Note that not all UIs can display icons.
|
virtual |
Add one item. This widget assumes ownership of the item object and will delete it in its destructor.
NOTE: For tree items, call this only for the toplevel items; all non-toplevel items are already owned by their respective parent items. Adding them to the parent widget will clash with this ownership.
Derived classes can overwrite this function, but they should call this base class function in the new implementation.
Reimplemented in YContextMenu, YDumbTab, YMenuButton, and YMenuWidget.
|
virtual |
Add multiple items. For some UIs, this can be more efficient than calling addItem() multiple times.
Reimplemented in YContextMenu, YMenuWidget, and YTree.
|
virtual |
Delete all items.
Derived classes can overwrite this function, but they should call this base class function in the new implementation.
Reimplemented in YContextMenu, and YMenuWidget.
|
virtual |
Deselect all items.
Derived classes can overwrite this function, but they should call this base class function in the new implementation.
|
protected |
Recursively deselect all items between iterators 'begin' and 'end'.
void YSelectionWidget::dumpItems | ( | ) | const |
Dump all items and their selection state to the log.
|
protected |
Return 'true' if this class enforces an initial selection.
bool YSelectionWidget::enforceSingleSelection | ( | ) | const |
Return 'true' if this base class should enforce single selection.
YItem * YSelectionWidget::findItem | ( | const std::string & | itemLabel | ) | const |
Find the (first) item with the specified label. Return 0 if there is no item with that label.
|
protected |
Recursively try to find an item with label 'wantedItemLabel' between iterators 'begin' and 'end'. Return that item or 0 if there is none.
|
protected |
Recursively try to find the first selected item between iterators 'begin' and 'end'. Return that item or 0 if there is none.
|
protected |
Recursively find all selected items between iterators 'begin' and 'end' and add each of them to the 'selectedItems' YItemCollection.
YItem * YSelectionWidget::firstItem | ( | ) | const |
Return the first item or 0 if there is none.
bool YSelectionWidget::hasItems | ( | ) | const |
Return 'true' if this widget has any items.
bool YSelectionWidget::hasSelectedItem | ( | ) |
Return 'true' if any item is selected.
string YSelectionWidget::iconBasePath | ( | ) | const |
Return this widget's base path where to look up icons as set with setIconBasePath().
std::string YSelectionWidget::iconFullPath | ( | const std::string & | iconName | ) | const |
Return the full path + file name for the specified icon name. If iconBasePath is non-empty, it is prepended to the icon name. Otherwise, YUI::yApp()->iconLoader() and its icon search paths is used find the icon in one of them
If 'iconName' is empty, this will return an empty string.
string YSelectionWidget::iconFullPath | ( | YItem * | item | ) | const |
Return the full path + file name for the icon of the specified item. If iconBasePath is non-empty, it is prepended to the item's iconName. Otherwise, YUI::yApp()->iconLoader() and its icon search paths is used find the icon in one of them
If 'item' does not have an iconName specified, this will return an empty string.
YItem * YSelectionWidget::itemAt | ( | int | index | ) | const |
Return the item at index 'index' (from 0) or 0 if there is no such item.
YItemIterator YSelectionWidget::itemsBegin | ( | ) |
Return an iterator that points to the first item.
For YSelectionWidgets that can have tree structures, this iterator will iterate over the toplevel items.
Important: Don't use this iterator to iterate over all items and check their "selected" state; that information might not always be up to date. Use the dedicated functions for that.
bool YSelectionWidget::itemsContain | ( | YItem * | item | ) | const |
Return 'true' if this widget's items contain the specified item.
|
protected |
Recursively check if 'wantedItem' is between iterators 'begin' and 'end'.
int YSelectionWidget::itemsCount | ( | ) | const |
Return the number of items.
For YSelectionWidgets that can have tree structures, this returns the number of toplevel items.
YItemIterator YSelectionWidget::itemsEnd | ( | ) |
Return an iterator that points behind the last item.
string YSelectionWidget::label | ( | ) | const |
Return this widget's label (the caption above the item list).
|
protected |
Return 'true' if this base class should select children recursively.
|
virtual |
Return the (first) selected item or 0 if none is selected.
Reimplemented in YComboBox.
|
virtual |
Return all selected items. This is mostly useful for derived classes that allow selecting multiple items.
This function does not transfer ownership of those items to the caller, so don't try to delete them!
Reimplemented in YComboBox.
|
virtual |
Select or deselect an item.
Notice that this is different from YItem::setSelected() because unlike the latter function, this function informs the parent widget of the selection change.
If only one item can be selected at any time (single selection), the derived class will make sure to deselect any previous selection, if applicable.
Derived classes should overwrite this function, but they should call this base class function at the new function's start (this will also check if the item really belongs to this widget and throw an exception if not).
Reimplemented in YComboBox.
|
protected |
In single selection mode, enforce selecting an initial item ('true' by default). This is ignored in multi selection mode.
|
protected |
Set single selection mode on or off. In single selection mode, only one item can be selected at any time.
If set, this base class enforces this when items are added or when items are selected from the application. Note that single selection can also mean that no item is selected.
void YSelectionWidget::setIconBasePath | ( | const std::string & | basePath | ) |
Set this widget's base path where to look up icons. If this is a relative path, YUI::qApp()->iconBasePath() is prepended.
|
inline |
Delete all items and add new items.
|
virtual |
Set the status of an item.
This is similar to selectItem(), but with numeric values.
This default implementation just calls selectItem() with 'status' converted to boolean. Derived classes can choose to make more detailed use of the numeric value.
Reimplemented in YItemSelector.
|
virtual |
Change this widget's label (the caption above the item list).
Derived classes should overwrite this function, but they should call this base class function in the new implementation.
|
virtual |
Set the string of this widget that holds the keyboard shortcut.
Also trigger a shortcutChanged() notification. This is useful for derived sub-classes to refresh the widget when any shortcut of any item was changed by the shortcut conflict manager.
Check YItemShortcut in YShortcut.{cc,h} for more details.
Reimplemented from YWidget.
Reimplemented from YWidget.
|
inlinevirtual |
Notification that any shortcut of any item was changed by the shortcut conflict manager YShortcutManager.
Derived classes should reimplement this.
|
inlinevirtual |
Get the string of this widget that holds the keyboard shortcut.
Notice that some sub-classes (e.g., YDumbTab, YItemSelection, YMenuBar) has one shortcut for each item. This value is not meaningful for such widget classes.
Check YItemShortcut in YShortcut.{cc,h} for more details.
Reimplemented from YWidget.
Reimplemented from YWidget.
|
inlinevirtual |
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YWidget.
Reimplemented in YComboBox, YContextMenu, YDumbTab, YItemSelector, YMenuBar, YMenuButton, YMenuWidget, YMultiSelectionBox, YSelectionBox, YTable, and YTree.