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