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