|
#include <CDialog.h>

Public Member Functions | |
| CDialog (int w, int h, const char *label=0) | |
| Constructor. | |
| ~CDialog () | |
| Destructor. | |
| virtual bool | reset () |
| Resets all the controls inside the dialog tabs by calling reset() for every control. | |
| int | handle (int event) |
| Own handle() method to process dialog events the special way. | |
| bool | showModal () |
| Shows modal dialog. | |
| void | alert (std::string s) const |
| Shows an alert box. | |
| void | defaultButton (CButton *btn) |
| Defines the default button. | |
| virtual void | database (CDatabaseDriver *db) |
| Sets the database connection. | |
| CDatabaseDriver * | database () const |
| Returns current database connection. | |
| void | table (std::string tableName) |
| Defines database table to use. | |
| std::string | table () const |
| Returnes used database table. | |
| void | table (CDatabaseDriver *db, std::string tableName, const std::string keyFieldName) |
| Fast setup of the database connection. | |
| void | keyField (std::string keyFieldName) |
| Sets the key field name for the database table. | |
| std::string | keyField () const |
| Returns the key field name for the database table. | |
| void | keyValue (int val) |
| Finds the database record by the value in previously defined key field. | |
| int | keyValue () const |
| Returns the current database record key value. | |
| virtual Fl_Group * | newPage (const char *label, bool autoColor=false) |
| Creates a new page as CGroup. | |
| virtual Fl_Group * | newScroll (const char *label, bool autoColor=false) |
| Creates a new page as CScroll. | |
| CButton * | addExtraButton (CButtonKind buttonKind, const char *label, Fl_Callback_p callback) |
| Adds a user-defined button to the dialog. | |
| uint32_t | fieldCount () const |
| Returns the number of controls inside the dialog with defined field names. | |
| CControl & | operator[] (std::string fieldName) |
| Index operator to access controls with defined field name. | |
| void | rescan () |
| Makes dialog to scan the widgets inside. | |
| virtual void | load (const CXmlNode *node) throw (CException) |
| Loads the dialog controls data from XML. | |
| virtual void | save (CXmlNode *node) const |
| Saves the dialog controls into XML. | |
| CDialogModalResult | modalResult () const |
| Returns the modal result of the dialog. | |
| virtual std::string | className () const |
| Returns widget class name (internal SPTK RTTI). | |
Protected Member Functions | |
| virtual bool | okPressed () |
| Ok button callback. | |
| virtual bool | cancelPressed () |
| Ok button callback. | |
| virtual void | scanControls () |
| Scans dialog controls. | |
| virtual bool | buildQueries () |
| Builds database interface queries using table(), keyField(), and control field names. | |
| virtual bool | load () |
| Loads data into dialog. | |
| virtual bool | save () |
| Saves data from dialog. | |
Protected Attributes | |
| CButton * | m_okButton |
| Standard Ok button. | |
| CButton * | m_cancelButton |
| Standard Cancel button. | |
| CButton * | m_defaultButton |
| Pointer to the default button. | |
| std::string | m_tableName |
| Database interface: table name. | |
| std::string | m_keyField |
| Database interface: table key field name. | |
| int | m_keyValue |
| Database interface: table key field value for the record to edit. | |
| CControlList | m_defaultFields |
| Database interface: The list of controls for standard processing. | |
| CControlList | m_allFields |
| The list of all controls (CControl-descendants). | |
| CGroup * | m_buttonGroup |
| The group buttons are placed on. | |
| CDialogTabs * | m_pages |
| The tabs. | |
| CQuery * | m_selectQuery |
| Database interface: The query to select a database record. | |
| CQuery * | m_updateQuery |
| Database interface: The query to update a database record. | |
| CQuery * | m_insertQuery |
| Database interface: The query to insert a new database record. | |
| bool | m_queriesBuilt |
| Database interface: The flag indicating if queries are created from available controls. | |
| bool | m_controlsScanned |
| Database interface: The flag indicating if available controls were scanned for field names. | |
| CControlList | m_specialProcessingControls |
| Database interface: The list of the controls to exclude from standard database queries. | |
| CDialogModalResult | m_modalResult |
| The result of exiting the modal mode. | |
Shows a modal window on the screen. CDialog has support for the database data exchange to edit a database record. The required SQL queries in this case are created on the fly, from the list of controls inside the dialog. Controls should have the field names defined, though. And don't forget to define a table name and key field name.
| sptk::CDialog::CDialog | ( | int | w, | |
| int | h, | |||
| const char * | label = 0 | |||
| ) |
Constructor.
| w | int, dialog width | |
| h | int, dialog height | |
| label | const char *, dialog caption |
| CButton* sptk::CDialog::addExtraButton | ( | CButtonKind | buttonKind, | |
| const char * | label, | |||
| Fl_Callback_p | callback | |||
| ) |
Adds a user-defined button to the dialog.
User-defined buttons usually do something in the dialog without closing the dialog.
| buttonKind | CButtonKind, button type | |
| label | const char *, button label | |
| callback | Fl_Callback_p, button callback |
| virtual bool sptk::CDialog::buildQueries | ( | ) | [protected, virtual] |
Builds database interface queries using table(), keyField(), and control field names.
If m_queriesBuilt is already true, does nothing.
| virtual bool sptk::CDialog::cancelPressed | ( | ) | [protected, virtual] |
Ok button callback.
If it returns true the dialog closes. False indicates an error and dialog stays open.
| virtual void sptk::CDialog::database | ( | CDatabaseDriver * | db | ) | [virtual] |
| void sptk::CDialog::defaultButton | ( | CButton * | btn | ) |
Defines the default button.
| btn | CButton *, button in dialog to become the default button |
| int sptk::CDialog::handle | ( | int | event | ) |
Own handle() method to process dialog events the special way.
| event | int, an FLTK event |
Reimplemented from sptk::CWindow.
| void sptk::CDialog::keyField | ( | std::string | keyFieldName | ) |
Sets the key field name for the database table.
The key field contains the unique value to find the database record.
| keyFieldName | std::string, the name of the key field in the database table |
| virtual void sptk::CDialog::load | ( | const CXmlNode * | node | ) | throw (CException) [virtual] |
Loads the dialog controls data from XML.
| node | const CXmlNode*, the XML node to load data from |
| virtual bool sptk::CDialog::load | ( | ) | [protected, virtual] |
Loads data into dialog.
Returns true upon success. If you're overwriting this method make sure you're calling the original CDialog::load() and use the result of it.
| CDialogModalResult sptk::CDialog::modalResult | ( | ) | const [inline] |
Returns the modal result of the dialog.
| virtual Fl_Group* sptk::CDialog::newPage | ( | const char * | label, | |
| bool | autoColor = false | |||
| ) | [virtual] |
Creates a new page as CGroup.
| label | const char *, page label | |
| autoColor | bool, if true the page color is assigned automatically |
| virtual Fl_Group* sptk::CDialog::newScroll | ( | const char * | label, | |
| bool | autoColor = false | |||
| ) | [virtual] |
Creates a new page as CScroll.
| label | const char *, page label | |
| autoColor | bool, if true the page color is assigned automatically |
| virtual bool sptk::CDialog::okPressed | ( | ) | [protected, virtual] |
Ok button callback.
If it returns true the dialog closes. False indicates an error and dialog stays open.
Reimplemented in sptk::CDirOpenDialog, sptk::CFileOpenDialog, and sptk::CFileSaveDialog.
| CControl& sptk::CDialog::operator[] | ( | std::string | fieldName | ) |
Index operator to access controls with defined field name.
| fieldName | std::string, the control field name |
Reimplemented in sptk::CSpellChecker.
| virtual void sptk::CDialog::save | ( | CXmlNode * | node | ) | const [virtual] |
Saves the dialog controls into XML.
| node | CXmlNode&, the XML node to save data into |
| virtual bool sptk::CDialog::save | ( | ) | [protected, virtual] |
Saves data from dialog.
Returns true upon success. If you're overwriting this method make sure you're calling the original CDialog::save() and use the result of it.
| virtual void sptk::CDialog::scanControls | ( | ) | [protected, virtual] |
Scans dialog controls.
If m_controlsScanned is already true, does nothing.
| bool sptk::CDialog::showModal | ( | ) |
Shows modal dialog.
| void sptk::CDialog::table | ( | CDatabaseDriver * | db, | |
| std::string | tableName, | |||
| const std::string | keyFieldName | |||
| ) |
Fast setup of the database connection.
| db | CDatabaseDriver*, the database connection | |
| tableName | std::string, the name of the database table | |
| keyFieldName | std::string, the name of the key field in the database table |
| void sptk::CDialog::table | ( | std::string | tableName | ) |
Defines database table to use.
| tableName | std::string, the name of the database table |