|
#include <CComboBox.h>

Public Member Functions | |
| virtual void | clear () |
| Clears the list view inside. | |
| uint32_t | buttons () |
| Returns the bitmask of visible buttons' IDs. | |
| void | buttons (uint32_t) |
| Sets the bitmask for visible buttons' IDs. | |
| Fl_Callback_p | buttonClicked () const |
| Returns buttons' callback function. | |
| void | buttonClicked (Fl_Callback *c) |
| Sets buttons' callback function. | |
| void | columns (const CColumnList &columnList) |
| CColumnList & | columns () |
| void | addColumn (std::string cname, CVariantType type=VAR_STRING, int16_t cwidth=70, bool cvisible=true) |
| void | addRow (CPackedStrings *row) |
| void | addRow (const CStrings &rowStrings, int rowId=0) |
| void | addRow (int rowId, const char *s1, const char *s2=NULL, const char *s3=NULL, const char *s4=NULL, const char *s5=NULL) |
| void | addRows (std::string columnName, CStrings rows) |
| virtual void | resize (int x, int y, int w, int h) |
| virtual CVariant | data () const |
| Universal data connection. Operates with selected list view item's ID. | |
| virtual void | data (const CVariant v) |
| Universal data connection. Operates with selected list view item's ID. | |
| void | dataMode (CListViewDataMode dm) |
| CListViewDataMode | dataMode () |
| CPackedStrings * | findCaption (std::string caption) |
| CPackedStrings * | findKey (int keyValue) |
| CDatabaseDriver * | database () const |
| Returns database connection pointer. | |
| void | database (CDatabaseDriver *db) |
| Defines database connection. | |
| std::string | sql () const |
| Returns SQL query text. | |
| void | sql (std::string s) |
| std::string | keyField () const |
| Returns SQL query field name that contains unique row IDS, preferrably - integers. | |
| void | keyField (std::string keyFieldName) |
| int | sortColumn () const |
| Returns sortColumn. | |
| void | sort () |
| Sorts the list. | |
| void | sortColumn (int sortColumn) |
| void | setup (CDatabaseDriver *db, std::string sql, std::string keyField) |
| CParam & | param (const char *paramName) |
| void | refreshData () |
| int | findString (std::string str, bool select=true, uint32_t startRow=0, unsigned endRow=0) |
| CPackedStrings & | selectedRow () const |
| Returns the currently selected row, or reference to NULL if not selected. | |
| void | selectRow (unsigned rowNumber) |
| void | showHeaders () |
| Shows column headers in the list. | |
| void | hideHeaders () |
| Hides column headers in the list. | |
| unsigned | size () const |
| Returns the number of rows in list view. | |
| virtual bool | preferredSize (int &w, int &h) |
Protected Member Functions | |
| virtual void | dropDownList () |
| Drops down the window with the List View. CComboBox only. | |
| void | load (CQuery *) |
| Loads data from the Query. | |
| void | save (CQuery *) |
| Saves data to the Query. | |
| virtual void | load (const CXmlNode *node, CLayoutXMLmode xmlMode) |
| Loads control data from XML. | |
| virtual void | save (CXmlNode *node, CLayoutXMLmode xmlMode) const |
| Saves control data to XML. | |
| bool | valid () const |
| Returns true, if the data is valid. | |
| CBaseListBox (const char *label, int layoutSize, CLayoutAlign layoutAlign, int mode) | |
| ~CBaseListBox () | |
| Destructor. | |
| virtual void | button_handle (uint32_t buttonKind) |
| Internal buttons callback function. | |
Protected Attributes | |
| int | m_mode |
| Control mode - CListBox or CComboBox. | |
| CDBDropDownList * | m_dropDownWindow |
| Drop down window - CComboBox only. | |
| CDBListView * | m_list |
| Internal CDBListView widget. | |
| int | m_buttonSpace |
| The width of space taken by buttons. | |
Friends | |
| class | CInternalComboBoxPanel |
A base class for CListBox and CComboBox. Implements most of the common methods for these two classes.
| sptk::CBaseListBox::CBaseListBox | ( | const char * | label, | |
| int | layoutSize, | |||
| CLayoutAlign | layoutAlign, | |||
| int | mode | |||
| ) | [protected] |
Constructor in SPTK style
| label | const char *, label | |
| layoutSize | int, widget align in layout | |
| layoutAlign | CLayoutAlign, widget align in layout | |
| mode | int, IS_COMBO_BOX or IS_LIST_BOX - internal |
| void sptk::CBaseListBox::addColumn | ( | std::string | cname, | |
| CVariantType | type = VAR_STRING, |
|||
| int16_t | cwidth = 70, |
|||
| bool | cvisible = true | |||
| ) |
Adds a new column to the internal list view.
| cname | std::string, column name | |
| type | CVariantType, column data type | |
| cwidth | int16_t, column width | |
| cvisible | bool, is the column visible? |
| void sptk::CBaseListBox::addRow | ( | int | rowId, | |
| const char * | s1, | |||
| const char * | s2 = NULL, |
|||
| const char * | s3 = NULL, |
|||
| const char * | s4 = NULL, |
|||
| const char * | s5 = NULL | |||
| ) |
Adds new row to the internal list view.
| rowId | int, row argument (key value) | |
| s1 | const char *, text data for the column 1 | |
| s2 | const char *, text data for the column 2 | |
| s3 | const char *, text data for the column 3 | |
| s4 | const char *, text data for the column 4 | |
| s5 | const char *, text data for the column 5 |
| void sptk::CBaseListBox::addRow | ( | const CStrings & | rowStrings, | |
| int | rowId = 0 | |||
| ) |
| void sptk::CBaseListBox::addRow | ( | CPackedStrings * | row | ) |
Adds a new row to the internal list view. Doesn't make a copy - just inserts the pointer. The row will be destroyed in CCombo destructor. The row ID may be defined inside CPackedStrings object.
| row | CPackedStrings *, new row |
| void sptk::CBaseListBox::addRows | ( | std::string | columnName, | |
| CStrings | rows | |||
| ) |
Creates the column as columnName and adds rows to the internal list view. If the column with such name already exists, it will be used. The method is good the a very simple cases of one-column combo boxes. The row IDs may be defined inside CStrings object strings.
| columnName | std::string, new columnName | |
| rows | CStrings, new rows |
| CColumnList& sptk::CBaseListBox::columns | ( | ) |
Returns current column list of the internal list view.
| void sptk::CBaseListBox::columns | ( | const CColumnList & | columnList | ) |
Sets the internal list view columns from the column list. The old column list is destroyed and replaced with a copy of columnList.
| columnList | CColumnList&, new column list |
| CListViewDataMode sptk::CBaseListBox::dataMode | ( | ) | [inline] |
Returns data mode as LVDM_KEY, LVDM_INDEX, or LVDM_TEXT.
| void sptk::CBaseListBox::dataMode | ( | CListViewDataMode | dm | ) | [inline] |
| CPackedStrings* sptk::CBaseListBox::findCaption | ( | std::string | caption | ) | [inline] |
Finds an item with the caption (a string in the first column).
| caption | std::string, the caption to find and select. |
| CPackedStrings* sptk::CBaseListBox::findKey | ( | int | keyValue | ) | [inline] |
Finds an item with the key (an integer associated with the item - argument()).
| keyValue | int, the caption to find and select. |
| int sptk::CBaseListBox::findString | ( | std::string | str, | |
| bool | select = true, |
|||
| uint32_t | startRow = 0, |
|||
| unsigned | endRow = 0 | |||
| ) |
Finds a string in the sort column of list view defined with sortColumn()
| str | std::string, string to find | |
| select | bool, true if we want to select the found row | |
| startRow | uint32_t, the row number to start | |
| endRow | uint32_t, the row number to finish |
| void sptk::CBaseListBox::keyField | ( | std::string | keyFieldName | ) |
Sets SQL query field name that contains unique row IDS, preferrably - integers.
| keyFieldName | std::string, a name of the key field |
| virtual void sptk::CBaseListBox::load | ( | const CXmlNode * | node, | |
| CLayoutXMLmode | xmlMode | |||
| ) | [protected, virtual] |
Loads control data from XML.
Layout information may also include widget size and position, as well as visible() and active() states
| node | CXmlNode*, the XML node | |
| xmlMode | CLayoutXMLmode, the mode defining how the layout and/or data should be stored |
Reimplemented from sptk::CControl.
| CParam& sptk::CBaseListBox::param | ( | const char * | paramName | ) |
Returns the SQL query parameter reference for the parameter name. It is typical to call: myCombo.param("customer_id") = 1234;
| paramName | const char *, parameter name. |
| virtual bool sptk::CBaseListBox::preferredSize | ( | int & | w, | |
| int & | h | |||
| ) | [virtual] |
Computes the optimal widgets size
| w | int&, input - width offered by the program, output - width required by widget | |
| h | int&, input - height offered by the program, output - height required by widget |
Reimplemented from sptk::CLayoutClient.
| void sptk::CBaseListBox::refreshData | ( | ) |
Reloads data from the database if database connection is defined. Throws an exception if any error.
| virtual void sptk::CBaseListBox::resize | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) | [virtual] |
Resizes the control and inside widgets.
| x | int, x-position | |
| y | int, y-position | |
| w | int, width | |
| h | int, height |
Reimplemented from sptk::CControl.
| virtual void sptk::CBaseListBox::save | ( | CXmlNode * | node, | |
| CLayoutXMLmode | xmlMode | |||
| ) | const [protected, virtual] |
Saves control data to XML.
Layout information may also include widget size and position, as well as visible() and active() states
| node | CXmlNode*, the XML node | |
| xmlMode | CLayoutXMLmode, the mode defining how the layout and/or data should be stored |
Reimplemented from sptk::CControl.
| void sptk::CBaseListBox::selectRow | ( | unsigned | rowNumber | ) |
Selects a row
| rowNumber | unsigned, row number |
| void sptk::CBaseListBox::setup | ( | CDatabaseDriver * | db, | |
| std::string | sql, | |||
| std::string | keyField | |||
| ) |
The fast way to define a database connection.
| db | CDatabaseDriver *, a pointer to the database | |
| sql | std::string, a SQL query text | |
| keyField | std::string, a name of the query field with unique row IDs |
| void sptk::CBaseListBox::sortColumn | ( | int | sortColumn | ) |
Defines sortColumn.
| sortColumn | int, sort column number. -1 means don't sort. |
| void sptk::CBaseListBox::sql | ( | std::string | s | ) |
Defines SQL query text
| s | std::string, SQL text |