]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/db/dbtest.h
wxDateTime...
[wxWidgets.git] / samples / db / dbtest.h
index 76ee48eaba7e5850af25add2ed86e4336814e10c..4d1f7458446ce1bcbc5fe21671669d3ef816c425 100644 (file)
@@ -9,7 +9,9 @@
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
+#ifdef __GNUG__
 #pragma interface "dbtest.h"
+#endif
 
 #include <wx/string.h>
 #include <wx/dbtable.h>
@@ -22,9 +24,13 @@ enum         DialogModes {mView,mCreate,mEdit,mSearch};
 #define EDIT_PARAMETERS                200
 #define ABOUT_DEMO                     300
 
+// this seems to be missing, Robert Roebling (?)
+#ifndef MAX_PATH
+#define MAX_PATH   200
+#endif
 
 // Name of the table to be created/opened
-const char     CONTACT_TABLE_NAME[]            =       "CONTACTS";
+const char     CONTACT_TABLE_NAME[]            =       "contacts";
 
 // Nuber of columns in the above table
 const int      CONTACT_NO_COLS                 = 12;           // 0-11
@@ -38,7 +44,7 @@ enum Language {langENGLISH, langFRENCH, langGERMAN, langSPANISH, langOTHER};
 class CeditorDlg;
 class CparameterDlg;
 
