#include <YTable.h>
Inheritance diagram for YTable:

Public Member Functions | |
| YTable (const YWidgetOpt &opt, int num_cols) | |
| virtual char * | widgetClass () |
| bool | addItem (const YCPValue &item) |
| virtual bool | addItems (const YCPList &itemlist) |
| void | addItem (const YCPValue &id, vector< string > elements) |
| YCPValue | changeWidget (const YCPSymbol &property, const YCPValue &newvalue) |
| YCPValue | changeWidgetTerm (const YCPTerm &property, const YCPValue &newvalue) |
| YCPValue | queryWidget (const YCPSymbol &property) |
| YCPValue | queryWidgetTerm (const YCPTerm &property) |
| int | numCols () const |
| const char * | userInputProperty () |
Protected Member Functions | |
| virtual void | itemAdded (vector< string > elements, int index)=0 |
| virtual void | itemsCleared ()=0 |
| virtual void | cellChanged (int index, int colnum, const YCPString &newtext)=0 |
| virtual int | getCurrentItem ()=0 |
| virtual void | setCurrentItem (int index)=0 |
| int | numItems () const |
| int | itemWithId (const YCPValue &id, bool report_error) |
Protected Attributes | |
| vector< YTableRow > | rows |
| int | num_cols |
Private Member Functions | |
| virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
Table
A Table widget is a generalization of the SelectionBox. Information is displayed in a number of columns. Each column has a header. The number of columns and their titles are described by the first argument, which is a term with the symbol header. For each column you add a string specifying its title. For example `header( "Name", "Price" ) creates the two columns "Name" and "Price".
The second argument is an optional list of items (rows) that are inserted in the table. Each item has the form `item( `id( id ), first column, second column, ... ). For each column one argument has to be specified, which must be of type void, string or integer. Strings are being left justified, integer right and a nil denote an empty cell, just as the empty string.
| YTable::YTable | ( | const YWidgetOpt & | opt, | |
| int | num_cols | |||
| ) |
Creates a new and empty Table
| num_cols | The number of columns of the table |
| virtual char* YTable::widgetClass | ( | ) | [inline, virtual] |
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented from YWidget.
| bool YTable::addItem | ( | const YCPValue & | item | ) |
Adds an item to the table that is given as term yet to be parsed.
| bool YTable::addItems | ( | const YCPList & | itemlist | ) | [virtual] |
Adds a list of items to the table. The list contains item specifications yet to be parsed.
| void YTable::addItem | ( | const YCPValue & | id, | |
| vector< string > | elements | |||
| ) |
Adds an item to the table.
Implements the ui command changeWidget.
Reimplemented from YWidget.
Implements the ui command changeWidget with property given as term.
Reimplemented from YWidget.
Implements the ui command queryWidget
Reimplemented from YWidget.
Implements the ui command queryWidget with property given as term.
Reimplemented from YWidget.
| int YTable::numCols | ( | ) | const |
Returns the number of columns of the table.
| const char* YTable::userInputProperty | ( | ) | [inline, virtual] |
| virtual void YTable::itemAdded | ( | vector< string > | elements, | |
| int | index | |||
| ) | [protected, pure virtual] |
Is called, when an item ( a row ) has been added. Overload this to fill the ui specific widget with items.
| elements | the strings of the elements, one for each column. | |
| index | index of the new item. |
| virtual void YTable::itemsCleared | ( | ) | [protected, pure virtual] |
Is called, when all items have been cleared. Overload this and clear the ui specific table.
| virtual void YTable::cellChanged | ( | int | index, | |
| int | colnum, | |||
| const YCPString & | newtext | |||
| ) | [protected, pure virtual] |
Is called, when the contents of a cell has been changed. Overload this and change the cell text.
| virtual int YTable::getCurrentItem | ( | ) | [protected, pure virtual] |
Returns the index of the currently selected item or -1 if no item is selected.
| virtual void YTable::setCurrentItem | ( | int | index | ) | [protected, pure virtual] |
Makes another item the selected one.
| int YTable::numItems | ( | ) | const [protected] |
Returns the current number of items
| int YTable::itemWithId | ( | const YCPValue & | id, | |
| bool | report_error | |||
| ) | [protected] |
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
| report_error | set this to true, if you want me to report an error if non item can be found. |
| void YTable::saveUserInput | ( | YMacroRecorder * | macroRecorder | ) | [private, virtual] |
vector<YTableRow> YTable::rows [protected] |
The current data in the table
int YTable::num_cols [protected] |
The number of columns of the table
1.5.0