]> git.saurik.com Git - wxWidgets.git/blob - samples/dialogs/dialogs.h
don't crash when invalid colour is set as fg/bg colour
[wxWidgets.git] / samples / dialogs / dialogs.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialogs.h
3 // Purpose: Common dialogs demo
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __DIALOGSH__
13 #define __DIALOGSH__
14
15 // Define a new application type
16 class MyApp: public wxApp
17 {
18 public:
19 bool OnInit();
20
21 wxFont m_canvasFont;
22 wxColour m_canvasTextColour;
23 };
24
25 // A custom modeless dialog
26 class MyModelessDialog : public wxDialog
27 {
28 public:
29 MyModelessDialog(wxWindow *parent);
30
31 void OnClose(wxCloseEvent& event);
32
33 private:
34 DECLARE_EVENT_TABLE()
35 };
36
37 // A custom modal dialog
38 class MyModalDialog : public wxDialog
39 {
40 public:
41 MyModalDialog(wxWindow *parent);
42
43 void OnButton(wxCommandEvent& event);
44
45 private:
46 wxButton *m_btnFocused;
47 wxButton *m_btnDelete;
48
49 DECLARE_EVENT_TABLE()
50 };
51
52 // Define a new frame type
53 class MyFrame: public wxFrame
54 {
55 public:
56 MyFrame(wxWindow *parent, const wxString& title,
57 const wxPoint& pos, const wxSize& size);
58
59 void ChooseColour(wxCommandEvent& event);
60 void ChooseFont(wxCommandEvent& event);
61 void LogDialog(wxCommandEvent& event);
62 void MessageBox(wxCommandEvent& event);
63 void SingleChoice(wxCommandEvent& event);
64 void MultiChoice(wxCommandEvent& event);
65 void TextEntry(wxCommandEvent& event);
66 void PasswordEntry(wxCommandEvent& event);
67 void NumericEntry(wxCommandEvent& event);
68 void FileOpen(wxCommandEvent& event);
69 void FileOpen2(wxCommandEvent& event);
70 void FilesOpen(wxCommandEvent& event);
71 void FileSave(wxCommandEvent& event);
72 void DirChoose(wxCommandEvent& event);
73 void GenericDirChoose(wxCommandEvent& event);
74 void ShowTip(wxCommandEvent& event);
75 void ModalDlg(wxCommandEvent& event);
76 void ModelessDlg(wxCommandEvent& event);
77 void ShowProgress(wxCommandEvent& event);
78
79 #if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW
80 void ChooseColourGeneric(wxCommandEvent& event);
81 void ChooseFontGeneric(wxCommandEvent& event);
82 #endif
83
84 void OnExit(wxCommandEvent& event);
85
86 void OnButton(wxCommandEvent& event);
87
88 private:
89 MyModelessDialog *m_dialog;
90
91 DECLARE_EVENT_TABLE()
92 };
93
94 class MyCanvas: public wxScrolledWindow
95 {
96 public:
97 MyCanvas(wxWindow *parent) : wxScrolledWindow(parent) { }
98
99 void OnPaint(wxPaintEvent& event);
100
101 DECLARE_EVENT_TABLE()
102 };
103
104
105 // Menu IDs
106 enum
107 {
108 DIALOGS_CHOOSE_COLOUR = 1,
109 DIALOGS_CHOOSE_COLOUR_GENERIC,
110 DIALOGS_CHOOSE_FONT,
111 DIALOGS_CHOOSE_FONT_GENERIC,
112 DIALOGS_MESSAGE_BOX,
113 DIALOGS_SINGLE_CHOICE,
114 DIALOGS_MULTI_CHOICE,
115 DIALOGS_TEXT_ENTRY,
116 DIALOGS_PASSWORD_ENTRY,
117 DIALOGS_FILE_OPEN,
118 DIALOGS_FILE_OPEN2,
119 DIALOGS_FILES_OPEN,
120 DIALOGS_FILE_SAVE,
121 DIALOGS_DIR_CHOOSE,
122 DIALOGS_GENERIC_DIR_CHOOSE,
123 DIALOGS_TIP,
124 DIALOGS_NUM_ENTRY,
125 DIALOGS_LOG_DIALOG,
126 DIALOGS_MODAL,
127 DIALOGS_MODELESS,
128 DIALOGS_MODELESS_BTN,
129 DIALOGS_PROGRESS
130 };
131
132 #endif
133