libyui
3.3.1
|
Table: Selection list with multiple columns. More...
#include <YTable.h>
Public Member Functions | |
virtual | ~YTable () |
Destructor. | |
virtual const char * | widgetClass () const |
Return a descriptive name of this widget class for logging, debugging etc. | |
int | columns () const |
Return the number of columns of this table. | |
bool | hasColumn (int column) const |
Return 'true' if this table has a column no. More... | |
std::string | header (int column) const |
Return the header text for the specified column. | |
YAlignmentType | alignment (int column) const |
Return the alignment for the specified column. | |
bool | immediateMode () const |
Deliver even more events than with notify() set. More... | |
void | setImmediateMode (bool immediateMode=true) |
Set immediateMode() on or off. | |
bool | keepSorting () const |
Return 'true' if the sort order is to be kept in item insertion order, i.e. More... | |
virtual void | setKeepSorting (bool keepSorting) |
Switch between sorting by item insertion order (keepSorting: true) or allowing the user to sort by an arbitrary column (by clicking on the column header). More... | |
bool | hasMultiSelection () const |
Return 'true' if the user can select multiple items at the same time (e.g., with shift-click or ctrl-click). | |
virtual void | cellChanged (const YTableCell *cell)=0 |
Notification that a cell (its text and/or its icon) was changed from the outside. More... | |
virtual bool | setProperty (const std::string &propertyName, const YPropertyValue &val) |
Set a property. More... | |
virtual YPropertyValue | getProperty (const std::string &propertyName) |
Get a property. More... | |
virtual const YPropertySet & | propertySet () |
Return this class's property set. More... | |
const char * | userInputProperty () |
The name of the widget property that will return user input. More... | |
![]() | |
virtual | ~YSelectionWidget () |
Destructor. | |
std::string | label () const |
Return this widget's label (the caption above the item list). | |
virtual void | setLabel (const std::string &newLabel) |
Change this widget's label (the caption above the item list). More... | |
virtual void | addItem (YItem *item_disown) |
Add one item. More... | |
void | addItem (const std::string &itemLabel, bool selected=false) |
Overloaded for convenience: Add an item by string. | |
void | addItem (const std::string &itemLabel, const std::string &iconName, bool selected=false) |
Overloaded for convenience: Add an item with a text and an icon. More... | |
virtual void | addItems (const YItemCollection &itemCollection) |
Add multiple items. More... | |
virtual void | deleteAllItems () |
Delete all items. More... | |
void | setItems (const YItemCollection &itemCollection) |
Delete all items and add new items. | |
YItemIterator | itemsBegin () |
Return an iterator that points to the first item. More... | |
YItemConstIterator | itemsBegin () const |
YItemIterator | itemsEnd () |
Return an iterator that points behind the last item. | |
YItemConstIterator | itemsEnd () const |
bool | hasItems () const |
Return 'true' if this widget has any items. | |
int | itemsCount () const |
Return the number of items. More... | |
YItem * | firstItem () const |
Return the first item or 0 if there is none. | |
virtual YItem * | selectedItem () |
Return the (first) selected item or 0 if none is selected. | |
virtual YItemCollection | selectedItems () |
Return all selected items. More... | |
bool | hasSelectedItem () |
Return 'true' if any item is selected. | |
virtual void | selectItem (YItem *item, bool selected=true) |
Select or deselect an item. More... | |
virtual void | deselectAllItems () |
Deselect all items. More... | |
void | setIconBasePath (const std::string &basePath) |
Set this widget's base path where to look up icons. More... | |
std::string | iconBasePath () const |
Return this widget's base path where to look up icons as set with setIconBasePath(). | |
std::string | iconFullPath (const std::string &iconName) const |
Return the full path + file name for the specified icon name. More... | |
std::string | iconFullPath (YItem *item) const |
Return the full path + file name for the icon of the specified item. More... | |
bool | itemsContain (YItem *item) const |
Return 'true' if this widget's items contain the specified item. | |
YItem * | findItem (const std::string &itemLabel) const |
Find the (first) item with the specified label. More... | |
virtual std::string | shortcutString () const |
Get the string of this widget that holds the keyboard shortcut. More... | |
virtual void | setShortcutString (const std::string &str) |
Set the string of this widget that holds the keyboard shortcut. More... | |
![]() | |
virtual | ~YWidget () |
Destructor. | |
virtual std::string | debugLabel () const |
Returns a descriptive label of this widget instance. More... | |
std::string | helpText () const |
Return the help text for this widget. | |
void | setHelpText (const std::string &helpText) |
Set a help text for this widget. More... | |
bool | hasChildren () const |
Returns 'true' if this widget has any children. | |
YWidget * | firstChild () const |
Returns the first child or 0 if there is none. More... | |
YWidget * | lastChild () const |
Returns the last child or 0 if there is none. | |
YWidgetListIterator | childrenBegin () const |
Return an iterator that points to the first child or to childrenEnd() if there are no children. | |
YWidgetListIterator | childrenEnd () const |
Return an interator that points after the last child. | |
YWidgetListConstIterator | childrenConstBegin () const |
Return a const iterator that points to the first child or to childrenEnd() if there are no children. | |
YWidgetListConstIterator | childrenConstEnd () const |
Return a const interator that points after the last child. | |
YWidgetListIterator | begin () |
A helper for the range-based "for" loop. More... | |
YWidgetListIterator | end () |
A helper for the range-based "for" loop. More... | |
int | childrenCount () const |
Returns the current number of children. | |
bool | contains (YWidget *child) const |
Checks if 'child' is a (direct!) child of this widget. | |
virtual void | addChild (YWidget *child) |
Add a new child. More... | |
virtual void | removeChild (YWidget *child) |
Remove a child. More... | |
void | deleteChildren () |
Delete all children and remove them from the children manager's list. | |
YWidget * | parent () const |
Return this widget's parent or 0 if it doesn't have a parent. | |
bool | hasParent () const |
Return 'true' if this widget has a parent, 'false' if not. | |
void | setParent (YWidget *newParent) |
Set this widget's parent. | |
YDialog * | findDialog () |
Traverse up the widget hierarchy and find the dialog this widget belongs to. More... | |
YWidget * | findWidget (YWidgetID *id, bool doThrow=true) const |
Recursively find a widget by its ID. More... | |
virtual int | preferredWidth ()=0 |
Preferred width of the widget. More... | |
virtual int | preferredHeight ()=0 |
Preferred height of the widget. More... | |
virtual int | preferredSize (YUIDimension dim) |
Preferred size of the widget in the specified dimension. More... | |
virtual void | setSize (int newWidth, int newHeight)=0 |
Set the new size of the widget. More... | |
bool | isValid () const |
Checks whether or not this object is valid. More... | |
bool | beingDestroyed () const |
Check if this widget is in the process of being destroyed. | |
void * | widgetRep () const |
Return a pointer to the underlying toolkit's (Qt, ...) widget representing this abstract UI widget. | |
void | setWidgetRep (void *toolkitWidgetRep) |
Set the pointer to the underlying toolkit's (Qt, ...) widget representing this abstract UI widget. More... | |
bool | hasId () const |
Returns 'true' if this widget has an ID. | |
YWidgetID * | id () const |
Returns this widget's ID. | |
void | setId (YWidgetID *newId_disown) |
Set this widget's ID. More... | |
virtual void | setEnabled (bool enabled=true) |
Enable or disable this widget, i.e. More... | |
void | setDisabled () |
Disable this widget (overloaded for better readability). | |
virtual bool | isEnabled () const |
Returns 'true' if this widget is enabled. | |
virtual bool | stretchable (YUIDimension dim) const |
This is a boolean value that determines whether the widget is resizable beyond its preferred size in the specified dimension. More... | |
void | setStretchable (YUIDimension dim, bool newStretch) |
Set the stretchable state to "newStretch" regardless of any hstretch or vstretch options. | |
void | setDefaultStretchable (YUIDimension dim, bool newStretch) |
Set the stretchable state to "newStretch". More... | |
virtual int | weight (YUIDimension dim) |
The weight is used in situations where all widgets can get their preferred size and yet space is available. More... | |
bool | hasWeight (YUIDimension dim) |
Return whether or not the widget has a weight in the specified dimension. | |
void | setWeight (YUIDimension dim, int weight) |
Set a weight in the specified dimension. | |
void | setNotify (bool notify=true) |
Sets the Notify property. | |
bool | notify () const |
Returns whether the widget will notify, i.e. More... | |
void | setNotifyContextMenu (bool notifyContextMenu=true) |
Sets the notifyContextMenu property. | |
bool | notifyContextMenu () const |
Returns whether the widget will send an event when the user clicks selects the context menu e.g. More... | |
bool | sendKeyEvents () const |
Returns 'true' if this widget should send key events, i.e. More... | |
void | setSendKeyEvents (bool doSend) |
Specify whether or not this widget should send key events. | |
bool | autoShortcut () const |
Returns 'true' if a keyboard shortcut should automatically be assigned to this widget - without complaints in the log file. | |
void | setAutoShortcut (bool _newAutoShortcut) |
Sets the 'autoShortcut' flag. | |
int | functionKey () const |
Return a function key number that is assigned to this widget. More... | |
bool | hasFunctionKey () const |
Check if a function key is assigned to this widget. | |
virtual void | setFunctionKey (int fkey_no) |
Assign a function key to this widget (1 for F1, 2 for F2, etc. More... | |
virtual bool | setKeyboardFocus () |
Set the keyboard focus to this widget. More... | |
void | dumpWidgetTree (int indentationLevel=0) |
Debugging function: Dump the widget tree from here on to the log file. | |
void | dumpDialogWidgetTree () |
Debugging function: Dump the widget tree from this widget's dialog parent. More... | |
void | setChildrenEnabled (bool enabled) |
Enable or disable all widgets in this widget tree. | |
virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
Recursively save the user input of all child widgets to a macro recorder: More... | |
void * | operator new (size_t size) |
Overloaded operator new to ensure widgets are always created on the heap, never on the stack. More... | |
virtual void | startMultipleChanges () |
In some UIs updating the screen content is an expensive operation. More... | |
virtual void | doneMultipleChanges () |
Protected Member Functions | |
YTable (YWidget *parent, YTableHeader *header, bool multiSelection) | |
Constructor. More... | |
void | setTableHeader (YTableHeader *newHeader) |
Exchange the previous table header with a new one. More... | |
![]() | |
YSelectionWidget (YWidget *parent, const std::string &label, bool enforceSingleSelection, bool recurisveSelection=false) | |
Constructor. More... | |
void | setEnforceSingleSelection (bool on) |
Set single selection mode on or off. More... | |
bool | enforceSingleSelection () const |
Return 'true' if this base class should enforce single selection. | |
bool | recursiveSelection () const |
Return 'true' if this base class should select children recursively. | |
YItem * | findSelectedItem (YItemConstIterator begin, YItemConstIterator end) |
Recursively try to find the first selected item between iterators 'begin' and 'end'. More... | |
void | findSelectedItems (YItemCollection &selectedItems, YItemConstIterator begin, YItemConstIterator end) |
Recursively find all selected items between iterators 'begin' and 'end' and add each of them to the 'selectedItems' YItemCollection. | |
void | deselectAllItems (YItemIterator begin, YItemIterator end) |
Recursively deselect all items between iterators 'begin' and 'end'. | |
YItem * | findItem (const std::string &wantedItemLabel, YItemConstIterator begin, YItemConstIterator end) const |
Recursively try to find an item with label 'wantedItemLabel' between iterators 'begin' and 'end'. More... | |
bool | itemsContain (YItem *wantedItem, YItemConstIterator begin, YItemConstIterator end) const |
Recursively check if 'wantedItem' is between iterators 'begin' and 'end'. | |
YItem * | itemAt (int index) const |
Return the item at index 'index' (from 0) or 0 if there is no such item. | |
![]() | |
YWidget (YWidget *parent) | |
Constructor. | |
YWidgetChildrenManager * | childrenManager () const |
Returns this widget's children manager. | |
void | setChildrenManager (YWidgetChildrenManager *manager) |
Sets a new children manager for this widget. More... | |
void | setBeingDestroyed () |
Set the "being destroyed" flag, i.e. More... | |
void | dumpWidget (YWidget *w, int indentationLevel) |
Helper function for dumpWidgetTree(): Dump one widget to the log file. | |
Table: Selection list with multiple columns.
The user can select exactly one row (with all its columns) from that list. Each cell (each column within each row) has a label text and an optional icon (*).
This widget is similar to SelectionBox, but it has several columns for each item (each row). If just one column is desired, consider using SelectionBox instead.
Note: This is not something like a spread sheet, and it doesn't pretend or want to be. Actions are performed on rows, not on individual cells (columns within one row).
(*) Not all UIs (in particular not text-based UIs) support displaying icons, so an icon should never be an exclusive means to display any kind of information.
|
protected |
Constructor.
'header' describes the table's headers: Number of columns, column headings, and column alignment. The widget assumes ownership of this object and will delete it when appropriate. The header cannot be changed after creating the widget.
'multiSelection' indicates whether or not the user can select multiple items at the same time (e.g., with shift-click or ctrl-click). This can only be set in the constructor.
Definition at line 50 of file YTable.cc.
|
pure virtual |
Notification that a cell (its text and/or its icon) was changed from the outside.
Applications are required to call this whenever a table cell is changed after adding the corresponding table item (the row) to the table widget.
Derived classes are required to implement this and update the display accordingly.
Note that the position of this cell can be retrieved with cell->column() and cell->itemIndex().
|
virtual |
bool YTable::hasColumn | ( | int | column | ) | const |
bool YTable::immediateMode | ( | ) | const |
Deliver even more events than with notify() set.
With "notify" alone, a table widget sends an ActivatedEvent when the user double-clicks an item or presses the "space" key on it. It does not send an event when the user just sends another item.
With "immediate", it also sends a SelectionChangedEvent when the user selects another item. "immediate" implicitly includes "notify".
bool YTable::keepSorting | ( | ) | const |
|
virtual |
|
virtual |
Switch between sorting by item insertion order (keepSorting: true) or allowing the user to sort by an arbitrary column (by clicking on the column header).
Derived classes can overwrite this function, but they should call this base class function in the new implementation.
Definition at line 137 of file YTable.cc.
|
virtual |
Set a property.
Reimplemented from YWidget.
This function may throw YUIPropertyExceptions.
This function returns 'true' if the value was successfully set and 'false' if that value requires special handling (not in error cases: those are covered by exceptions).
Reimplemented from YWidget.
Definition at line 186 of file YTable.cc.
|
protected |
Exchange the previous table header with a new one.
This will delete the old YTableHeader object.
If the new header has a different number of columns than the old one, all items will implicitly be deleted.
Definition at line 72 of file YTable.cc.
|
inlinevirtual |