]>
Commit | Line | Data |
---|---|---|
457814b5 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialogs.h | |
3 | // Purpose: Common dialogs demo | |
4 | // Author: Julian Smart | |
13188def | 5 | // Modified by: ABX (2004) - adjustementd for conditional building |
457814b5 JS |
6 | // Created: 04/01/98 |
7 | // RCS-ID: $Id$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
c49245f8 | 9 | // Licence: wxWindows license |
457814b5 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __DIALOGSH__ | |
13 | #define __DIALOGSH__ | |
14 | ||
da7a8602 WS |
15 | #ifdef __WXUNIVERSAL__ |
16 | #define USE_WXUNIVERSAL 1 | |
17 | #else | |
18 | #define USE_WXUNIVERSAL 0 | |
19 | #endif | |
20 | ||
b6352c09 | 21 | #if defined(__WXMSW__) && !defined(__WXWINCE__) |
da7a8602 WS |
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 \ | |
13188def WS |
50 | ) |
51 | ||
52 | ||
da7a8602 WS |
53 | #define USE_DIRDLG_GENERIC \ |
54 | ( \ | |
55 | wxUSE_DIRDLG && \ | |
56 | ( USE_WXMSW || USE_WXMAC ) && \ | |
57 | !USE_WXUNIVERSAL \ | |
63c83961 WS |
58 | ) |
59 | ||
da7a8602 WS |
60 | #define USE_FILEDLG_GENERIC \ |
61 | ( \ | |
62 | wxUSE_FILEDLG && \ | |
63 | ( USE_WXMSW || USE_WXMAC || USE_WXPM ) && \ | |
64 | !USE_WXUNIVERSAL \ | |
695fe764 WS |
65 | ) |
66 | ||
da7a8602 WS |
67 | #define USE_FONTDLG_GENERIC \ |
68 | ( \ | |
69 | wxUSE_FONTDLG && \ | |
70 | ( USE_WXMSW || USE_WXPM ) && \ | |
71 | !USE_WXUNIVERSAL \ | |
13188def WS |
72 | ) |
73 | ||
13188def | 74 | |
da7a8602 WS |
75 | #define USE_MODAL_PRESENTATION \ |
76 | ( \ | |
77 | USE_WXMSW || \ | |
78 | USE_WXMAC || \ | |
79 | USE_WXGTK || \ | |
80 | USE_WXPM \ | |
6c1035d3 | 81 | ) |
13188def | 82 | |
457814b5 JS |
83 | // Define a new application type |
84 | class MyApp: public wxApp | |
c49245f8 VZ |
85 | { |
86 | public: | |
87 | bool OnInit(); | |
457814b5 JS |
88 | |
89 | wxFont m_canvasFont; | |
90 | wxColour m_canvasTextColour; | |
91 | }; | |
92 | ||
b4954d19 WS |
93 | #if USE_MODAL_PRESENTATION |
94 | ||
f6bcfd97 | 95 | // A custom modeless dialog |
4c45f240 VZ |
96 | class MyModelessDialog : public wxDialog |
97 | { | |
98 | public: | |
99 | MyModelessDialog(wxWindow *parent); | |
abceee76 | 100 | |
5d987909 | 101 | void OnButton(wxCommandEvent& event); |
abceee76 VZ |
102 | void OnClose(wxCloseEvent& event); |
103 | ||
104 | private: | |
105 | DECLARE_EVENT_TABLE() | |
4c45f240 VZ |
106 | }; |
107 | ||
f6bcfd97 BP |
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: | |
5315ebfa VZ |
117 | wxButton *m_btnModal, |
118 | *m_btnModeless, | |
119 | *m_btnDelete; | |
f6bcfd97 BP |
120 | |
121 | DECLARE_EVENT_TABLE() | |
122 | }; | |
123 | ||
b4954d19 WS |
124 | #endif // USE_MODAL_PRESENTATION |
125 | ||
457814b5 JS |
126 | // Define a new frame type |
127 | class MyFrame: public wxFrame | |
c49245f8 VZ |
128 | { |
129 | public: | |
13188def WS |
130 | MyFrame(wxWindow *parent, const wxString& title); |
131 | ||
132 | void MessageBox(wxCommandEvent& event); | |
457814b5 | 133 | |
13188def | 134 | #if wxUSE_COLOURDLG |
329e86bf | 135 | void ChooseColour(wxCommandEvent& event); |
13188def WS |
136 | #endif // wxUSE_COLOURDLG |
137 | ||
138 | #if wxUSE_FONTDLG | |
329e86bf | 139 | void ChooseFont(wxCommandEvent& event); |
13188def WS |
140 | #endif // wxUSE_FONTDLG |
141 | ||
142 | #if wxUSE_LOG_DIALOG | |
d93c719a | 143 | void LogDialog(wxCommandEvent& event); |
13188def WS |
144 | #endif // wxUSE_LOG_DIALOG |
145 | ||
146 | #if wxUSE_CHOICEDLG | |
457814b5 | 147 | void SingleChoice(wxCommandEvent& event); |
d6c9c1b7 | 148 | void MultiChoice(wxCommandEvent& event); |
13188def WS |
149 | #endif // wxUSE_CHOICEDLG |
150 | ||
151 | #if wxUSE_TEXTDLG | |
457814b5 | 152 | void TextEntry(wxCommandEvent& event); |
a294c6d5 | 153 | void PasswordEntry(wxCommandEvent& event); |
13188def WS |
154 | #endif // wxUSE_TEXTDLG |
155 | ||
156 | #if wxUSE_NUMBERDLG | |
c49245f8 | 157 | void NumericEntry(wxCommandEvent& event); |
13188def WS |
158 | #endif // wxUSE_NUMBERDLG |
159 | ||
160 | #if wxUSE_FILEDLG | |
457814b5 | 161 | void FileOpen(wxCommandEvent& event); |
35b45b33 | 162 | void FileOpen2(wxCommandEvent& event); |
c61f4f6d | 163 | void FilesOpen(wxCommandEvent& event); |
457814b5 | 164 | void FileSave(wxCommandEvent& event); |
13188def WS |
165 | #endif // wxUSE_FILEDLG |
166 | ||
695fe764 WS |
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 | ||
13188def | 173 | #if wxUSE_DIRDLG |
457814b5 | 174 | void DirChoose(wxCommandEvent& event); |
f09c8393 | 175 | void DirChooseNew(wxCommandEvent& event); |
13188def WS |
176 | #endif // wxUSE_DIRDLG |
177 | ||
178 | #if USE_DIRDLG_GENERIC | |
51a58d8b | 179 | void GenericDirChoose(wxCommandEvent& event); |
13188def WS |
180 | #endif // USE_DIRDLG_GENERIC |
181 | ||
182 | #if wxUSE_STARTUP_TIPS | |
c50f1fb9 | 183 | void ShowTip(wxCommandEvent& event); |
13188def WS |
184 | #endif // wxUSE_STARTUP_TIPS |
185 | ||
186 | #if USE_MODAL_PRESENTATION | |
f6bcfd97 | 187 | void ModalDlg(wxCommandEvent& event); |
4c45f240 | 188 | void ModelessDlg(wxCommandEvent& event); |
13188def WS |
189 | #endif // USE_MODAL_PRESENTATION |
190 | ||
761989ff | 191 | #if wxUSE_PROGRESSDLG |
abceee76 | 192 | void ShowProgress(wxCommandEvent& event); |
761989ff | 193 | #endif // wxUSE_PROGRESSDLG |
13188def | 194 | |
a62b0bcc VZ |
195 | #if wxUSE_BUSYINFO |
196 | void ShowBusyInfo(wxCommandEvent& event); | |
197 | #endif // wxUSE_BUSYINFO | |
13188def | 198 | |
761989ff VZ |
199 | #if wxUSE_FINDREPLDLG |
200 | void ShowFindDialog(wxCommandEvent& event); | |
201 | void ShowReplaceDialog(wxCommandEvent& event); | |
761989ff VZ |
202 | void OnFindDialog(wxFindDialogEvent& event); |
203 | #endif // wxUSE_FINDREPLDLG | |
457814b5 | 204 | |
13188def | 205 | #if USE_COLOURDLG_GENERIC |
329e86bf | 206 | void ChooseColourGeneric(wxCommandEvent& event); |
13188def WS |
207 | #endif // USE_COLOURDLG_GENERIC |
208 | ||
209 | #if USE_FONTDLG_GENERIC | |
329e86bf | 210 | void ChooseFontGeneric(wxCommandEvent& event); |
13188def | 211 | #endif // USE_FONTDLG_GENERIC |
c49245f8 | 212 | |
329e86bf | 213 | void OnExit(wxCommandEvent& event); |
c49245f8 | 214 | |
4c45f240 | 215 | private: |
13188def | 216 | #if wxUSE_DIRDLG |
f09c8393 | 217 | void DoDirChoose(int style); |
13188def | 218 | #endif // wxUSE_DIRDLG |
f09c8393 | 219 | |
13188def | 220 | #if USE_MODAL_PRESENTATION |
4c45f240 | 221 | MyModelessDialog *m_dialog; |
13188def | 222 | #endif // USE_MODAL_PRESENTATION |
4c45f240 | 223 | |
761989ff VZ |
224 | #if wxUSE_FINDREPLDLG |
225 | wxFindReplaceData m_findData; | |
14fca738 VZ |
226 | |
227 | wxFindReplaceDialog *m_dlgFind, | |
228 | *m_dlgReplace; | |
761989ff VZ |
229 | #endif // wxUSE_FINDREPLDLG |
230 | ||
d33dd9ef VS |
231 | wxColourData m_clrData; |
232 | ||
4c45f240 | 233 | DECLARE_EVENT_TABLE() |
457814b5 JS |
234 | }; |
235 | ||
236 | class MyCanvas: public wxScrolledWindow | |
237 | { | |
c49245f8 | 238 | public: |
c2c0dabf | 239 | MyCanvas(wxWindow *parent) : |
13188def | 240 | wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_FULL_REPAINT_ON_RESIZE) { } |
c49245f8 VZ |
241 | |
242 | void OnPaint(wxPaintEvent& event); | |
243 | ||
244 | DECLARE_EVENT_TABLE() | |
457814b5 JS |
245 | }; |
246 | ||
247 | ||
248 | // Menu IDs | |
a294c6d5 VZ |
249 | enum |
250 | { | |
13188def | 251 | DIALOGS_CHOOSE_COLOUR = wxID_HIGHEST, |
a294c6d5 VZ |
252 | DIALOGS_CHOOSE_COLOUR_GENERIC, |
253 | DIALOGS_CHOOSE_FONT, | |
254 | DIALOGS_CHOOSE_FONT_GENERIC, | |
255 | DIALOGS_MESSAGE_BOX, | |
256 | DIALOGS_SINGLE_CHOICE, | |
d6c9c1b7 | 257 | DIALOGS_MULTI_CHOICE, |
a294c6d5 VZ |
258 | DIALOGS_TEXT_ENTRY, |
259 | DIALOGS_PASSWORD_ENTRY, | |
260 | DIALOGS_FILE_OPEN, | |
35b45b33 | 261 | DIALOGS_FILE_OPEN2, |
a294c6d5 VZ |
262 | DIALOGS_FILES_OPEN, |
263 | DIALOGS_FILE_SAVE, | |
695fe764 WS |
264 | DIALOGS_FILE_OPEN_GENERIC, |
265 | DIALOGS_FILES_OPEN_GENERIC, | |
266 | DIALOGS_FILE_SAVE_GENERIC, | |
a294c6d5 | 267 | DIALOGS_DIR_CHOOSE, |
f09c8393 | 268 | DIALOGS_DIRNEW_CHOOSE, |
51a58d8b | 269 | DIALOGS_GENERIC_DIR_CHOOSE, |
a294c6d5 VZ |
270 | DIALOGS_TIP, |
271 | DIALOGS_NUM_ENTRY, | |
4c45f240 | 272 | DIALOGS_LOG_DIALOG, |
f6bcfd97 | 273 | DIALOGS_MODAL, |
4c45f240 | 274 | DIALOGS_MODELESS, |
abceee76 | 275 | DIALOGS_MODELESS_BTN, |
761989ff | 276 | DIALOGS_PROGRESS, |
a62b0bcc | 277 | DIALOGS_BUSYINFO, |
761989ff VZ |
278 | DIALOGS_FIND, |
279 | DIALOGS_REPLACE | |
a294c6d5 | 280 | }; |
457814b5 JS |
281 | |
282 | #endif | |
283 |