1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common dialogs demo
4 // Author: Julian Smart
5 // Modified by: ABX (2004) - adjustementd for conditional building
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
15 #ifdef __WXUNIVERSAL__
16 #define USE_WXUNIVERSAL 1
18 #define USE_WXUNIVERSAL 0
21 #if defined(__WXMSW__) && !defined(__WXWINCE__)
45 #define USE_COLOURDLG_GENERIC \
48 ( USE_WXMSW || USE_WXMAC ) && \
53 #define USE_DIRDLG_GENERIC \
56 ( USE_WXMSW || USE_WXMAC ) && \
60 #define USE_FILEDLG_GENERIC \
63 ( USE_WXMSW || USE_WXMAC || USE_WXPM ) && \
67 #define USE_FONTDLG_GENERIC \
70 ( USE_WXMSW || USE_WXPM ) && \
75 #define USE_MODAL_PRESENTATION \
83 // Define a new application type
84 class MyApp
: public wxApp
90 wxColour m_canvasTextColour
;
93 #if USE_MODAL_PRESENTATION
95 // A custom modeless dialog
96 class MyModelessDialog
: public wxDialog
99 MyModelessDialog(wxWindow
*parent
);
101 void OnButton(wxCommandEvent
& event
);
102 void OnClose(wxCloseEvent
& event
);
105 DECLARE_EVENT_TABLE()
108 // A custom modal dialog
109 class MyModalDialog
: public wxDialog
112 MyModalDialog(wxWindow
*parent
);
114 void OnButton(wxCommandEvent
& event
);
117 wxButton
*m_btnModal
,
121 DECLARE_EVENT_TABLE()
124 #endif // USE_MODAL_PRESENTATION
126 // Define a new frame type
127 class MyFrame
: public wxFrame
130 MyFrame(wxWindow
*parent
, const wxString
& title
);
132 void MessageBox(wxCommandEvent
& event
);
135 void ChooseColour(wxCommandEvent
& event
);
136 #endif // wxUSE_COLOURDLG
139 void ChooseFont(wxCommandEvent
& event
);
140 #endif // wxUSE_FONTDLG
143 void LogDialog(wxCommandEvent
& event
);
144 #endif // wxUSE_LOG_DIALOG
147 void SingleChoice(wxCommandEvent
& event
);
148 void MultiChoice(wxCommandEvent
& event
);
149 #endif // wxUSE_CHOICEDLG
152 void TextEntry(wxCommandEvent
& event
);
153 void PasswordEntry(wxCommandEvent
& event
);
154 #endif // wxUSE_TEXTDLG
157 void NumericEntry(wxCommandEvent
& event
);
158 #endif // wxUSE_NUMBERDLG
161 void FileOpen(wxCommandEvent
& event
);
162 void FileOpen2(wxCommandEvent
& event
);
163 void FilesOpen(wxCommandEvent
& event
);
164 void FileSave(wxCommandEvent
& event
);
165 #endif // wxUSE_FILEDLG
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
174 void DirChoose(wxCommandEvent
& event
);
175 void DirChooseNew(wxCommandEvent
& event
);
176 #endif // wxUSE_DIRDLG
178 #if USE_DIRDLG_GENERIC
179 void GenericDirChoose(wxCommandEvent
& event
);
180 #endif // USE_DIRDLG_GENERIC
182 #if wxUSE_STARTUP_TIPS
183 void ShowTip(wxCommandEvent
& event
);
184 #endif // wxUSE_STARTUP_TIPS
186 #if USE_MODAL_PRESENTATION
187 void ModalDlg(wxCommandEvent
& event
);
188 void ModelessDlg(wxCommandEvent
& event
);
189 #endif // USE_MODAL_PRESENTATION
191 #if wxUSE_PROGRESSDLG
192 void ShowProgress(wxCommandEvent
& event
);
193 #endif // wxUSE_PROGRESSDLG
196 void ShowBusyInfo(wxCommandEvent
& event
);
197 #endif // wxUSE_BUSYINFO
199 #if wxUSE_FINDREPLDLG
200 void ShowFindDialog(wxCommandEvent
& event
);
201 void ShowReplaceDialog(wxCommandEvent
& event
);
202 void OnFindDialog(wxFindDialogEvent
& event
);
203 #endif // wxUSE_FINDREPLDLG
205 #if USE_COLOURDLG_GENERIC
206 void ChooseColourGeneric(wxCommandEvent
& event
);
207 #endif // USE_COLOURDLG_GENERIC
209 #if USE_FONTDLG_GENERIC
210 void ChooseFontGeneric(wxCommandEvent
& event
);
211 #endif // USE_FONTDLG_GENERIC
213 void OnExit(wxCommandEvent
& event
);
217 void DoDirChoose(int style
);
218 #endif // wxUSE_DIRDLG
220 #if USE_MODAL_PRESENTATION
221 MyModelessDialog
*m_dialog
;
222 #endif // USE_MODAL_PRESENTATION
224 #if wxUSE_FINDREPLDLG
225 wxFindReplaceData m_findData
;
227 wxFindReplaceDialog
*m_dlgFind
,
229 #endif // wxUSE_FINDREPLDLG
231 wxColourData m_clrData
;
233 DECLARE_EVENT_TABLE()
236 class MyCanvas
: public wxScrolledWindow
239 MyCanvas(wxWindow
*parent
) :
240 wxScrolledWindow(parent
,wxID_ANY
,wxDefaultPosition
,wxDefaultSize
,wxNO_FULL_REPAINT_ON_RESIZE
) { }
242 void OnPaint(wxPaintEvent
& event
);
244 DECLARE_EVENT_TABLE()
251 DIALOGS_CHOOSE_COLOUR
= wxID_HIGHEST
,
252 DIALOGS_CHOOSE_COLOUR_GENERIC
,
254 DIALOGS_CHOOSE_FONT_GENERIC
,
256 DIALOGS_SINGLE_CHOICE
,
257 DIALOGS_MULTI_CHOICE
,
259 DIALOGS_PASSWORD_ENTRY
,
264 DIALOGS_FILE_OPEN_GENERIC
,
265 DIALOGS_FILES_OPEN_GENERIC
,
266 DIALOGS_FILE_SAVE_GENERIC
,
268 DIALOGS_DIRNEW_CHOOSE
,
269 DIALOGS_GENERIC_DIR_CHOOSE
,
275 DIALOGS_MODELESS_BTN
,