libyui
3.0.10
|
#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 * | firstItem () const |
virtual YItem * | selectedItem () |
virtual YItemCollection | selectedItems () |
bool | hasSelectedItem () |
virtual void | selectItem (YItem *item, bool selected=true) |
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 |
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 |
YWidgetListConstIterator | childrenBegin () const |
YWidgetListConstIterator | childrenEnd () const |
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) |
virtual void | startMultipleChanges () |
virtual void | doneMultipleChanges () |
Protected Member Functions | |
YSelectionWidget (YWidget *parent, const std::string &label, bool enforceSingleSelection, bool recurisveSelection=false) | |
void | setEnforceSingleSelection (bool on) |
bool | enforceSingleSelection () const |
bool | recursiveSelection () const |
YItem * | findSelectedItem (YItemConstIterator begin, YItemConstIterator end) |
void | findSelectedItems (YItemCollection &selectedItems, YItemConstIterator begin, YItemConstIterator end) |
void | deselectAllItems (YItemIterator begin, YItemIterator end) |
YItem * | findItem (const std::string &wantedItemLabel, YItemConstIterator begin, YItemConstIterator end) const |
bool | itemsContain (YItem *wantedItem, YItemConstIterator begin, YItemConstIterator end) const |
YItem * | itemAt (int index) const |
![]() | |
YWidget (YWidget *parent) | |
YWidgetChildrenManager * | childrenManager () const |
void | setChildrenManager (YWidgetChildrenManager *manager) |
void | setBeingDestroyed () |
void | dumpWidget (YWidget *w, int indentationLevel) |
Base class for selection widgets:
Definition at line 42 of file YSelectionWidget.h.
|
protected |
Constructor.
'singleSelectionMode' 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.
Definition at line 55 of file YSelectionWidget.cc.
|
virtual |
Destructor.
Definition at line 70 of file YSelectionWidget.cc.
|
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, YMenuButton, and YDumbTab.
Definition at line 168 of file YSelectionWidget.cc.
void YSelectionWidget::addItem | ( | const std::string & | itemLabel, |
bool | selected = false |
||
) |
Overloaded for convenience: Add an item by string.
Definition at line 235 of file YSelectionWidget.cc.
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.
Definition at line 225 of file YSelectionWidget.cc.
|
virtual |
Add multiple items. For some UIs, this can be more efficient than calling addItem() multiple times.
Reimplemented in YTree, YContextMenu, and YMenuButton.
Definition at line 241 of file YSelectionWidget.cc.
|
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 YMenuButton.
Definition at line 76 of file YSelectionWidget.cc.
|
virtual |
Deselect all items.
Derived classes can overwrite this function, but they should call this base class function in the new implementation.
Definition at line 454 of file YSelectionWidget.cc.
|
protected |
Recursively deselect all items between iterators 'begin' and 'end'.
Definition at line 460 of file YSelectionWidget.cc.
|
protected |
Return 'true' if this base class should enforce single selection.
Definition at line 107 of file YSelectionWidget.cc.
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.
Definition at line 476 of file YSelectionWidget.cc.
|
protected |
Recursively try to find an item with label 'wantedItemLabel' between iterators 'begin' and 'end'. Return that item or 0 if there is none.
Definition at line 483 of file YSelectionWidget.cc.
|
protected |
Recursively try to find the first selected item between iterators 'begin' and 'end'. Return that item or 0 if there is none.
Definition at line 326 of file YSelectionWidget.cc.
|
protected |
Recursively find all selected items between iterators 'begin' and 'end' and add each of them to the 'selectedItems' YItemCollection.
Definition at line 363 of file YSelectionWidget.cc.
YItem * YSelectionWidget::firstItem | ( | ) | const |
Return the first item or 0 if there is none.
Definition at line 299 of file YSelectionWidget.cc.
bool YSelectionWidget::hasItems | ( | ) | const |
Return 'true' if this widget has any items.
Definition at line 286 of file YSelectionWidget.cc.
bool YSelectionWidget::hasSelectedItem | ( | ) |
Return 'true' if any item is selected.
Definition at line 384 of file YSelectionWidget.cc.
std::string YSelectionWidget::iconBasePath | ( | ) | const |
Return this widget's base path where to look up icons as set with setIconBasePath().
Definition at line 131 of file YSelectionWidget.cc.
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.
Definition at line 137 of file YSelectionWidget.cc.
std::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.
Definition at line 159 of file YSelectionWidget.cc.
|
protected |
Return the item at index 'index' (from 0) or 0 if there is no such item.
Definition at line 309 of file YSelectionWidget.cc.
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.
Definition at line 260 of file YSelectionWidget.cc.
bool YSelectionWidget::itemsContain | ( | YItem * | item | ) | const |
Return 'true' if this widget's items contain the specified item.
Definition at line 420 of file YSelectionWidget.cc.
|
protected |
Recursively check if 'wantedItem' is between iterators 'begin' and 'end'.
Definition at line 428 of file YSelectionWidget.cc.
int YSelectionWidget::itemsCount | ( | ) | const |
Return the number of items.
For YSelectionWidgets that can have tree structures, this returns the number of toplevel items.
Definition at line 292 of file YSelectionWidget.cc.
YItemIterator YSelectionWidget::itemsEnd | ( | ) |
Return an iterator that points behind the last item.
Definition at line 273 of file YSelectionWidget.cc.
std::string YSelectionWidget::label | ( | ) | const |
Return this widget's label (the caption above the item list).
Definition at line 95 of file YSelectionWidget.cc.
|
protected |
Return 'true' if this base class should select children recursively.
Definition at line 112 of file YSelectionWidget.cc.
|
virtual |
Return the (first) selected item or 0 if none is selected.
Reimplemented in YComboBox.
Definition at line 319 of file YSelectionWidget.cc.
|
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.
Definition at line 353 of file YSelectionWidget.cc.
|
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.
Definition at line 390 of file YSelectionWidget.cc.
|
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.
Definition at line 119 of file YSelectionWidget.cc.
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.
Definition at line 125 of file YSelectionWidget.cc.
|
inline |
Delete all items and add new items.
Definition at line 127 of file YSelectionWidget.h.
|
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.
Definition at line 101 of file YSelectionWidget.cc.
|
inlinevirtual |
Set the string of this widget that holds the keyboard shortcut.
Reimplemented from YWidget.
Reimplemented from YWidget.
Reimplemented in YDumbTab.
Definition at line 268 of file YSelectionWidget.h.
|
inlinevirtual |
Get the string of this widget that holds the keyboard shortcut.
Reimplemented from YWidget.
Reimplemented from YWidget.
Reimplemented in YDumbTab.
Definition at line 261 of file YSelectionWidget.h.
|
inlinevirtual |
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YWidget.
Reimplemented in YTable, YSelectionBox, YComboBox, YTree, YContextMenu, YMenuButton, YDumbTab, and YMultiSelectionBox.
Definition at line 69 of file YSelectionWidget.h.