Generic dialogs not available in shared nonUniv builds due to their adjustement to...
[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 #ifdef __WXUNIVERSAL__
16 #define USE_WXUNIVERSAL 1
17 #else
18 #define USE_WXUNIVERSAL 0
19 #endif
20
21 #ifdef WXUSINGDLL
22 #define USE_DLL 1
23 #else
24 #define USE_DLL 0
25 #endif
26
27 #if defined(__WXMSW__) && !defined(__WXWINCE__)
28 #define USE_WXMSW 1
29 #else
30 #define USE_WXMSW 0
31 #endif
32
33 #ifdef __WXMAC__
34 #define USE_WXMAC 1
35 #else
36 #define USE_WXMAC 0
37 #endif
38
39 #ifdef __WXGTK__
40 #define USE_WXGTK 1
41 #else
42 #define USE_WXGTK 0
43 #endif
44
45 #ifdef __WXPM__
46 #define USE_WXPM 1
47 #else
48 #define USE_WXPM 0
49 #endif
50
51 #define USE_COLOURDLG_GENERIC \
52 ( \
53 wxUSE_COLOURDLG && \
54 ( USE_WXMSW || USE_WXMAC ) && \
55 !USE_WXUNIVERSAL && \
56 !USE_DLL \
57 )
58
59
60 #define USE_DIRDLG_GENERIC \
61 ( \
62 wxUSE_DIRDLG && \
63 ( USE_WXMSW || USE_WXMAC ) && \
64 !USE_WXUNIVERSAL && \
65 !USE_DLL \
66 )
67
68 #define USE_FILEDLG_GENERIC \
69 ( \
70 wxUSE_FILEDLG && \
71 ( USE_WXMSW || USE_WXMAC || USE_WXPM ) && \
72 !USE_WXUNIVERSAL && \
73 !USE_DLL \
74 )
75
76 #define USE_FONTDLG_GENERIC \
77 ( \
78 wxUSE_FONTDLG && \
79 ( USE_WXMSW || USE_WXPM ) && \
80 !USE_WXUNIVERSAL && \
81 !USE_DLL \
82 )
83
84
85 #define USE_MODAL_PRESENTATION \
86 ( \
87 USE_WXMSW || \
88 USE_WXMAC || \
89 USE_WXGTK || \
90 USE_WXPM \
91 )
92
93 // Define a new application type
94 class MyApp: public wxApp
95 {
96 public:
97 bool OnInit();
98
99 wxFont m_canvasFont;
100 wxColour m_canvasTextColour;
101 };
102
103 #if USE_MODAL_PRESENTATION
104
105 // A custom modeless dialog
106 class MyModelessDialog : public wxDialog
107 {
108 public:
109 MyModelessDialog(wxWindow *parent);
110
111 void OnButton(wxCommandEvent& event);
112 void OnClose(wxCloseEvent& event);
113
114 private:
115 DECLARE_EVENT_TABLE()
116 };
117
118 // A custom modal dialog
119 class MyModalDialog : public wxDialog
120 {
121 public:
122 MyModalDialog(wxWindow *parent);
123
124 void OnButton(wxCommandEvent& event);
125
126 private:
127 wxButton *m_btnModal,
128 *m_btnModeless,
129 *m_btnDelete;
130
131 DECLARE_EVENT_TABLE()
132 };
133
134 #endif // USE_MODAL_PRESENTATION
135
136 // Define a new frame type
137 class MyFrame: public wxFrame
138 {
139 public:
140 MyFrame(wxWindow *parent, const wxString& title);
141
142 void MessageBox(wxCommandEvent& event);
143
144 #if wxUSE_COLOURDLG
145 void ChooseColour(wxCommandEvent& event);
146 #endif // wxUSE_COLOURDLG
147
148 #if wxUSE_FONTDLG
149 void ChooseFont(wxCommandEvent& event);
150 #endif // wxUSE_FONTDLG
151
152 #if wxUSE_LOG_DIALOG
153 void LogDialog(wxCommandEvent& event);
154 #endif // wxUSE_LOG_DIALOG
155
156 #if wxUSE_CHOICEDLG
157 void SingleChoice(wxCommandEvent& event);
158 void MultiChoice(wxCommandEvent& event);
159 #endif // wxUSE_CHOICEDLG
160
161 #if wxUSE_TEXTDLG
162 void TextEntry(wxCommandEvent& event);
163 void PasswordEntry(wxCommandEvent& event);
164 #endif // wxUSE_TEXTDLG
165
166 #if wxUSE_NUMBERDLG
167 void NumericEntry(wxCommandEvent& event);
168 #endif // wxUSE_NUMBERDLG
169
170 #if wxUSE_FILEDLG
171 void FileOpen(wxCommandEvent& event);
172 void FileOpen2(wxCommandEvent& event);
173 void FilesOpen(wxCommandEvent& event);
174 void FileSave(wxCommandEvent& event);
175 #endif // wxUSE_FILEDLG
176
177 #if USE_FILEDLG_GENERIC
178 void FileOpenGeneric(wxCommandEvent& event);
179 void FilesOpenGeneric(wxCommandEvent& event);
180 void FileSaveGeneric(wxCommandEvent& event);
181 #endif // USE_FILEDLG_GENERIC
182
183 #if wxUSE_DIRDLG
184 void DirChoose(wxCommandEvent& event);
185 void DirChooseNew(wxCommandEvent& event);
186 #endif // wxUSE_DIRDLG
187
188 #if USE_DIRDLG_GENERIC
189 void GenericDirChoose(wxCommandEvent& event);
190 #endif // USE_DIRDLG_GENERIC
191
192 #if wxUSE_STARTUP_TIPS
193 void ShowTip(wxCommandEvent& event);
194 #endif // wxUSE_STARTUP_TIPS
195
196 #if USE_MODAL_PRESENTATION
197 void ModalDlg(wxCommandEvent& event);
198 void ModelessDlg(wxCommandEvent& event);
199 #endif // USE_MODAL_PRESENTATION
200
201 #if wxUSE_PROGRESSDLG
202 void ShowProgress(wxCommandEvent& event);
203 #endif // wxUSE_PROGRESSDLG
204
205 #if wxUSE_BUSYINFO
206 void ShowBusyInfo(wxCommandEvent& event);
207 #endif // wxUSE_BUSYINFO
208
209 #if wxUSE_FINDREPLDLG
210 void ShowFindDialog(wxCommandEvent& event);
211 void ShowReplaceDialog(wxCommandEvent& event);
212 void OnFindDialog(wxFindDialogEvent& event);
213 #endif // wxUSE_FINDREPLDLG
214
215 #if USE_COLOURDLG_GENERIC
216 void ChooseColourGeneric(wxCommandEvent& event);
217 #endif // USE_COLOURDLG_GENERIC
218
219 #if USE_FONTDLG_GENERIC
220 void ChooseFontGeneric(wxCommandEvent& event);
221 #endif // USE_FONTDLG_GENERIC
222
223 void OnExit(wxCommandEvent& event);
224
225 private:
226 #if wxUSE_DIRDLG
227 void DoDirChoose(int style);
228 #endif // wxUSE_DIRDLG
229
230 #if USE_MODAL_PRESENTATION
231 MyModelessDialog *m_dialog;
232 #endif // USE_MODAL_PRESENTATION
233
234 #if wxUSE_FINDREPLDLG
235 wxFindReplaceData m_findData;
236
237 wxFindReplaceDialog *m_dlgFind,
238 *m_dlgReplace;
239 #endif // wxUSE_FINDREPLDLG
240
241 wxColourData m_clrData;
242
243 DECLARE_EVENT_TABLE()
244 };
245
246 class MyCanvas: public wxScrolledWindow
247 {
248 public:
249 MyCanvas(wxWindow *parent) :
250 wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_FULL_REPAINT_ON_RESIZE) { }
251
252 void OnPaint(wxPaintEvent& event);
253
254 DECLARE_EVENT_TABLE()
255 };
256
257
258 // Menu IDs
259 enum
260 {
261 DIALOGS_CHOOSE_COLOUR = wxID_HIGHEST,
262 DIALOGS_CHOOSE_COLOUR_GENERIC,
263 DIALOGS_CHOOSE_FONT,
264 DIALOGS_CHOOSE_FONT_GENERIC,
265 DIALOGS_MESSAGE_BOX,
266 DIALOGS_SINGLE_CHOICE,
267 DIALOGS_MULTI_CHOICE,
268 DIALOGS_TEXT_ENTRY,
269 DIALOGS_PASSWORD_ENTRY,
270 DIALOGS_FILE_OPEN,
271 DIALOGS_FILE_OPEN2,
272 DIALOGS_FILES_OPEN,
273 DIALOGS_FILE_SAVE,
274 DIALOGS_FILE_OPEN_GENERIC,
275 DIALOGS_FILES_OPEN_GENERIC,
276 DIALOGS_FILE_SAVE_GENERIC,
277 DIALOGS_DIR_CHOOSE,
278 DIALOGS_DIRNEW_CHOOSE,
279 DIALOGS_GENERIC_DIR_CHOOSE,
280 DIALOGS_TIP,
281 DIALOGS_NUM_ENTRY,
282 DIALOGS_LOG_DIALOG,
283 DIALOGS_MODAL,
284 DIALOGS_MODELESS,
285 DIALOGS_MODELESS_BTN,
286 DIALOGS_PROGRESS,
287 DIALOGS_BUSYINFO,
288 DIALOGS_FIND,
289 DIALOGS_REPLACE
290 };
291
292 #endif
293