Reworked dialogs sample in the direction of fully working in not fully specified...
[wxWidgets.git] / samples / dialogs / dialogs.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialogs.h
3 // Purpose: Common dialogs demo
4 // Author: Julian Smart
5 // Modified by: ABX (2004) - adjustementd for conditional building
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __DIALOGSH__
13 #define __DIALOGSH__
14
15 #define USE_COLOURDLG_GENERIC \
16 ( \
17 wxUSE_COLOURDLG && \
18 ( defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) ) && \
19 !defined(__WXUNIVERSAL__) \
20 )
21
22
23 #define USE_FONTDLG_GENERIC \
24 ( \
25 wxUSE_FONTDLG && \
26 ( defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) ) && \
27 !defined(__WXUNIVERSAL__) \
28 )
29
30 #define USE_DIRDLG_GENERIC 0
31
32 #define USE_MODAL_PRESENTATION 1
33
34 // Define a new application type
35 class MyApp: public wxApp
36 {
37 public:
38 bool OnInit();
39
40 wxFont m_canvasFont;
41 wxColour m_canvasTextColour;
42 };
43
44 // A custom modeless dialog
45 class MyModelessDialog : public wxDialog
46 {
47 public:
48 MyModelessDialog(wxWindow *parent);
49
50 void OnButton(wxCommandEvent& event);
51 void OnClose(wxCloseEvent& event);
52
53 private:
54 DECLARE_EVENT_TABLE()
55 };
56
57 // A custom modal dialog
58 class MyModalDialog : public wxDialog
59 {
60 public:
61 MyModalDialog(wxWindow *parent);
62
63 void OnButton(wxCommandEvent& event);
64
65 private:
66 wxButton *m_btnModal,
67 *m_btnModeless,
68 *m_btnDelete;
69
70 DECLARE_EVENT_TABLE()
71 };
72
73 // Define a new frame type
74 class MyFrame: public wxFrame
75 {
76 public:
77 MyFrame(wxWindow *parent, const wxString& title);
78
79 void MessageBox(wxCommandEvent& event);
80
81 #if wxUSE_COLOURDLG
82 void ChooseColour(wxCommandEvent& event);
83 #endif // wxUSE_COLOURDLG
84
85 #if wxUSE_FONTDLG
86 void ChooseFont(wxCommandEvent& event);
87 #endif // wxUSE_FONTDLG
88
89 #if wxUSE_LOG_DIALOG
90 void LogDialog(wxCommandEvent& event);
91 #endif // wxUSE_LOG_DIALOG
92
93 #if wxUSE_CHOICEDLG
94 void SingleChoice(wxCommandEvent& event);
95 void MultiChoice(wxCommandEvent& event);
96 #endif // wxUSE_CHOICEDLG
97
98 #if wxUSE_TEXTDLG
99 void TextEntry(wxCommandEvent& event);
100 void PasswordEntry(wxCommandEvent& event);
101 #endif // wxUSE_TEXTDLG
102
103 #if wxUSE_NUMBERDLG
104 void NumericEntry(wxCommandEvent& event);
105 #endif // wxUSE_NUMBERDLG
106
107 #if wxUSE_FILEDLG
108 void FileOpen(wxCommandEvent& event);
109 void FileOpen2(wxCommandEvent& event);
110 void FilesOpen(wxCommandEvent& event);
111 void FileSave(wxCommandEvent& event);
112 #endif // wxUSE_FILEDLG
113
114 #if wxUSE_DIRDLG
115 void DirChoose(wxCommandEvent& event);
116 void DirChooseNew(wxCommandEvent& event);
117 #endif // wxUSE_DIRDLG
118
119 #if USE_DIRDLG_GENERIC
120 void GenericDirChoose(wxCommandEvent& event);
121 #endif // USE_DIRDLG_GENERIC
122
123 #if wxUSE_STARTUP_TIPS
124 void ShowTip(wxCommandEvent& event);
125 #endif // wxUSE_STARTUP_TIPS
126
127 #if USE_MODAL_PRESENTATION
128 void ModalDlg(wxCommandEvent& event);
129 void ModelessDlg(wxCommandEvent& event);
130 #endif // USE_MODAL_PRESENTATION
131
132 #if wxUSE_PROGRESSDLG
133 void ShowProgress(wxCommandEvent& event);
134 #endif // wxUSE_PROGRESSDLG
135
136 #if wxUSE_BUSYINFO
137 void ShowBusyInfo(wxCommandEvent& event);
138 #endif // wxUSE_BUSYINFO
139
140 #if wxUSE_FINDREPLDLG
141 void ShowFindDialog(wxCommandEvent& event);
142 void ShowReplaceDialog(wxCommandEvent& event);
143 void OnFindDialog(wxFindDialogEvent& event);
144 #endif // wxUSE_FINDREPLDLG
145
146 #if USE_COLOURDLG_GENERIC
147 void ChooseColourGeneric(wxCommandEvent& event);
148 #endif // USE_COLOURDLG_GENERIC
149
150 #if USE_FONTDLG_GENERIC
151 void ChooseFontGeneric(wxCommandEvent& event);
152 #endif // USE_FONTDLG_GENERIC
153
154 void OnExit(wxCommandEvent& event);
155
156 private:
157 #if wxUSE_DIRDLG
158 void DoDirChoose(int style);
159 #endif // wxUSE_DIRDLG
160
161 #if USE_MODAL_PRESENTATION
162 MyModelessDialog *m_dialog;
163 #endif // USE_MODAL_PRESENTATION
164
165 #if wxUSE_FINDREPLDLG
166 wxFindReplaceData m_findData;
167
168 wxFindReplaceDialog *m_dlgFind,
169 *m_dlgReplace;
170 #endif // wxUSE_FINDREPLDLG
171
172 wxColourData m_clrData;
173
174 DECLARE_EVENT_TABLE()
175 };
176
177 class MyCanvas: public wxScrolledWindow
178 {
179 public:
180 MyCanvas(wxWindow *parent) :
181 wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_FULL_REPAINT_ON_RESIZE) { }
182
183 void OnPaint(wxPaintEvent& event);
184
185 DECLARE_EVENT_TABLE()
186 };
187
188
189 // Menu IDs
190 enum
191 {
192 DIALOGS_CHOOSE_COLOUR = wxID_HIGHEST,
193 DIALOGS_CHOOSE_COLOUR_GENERIC,
194 DIALOGS_CHOOSE_FONT,
195 DIALOGS_CHOOSE_FONT_GENERIC,
196 DIALOGS_MESSAGE_BOX,
197 DIALOGS_SINGLE_CHOICE,
198 DIALOGS_MULTI_CHOICE,
199 DIALOGS_TEXT_ENTRY,
200 DIALOGS_PASSWORD_ENTRY,
201 DIALOGS_FILE_OPEN,
202 DIALOGS_FILE_OPEN2,
203 DIALOGS_FILES_OPEN,
204 DIALOGS_FILE_SAVE,
205 DIALOGS_DIR_CHOOSE,
206 DIALOGS_DIRNEW_CHOOSE,
207 DIALOGS_GENERIC_DIR_CHOOSE,
208 DIALOGS_TIP,
209 DIALOGS_NUM_ENTRY,
210 DIALOGS_LOG_DIALOG,
211 DIALOGS_MODAL,
212 DIALOGS_MODELESS,
213 DIALOGS_MODELESS_BTN,
214 DIALOGS_PROGRESS,
215 DIALOGS_BUSYINFO,
216 DIALOGS_FIND,
217 DIALOGS_REPLACE
218 };
219
220 #endif
221