]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/dialogs/dialogs.h
don't crash when invalid colour is set as fg/bg colour
[wxWidgets.git] / samples / dialogs / dialogs.h
index 39c199a35a38c33aeb34e7381f1b286ab588e29f..bcf6e2a08323afca3fa99101fb74beeac97a1b76 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows license
+// Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef __DIALOGSH__
 
 // Define a new application type
 class MyApp: public wxApp
-{ public:
-    bool OnInit(void);
+{
+public:
+    bool OnInit();
 
     wxFont       m_canvasFont;
     wxColour     m_canvasTextColour;
 };
 
+// A custom modeless dialog
+class MyModelessDialog : public wxDialog
+{
+public:
+    MyModelessDialog(wxWindow *parent);
+
+    void OnClose(wxCloseEvent& event);
+
+private:
+    DECLARE_EVENT_TABLE()
+};
+
+// A custom modal dialog
+class MyModalDialog : public wxDialog
+{
+public:
+    MyModalDialog(wxWindow *parent);
+
+    void OnButton(wxCommandEvent& event);
+
+private:
+    wxButton *m_btnFocused;
+    wxButton *m_btnDelete;
+
+    DECLARE_EVENT_TABLE()
+};
+
 // Define a new frame type
 class MyFrame: public wxFrame
-{ public:
-    MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos,
-               const wxSize& size);
-    bool OnClose(void) { return TRUE; }
+{
+public:
+    MyFrame(wxWindow *parent, const wxString& title,
+            const wxPoint& pos, const wxSize& size);
 
-       void ChooseColour(wxCommandEvent& event);
-       void ChooseFont(wxCommandEvent& event);
+    void ChooseColour(wxCommandEvent& event);
+    void ChooseFont(wxCommandEvent& event);
+    void LogDialog(wxCommandEvent& event);
     void MessageBox(wxCommandEvent& event);
     void SingleChoice(wxCommandEvent& event);
+    void MultiChoice(wxCommandEvent& event);
     void TextEntry(wxCommandEvent& event);
+    void PasswordEntry(wxCommandEvent& event);
+    void NumericEntry(wxCommandEvent& event);
     void FileOpen(wxCommandEvent& event);
+    void FileOpen2(wxCommandEvent& event);
+    void FilesOpen(wxCommandEvent& event);
     void FileSave(wxCommandEvent& event);
     void DirChoose(wxCommandEvent& event);
+    void GenericDirChoose(wxCommandEvent& event);
+    void ShowTip(wxCommandEvent& event);
+    void ModalDlg(wxCommandEvent& event);
+    void ModelessDlg(wxCommandEvent& event);
+    void ShowProgress(wxCommandEvent& event);
 
-#if !defined(__WINDOWS__) || USE_GENERIC_DIALOGS_IN_MSW
-       void ChooseColourGeneric(wxCommandEvent& event);
-       void ChooseFontGeneric(wxCommandEvent& event);
+#if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW
+    void ChooseColourGeneric(wxCommandEvent& event);
+    void ChooseFontGeneric(wxCommandEvent& event);
 #endif
-       void OnExit(wxCommandEvent& event);
-DECLARE_EVENT_TABLE()
+
+    void OnExit(wxCommandEvent& event);
+
+    void OnButton(wxCommandEvent& event);
+
+private:
+    MyModelessDialog *m_dialog;
+
+    DECLARE_EVENT_TABLE()
 };
 
 class MyCanvas: public wxScrolledWindow
 {
- public:
-  MyCanvas(wxWindow *parent):
-      wxScrolledWindow(parent)
-    {
-    }
-  void OnPaint(wxPaintEvent& event);
-DECLARE_EVENT_TABLE()
+public:
+    MyCanvas(wxWindow *parent) : wxScrolledWindow(parent) { }
+
+    void OnPaint(wxPaintEvent& event);
+
+    DECLARE_EVENT_TABLE()
 };
 
 
 // Menu IDs
-#define DIALOGS_CHOOSE_COLOUR               1
-#define DIALOGS_CHOOSE_COLOUR_GENERIC       2
-#define DIALOGS_CHOOSE_FONT                 3
-#define DIALOGS_CHOOSE_FONT_GENERIC         4
-#define DIALOGS_MESSAGE_BOX                 5
-#define DIALOGS_SINGLE_CHOICE               6
-#define DIALOGS_TEXT_ENTRY                  7
-#define DIALOGS_FILE_OPEN                   8
-#define DIALOGS_FILE_SAVE                   9
-#define DIALOGS_DIR_CHOOSE                  10
+enum
+{
+    DIALOGS_CHOOSE_COLOUR = 1,
+    DIALOGS_CHOOSE_COLOUR_GENERIC,
+    DIALOGS_CHOOSE_FONT,
+    DIALOGS_CHOOSE_FONT_GENERIC,
+    DIALOGS_MESSAGE_BOX,
+    DIALOGS_SINGLE_CHOICE,
+    DIALOGS_MULTI_CHOICE,
+    DIALOGS_TEXT_ENTRY,
+    DIALOGS_PASSWORD_ENTRY,
+    DIALOGS_FILE_OPEN,
+    DIALOGS_FILE_OPEN2,
+    DIALOGS_FILES_OPEN,
+    DIALOGS_FILE_SAVE,
+    DIALOGS_DIR_CHOOSE,
+    DIALOGS_GENERIC_DIR_CHOOSE,
+    DIALOGS_TIP,
+    DIALOGS_NUM_ENTRY,
+    DIALOGS_LOG_DIALOG,
+    DIALOGS_MODAL,
+    DIALOGS_MODELESS,
+    DIALOGS_MODELESS_BTN,
+    DIALOGS_PROGRESS
+};
 
 #endif