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