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