-const char paramFilename[] = "database.cfg";
+const char paramFilename[] = "dbtest.cfg";
 
 
 /*
@@ -96,6 +102,7 @@ typedef struct Cparameters
        char    ODBCSource[100+1];
        char    UserName[25+1];
        char    Password[25+1];
+       char    DirPath[MAX_PATH+1];
 } Cparameters;
 
 
@@ -104,7 +111,7 @@ class DatabaseDemoApp: public wxApp
 {
        public:
                Cparameters  params;
-               wxFrame         *OnInit(void);
+               bool         OnInit();
 };  // DatabaseDemoApp
 
 DECLARE_APP(DatabaseDemoApp)
@@ -117,14 +124,19 @@ class DatabaseDemoFrame: public wxFrame
                CparameterDlg   *pParamDlg;
 
        public:
-               DatabaseDemoFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
+               DatabaseDemoFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& sz);
 
-               void    OnMenuCommand(int id);
-               bool    OnClose(void);
+               void    OnCloseWindow(wxCloseEvent& event);
+        void    OnCreate(wxCommandEvent& event);
+        void    OnExit(wxCommandEvent& event);
+        void    OnEditParameters(wxCommandEvent& event);
+        void    OnAbout(wxCommandEvent& event);
 
                void    CreateDataTable();
                void    BuildEditorDialog();
                void    BuildParameterDialog(wxWindow *parent);
+
+DECLARE_EVENT_TABLE()
 };  // DatabaseDemoFrame
 
 
@@ -141,20 +153,21 @@ class CeditorDlg : public wxPanel
                wxButton                *pCreateBtn,  *pEditBtn,      *pDeleteBtn,  *pCopyBtn,  *pSaveBtn,  *pCancelBtn;
                wxButton                *pPrevBtn,    *pNextBtn,      *pQueryBtn,   *pResetBtn, *pDoneBtn,  *pHelpBtn;
                wxButton                *pNameListBtn;
-               wxText          *pNameTxt,    *pAddress1Txt,  *pAddress2Txt,*pCityTxt,  *pStateTxt, *pCountryTxt,*pPostalCodeTxt;
-               wxMessage       *pNameMsg,    *pAddress1Msg,  *pAddress2Msg,*pCityMsg,  *pStateMsg, *pCountryMsg,*pPostalCodeMsg;
-               wxText          *pJoinDateTxt,*pContribTxt,   *pLinesTxt;
-               wxMessage   *pJoinDateMsg,*pContribMsg,   *pLinesMsg;
+               wxTextCtrl              *pNameTxt,    *pAddress1Txt,  *pAddress2Txt,*pCityTxt,  *pStateTxt, *pCountryTxt,*pPostalCodeTxt;
+               wxStaticText    *pNameMsg,    *pAddress1Msg,  *pAddress2Msg,*pCityMsg,  *pStateMsg, *pCountryMsg,*pPostalCodeMsg;
+               wxTextCtrl              *pJoinDateTxt,*pContribTxt,   *pLinesTxt;
+               wxStaticText   *pJoinDateMsg,*pContribMsg,   *pLinesMsg;
                wxRadioBox      *pDeveloperRadio;
                wxChoice    *pNativeLangChoice;
-               wxMessage       *pNativeLangMsg;
+               wxStaticText    *pNativeLangMsg;
 
        public:
                enum    DialogModes              mode;
                Ccontact                                        *Contact;       // this is the table object that will be being manipulated
 
                CeditorDlg(wxWindow *parent);
-               bool    OnClose(void);
+               void    OnCloseWindow(wxCloseEvent& event);
+               void    OnButton( wxCommandEvent &event );
                void    OnCommand(wxWindow& win, wxCommandEvent& event);
                void    OnActivate(bool) {};  // necessary for hot keys
 
@@ -166,12 +179,55 @@ class CeditorDlg : public wxPanel
                bool    GetNextRec();
                bool    GetPrevRec();
                bool    GetRec(char *whereStr);
+               
+DECLARE_EVENT_TABLE()
 };  // CeditorDlg
 
+#define EDITOR_DIALOG                   199
+
+// Editor dialog control ids
+#define EDITOR_DIALOG_FN_GROUP          200
+#define EDITOR_DIALOG_SEARCH_GROUP      201
+#define EDITOR_DIALOG_CREATE            202
+#define EDITOR_DIALOG_EDIT              203
+#define EDITOR_DIALOG_DELETE            204
+#define EDITOR_DIALOG_COPY              205
+#define EDITOR_DIALOG_SAVE              206
+#define EDITOR_DIALOG_CANCEL            207
+#define EDITOR_DIALOG_PREV              208
+#define EDITOR_DIALOG_NEXT              209
+#define EDITOR_DIALOG_QUERY             211
+#define EDITOR_DIALOG_RESET             212
+#define EDITOR_DIALOG_NAME_MSG          213
+#define EDITOR_DIALOG_NAME_TEXT         214
+#define EDITOR_DIALOG_LOOKUP            215
+#define EDITOR_DIALOG_ADDRESS1_MSG      216
+#define EDITOR_DIALOG_ADDRESS1_TEXT     217
+#define EDITOR_DIALOG_ADDRESS2_MSG      218
+#define EDITOR_DIALOG_ADDRESS2_TEXT     219
+#define EDITOR_DIALOG_CITY_MSG          220
+#define EDITOR_DIALOG_CITY_TEXT         221
+#define EDITOR_DIALOG_COUNTRY_MSG       222
+#define EDITOR_DIALOG_COUNTRY_TEXT      223
+#define EDITOR_DIALOG_POSTAL_MSG        224
+#define EDITOR_DIALOG_POSTAL_TEXT       225
+#define EDITOR_DIALOG_LANG_MSG          226
+#define EDITOR_DIALOG_LANG_CHOICE       227
+#define EDITOR_DIALOG_DATE_MSG          228
+#define EDITOR_DIALOG_DATE_TEXT         229
+#define EDITOR_DIALOG_CONTRIB_MSG       230
+#define EDITOR_DIALOG_CONTRIB_TEXT      231
+#define EDITOR_DIALOG_LINES_MSG         232
+#define EDITOR_DIALOG_LINES_TEXT        233
+#define EDITOR_DIALOG_STATE_MSG         234
+#define EDITOR_DIALOG_STATE_TEXT        235
+#define EDITOR_DIALOG_DEVELOPER         236
+#define EDITOR_DIALOG_JOIN_MSG          237
+#define EDITOR_DIALOG_JOIN_TEXT         238
 
 // *************************** CparameterDlg ***************************
 
-class CparameterDlg : public wxDialogBox
+class CparameterDlg : public wxDialog
 {
        private:
                bool                                             widgetPtrsSet;
@@ -180,15 +236,16 @@ class CparameterDlg : public wxDialogBox
                Cparameters                              savedParamSettings;
 
                // Pointers to all widgets on the dialog
-               wxMessage       *pParamODBCSourceMsg;
-               wxListBox       *pParamODBCSourceList;
-               wxMessage       *pParamUserNameMsg,             *pParamPasswordMsg;
-               wxText          *pParamUserNameTxt,             *pParamPasswordTxt;
-               wxButton                *pParamSaveBtn,                 *pParamCancelBtn;
+               wxStaticText    *pParamODBCSourceMsg;
+               wxListBox               *pParamODBCSourceList;
+               wxStaticText    *pParamUserNameMsg,             *pParamPasswordMsg,     *pParamDirPathMsg;
+               wxTextCtrl              *pParamUserNameTxt,             *pParamPasswordTxt,     *pParamDirPathTxt;
+               wxButton                        *pParamSaveBtn,                 *pParamCancelBtn;
 
        public:
                CparameterDlg(wxWindow *parent);
-               bool    OnClose(void);
+               void    OnCloseWindow(wxCloseEvent& event);
+               void    OnButton( wxCommandEvent &event );
                void    OnCommand(wxWindow& win, wxCommandEvent& event);
                void    OnActivate(bool) {};  // necessary for hot keys
 
@@ -197,8 +254,22 @@ class CparameterDlg : public wxDialogBox
                bool    Save();
                void    FillDataSourceList();
 
+DECLARE_EVENT_TABLE()
 };  // CparameterDlg
 
+#define PARAMETER_DIALOG                    400
+
+// Parameter dialog control ids
+#define PARAMETER_DIALOG_SOURCE_MSG         401
+#define PARAMETER_DIALOG_SOURCE_LISTBOX     402
+#define PARAMETER_DIALOG_NAME_MSG           403
+#define PARAMETER_DIALOG_NAME_TEXT          404
+#define PARAMETER_DIALOG_PASSWORD_MSG       405
+#define PARAMETER_DIALOG_PASSWORD_TEXT      406
+#define PARAMETER_DIALOG_DIRPATH_MSG       407
+#define PARAMETER_DIALOG_DIRPATH_TEXT      408
+#define PARAMETER_DIALOG_SAVE               409
+#define PARAMETER_DIALOG_CANCEL             410
 
 // *************************** CqueryDlg ***************************
 
@@ -230,7 +301,7 @@ char * const langQRY_LIKE                                                                   = "% matches 0 or more of any char; _ matches
 char * const langQRY_BETWEEN                                                           = "column BETWEEN value AND value";
 
 
-class CqueryDlg : public wxDialogBox
+class CqueryDlg : public wxDialog
 {
        private:
                CcolInf *colInf;                // Column inf. returned by db->GetColumns()
@@ -243,20 +314,20 @@ class CqueryDlg : public wxDialogBox
                bool                                    widgetPtrsSet;
 
                // Widget pointers
-               wxMessage                       *pQueryCol1Msg;
+               wxStaticText                    *pQueryCol1Msg;
                wxChoice                                *pQueryCol1Choice;
-               wxMessage                       *pQueryNotMsg;
+               wxStaticText                    *pQueryNotMsg;
                wxCheckBox                      *pQueryNotCheck;
-               wxMessage                       *pQueryOperatorMsg;
+               wxStaticText                    *pQueryOperatorMsg;
                wxChoice                                *pQueryOperatorChoice;
-               wxMessage                       *pQueryCol2Msg;
+               wxStaticText                    *pQueryCol2Msg;
                wxChoice                                *pQueryCol2Choice;
-               wxMessage                       *pQueryValue1Msg;
-               wxText                          *pQueryValue1Txt;
-               wxMessage                       *pQueryValue2Msg;
-               wxText                          *pQueryValue2Txt;
-               wxMessage                       *pQuerySqlWhereMsg;
-               wxMultiText                     *pQuerySqlWhereMtxt;
+               wxStaticText                    *pQueryValue1Msg;
+               wxTextCtrl                              *pQueryValue1Txt;
+               wxStaticText                    *pQueryValue2Msg;
+               wxTextCtrl                              *pQueryValue2Txt;
+               wxStaticText                    *pQuerySqlWhereMsg;
+               wxTextCtrl                      *pQuerySqlWhereMtxt;
                wxButton                                *pQueryAddBtn;
                wxButton                                *pQueryAndBtn;
                wxButton                                *pQueryOrBtn;
@@ -266,15 +337,16 @@ class CqueryDlg : public wxDialogBox
                wxButton                                *pQueryClearBtn;
                wxButton                                *pQueryCountBtn;
                wxButton                                *pQueryHelpBtn;
-               wxGroupBox                      *pQueryHintGrp;
-               wxMessage                       *pQueryHintMsg;
+               wxStaticBox                     *pQueryHintGrp;
+               wxStaticText                    *pQueryHintMsg;
 
-               wxText                          *pFocusTxt;
+               wxTextCtrl                              *pFocusTxt;
 
                CqueryDlg(wxWindow *parent, wxDB *pDb, char *tblName[], char *pWhereArg);
 
+               void    OnButton( wxCommandEvent &event );
                void            OnCommand(wxWindow& win, wxCommandEvent& event);
-               bool            OnClose();
+               void        OnCloseWindow(wxCloseEvent& event);
                void            OnActivate(bool) {};  // necessary for hot keys
 
 //             bool            SetWidgetPtrs();
@@ -283,4 +355,34 @@ class CqueryDlg : public wxDialogBox
                void            ProcessCountBtn();
                bool            ValidateWhereClause();
 
+DECLARE_EVENT_TABLE()
 };  // CqueryDlg
+
+#define QUERY_DIALOG                    300
+
+// Parameter dialog control ids
+#define QUERY_DIALOG_COL_MSG            301
+#define QUERY_DIALOG_COL_CHOICE         302
+#define QUERY_DIALOG_NOT_MSG            303
+#define QUERY_DIALOG_NOT_CHECKBOX       304
+#define QUERY_DIALOG_OP_MSG             305
+#define QUERY_DIALOG_OP_CHOICE          306
+#define QUERY_DIALOG_COL2_MSG           307
+#define QUERY_DIALOG_COL2_CHOICE        308
+#define QUERY_DIALOG_WHERE_MSG          309
+#define QUERY_DIALOG_WHERE_TEXT         310
+#define QUERY_DIALOG_ADD                311
+#define QUERY_DIALOG_AND                312
+#define QUERY_DIALOG_OR                 313
+#define QUERY_DIALOG_LPAREN             314
+#define QUERY_DIALOG_RPAREN             315
+#define QUERY_DIALOG_DONE               316
+#define QUERY_DIALOG_CLEAR              317
+#define QUERY_DIALOG_COUNT              318
+#define QUERY_DIALOG_VALUE1_MSG         319
+#define QUERY_DIALOG_VALUE1_TEXT        320
+#define QUERY_DIALOG_VALUE2_MSG         321
+#define QUERY_DIALOG_VALUE2_TEXT        322
+#define QUERY_DIALOG_HINT_GROUP         323
+#define QUERY_DIALOG_HINT_MSG           324
+