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 #define USE_COLOURDLG_GENERIC \
18 ( defined(__WXMSW__) || defined(__WXMAC__) ) && \
19 !defined(__WXUNIVERSAL__) \
23 #define USE_DIRDLG_GENERIC \
26 ( defined(__WXMSW__) || defined(__WXMAC__) ) && \
27 !defined(__WXUNIVERSAL__) \
30 #define USE_FILEDLG_GENERIC \
33 ( defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXPM__) ) && \
34 !defined(__WXUNIVERSAL__) \
37 #define USE_FONTDLG_GENERIC \
40 ( defined(__WXMSW__) || defined(__WXPM__) ) && \
41 !defined(__WXUNIVERSAL__) \
45 #define USE_MODAL_PRESENTATION 1
47 // Define a new application type
48 class MyApp
: public wxApp
54 wxColour m_canvasTextColour
;
57 #if USE_MODAL_PRESENTATION
59 // A custom modeless dialog
60 class MyModelessDialog
: public wxDialog
63 MyModelessDialog(wxWindow
*parent
);
65 void OnButton(wxCommandEvent
& event
);
66 void OnClose(wxCloseEvent
& event
);
72 // A custom modal dialog
73 class MyModalDialog
: public wxDialog
76 MyModalDialog(wxWindow
*parent
);
78 void OnButton(wxCommandEvent
& event
);
88 #endif // USE_MODAL_PRESENTATION
90 // Define a new frame type
91 class MyFrame
: public wxFrame
94 MyFrame(wxWindow
*parent
, const wxString
& title
);
96 void MessageBox(wxCommandEvent
& event
);
99 void ChooseColour(wxCommandEvent
& event
);
100 #endif // wxUSE_COLOURDLG
103 void ChooseFont(wxCommandEvent
& event
);
104 #endif // wxUSE_FONTDLG
107 void LogDialog(wxCommandEvent
& event
);
108 #endif // wxUSE_LOG_DIALOG
111 void SingleChoice(wxCommandEvent
& event
);
112 void MultiChoice(wxCommandEvent
& event
);
113 #endif // wxUSE_CHOICEDLG
116 void TextEntry(wxCommandEvent
& event
);
117 void PasswordEntry(wxCommandEvent
& event
);
118 #endif // wxUSE_TEXTDLG
121 void NumericEntry(wxCommandEvent
& event
);
122 #endif // wxUSE_NUMBERDLG
125 void FileOpen(wxCommandEvent
& event
);
126 void FileOpen2(wxCommandEvent
& event
);
127 void FilesOpen(wxCommandEvent
& event
);
128 void FileSave(wxCommandEvent
& event
);
129 #endif // wxUSE_FILEDLG
131 #if USE_FILEDLG_GENERIC
132 void FileOpenGeneric(wxCommandEvent
& event
);
133 void FilesOpenGeneric(wxCommandEvent
& event
);
134 void FileSaveGeneric(wxCommandEvent
& event
);
135 #endif // USE_FILEDLG_GENERIC
138 void DirChoose(wxCommandEvent
& event
);
139 void DirChooseNew(wxCommandEvent
& event
);
140 #endif // wxUSE_DIRDLG
142 #if USE_DIRDLG_GENERIC
143 void GenericDirChoose(wxCommandEvent
& event
);
144 #endif // USE_DIRDLG_GENERIC
146 #if wxUSE_STARTUP_TIPS
147 void ShowTip(wxCommandEvent
& event
);
148 #endif // wxUSE_STARTUP_TIPS
150 #if USE_MODAL_PRESENTATION
151 void ModalDlg(wxCommandEvent
& event
);
152 void ModelessDlg(wxCommandEvent
& event
);
153 #endif // USE_MODAL_PRESENTATION
155 #if wxUSE_PROGRESSDLG
156 void ShowProgress(wxCommandEvent
& event
);
157 #endif // wxUSE_PROGRESSDLG
160 void ShowBusyInfo(wxCommandEvent
& event
);
161 #endif // wxUSE_BUSYINFO
163 #if wxUSE_FINDREPLDLG
164 void ShowFindDialog(wxCommandEvent
& event
);
165 void ShowReplaceDialog(wxCommandEvent
& event
);
166 void OnFindDialog(wxFindDialogEvent
& event
);
167 #endif // wxUSE_FINDREPLDLG
169 #if USE_COLOURDLG_GENERIC
170 void ChooseColourGeneric(wxCommandEvent
& event
);
171 #endif // USE_COLOURDLG_GENERIC
173 #if USE_FONTDLG_GENERIC
174 void ChooseFontGeneric(wxCommandEvent
& event
);
175 #endif // USE_FONTDLG_GENERIC
177 void OnExit(wxCommandEvent
& event
);
181 void DoDirChoose(int style
);
182 #endif // wxUSE_DIRDLG
184 #if USE_MODAL_PRESENTATION
185 MyModelessDialog
*m_dialog
;
186 #endif // USE_MODAL_PRESENTATION
188 #if wxUSE_FINDREPLDLG
189 wxFindReplaceData m_findData
;
191 wxFindReplaceDialog
*m_dlgFind
,
193 #endif // wxUSE_FINDREPLDLG
195 wxColourData m_clrData
;
197 DECLARE_EVENT_TABLE()
200 class MyCanvas
: public wxScrolledWindow
203 MyCanvas(wxWindow
*parent
) :
204 wxScrolledWindow(parent
,wxID_ANY
,wxDefaultPosition
,wxDefaultSize
,wxNO_FULL_REPAINT_ON_RESIZE
) { }
206 void OnPaint(wxPaintEvent
& event
);
208 DECLARE_EVENT_TABLE()
215 DIALOGS_CHOOSE_COLOUR
= wxID_HIGHEST
,
216 DIALOGS_CHOOSE_COLOUR_GENERIC
,
218 DIALOGS_CHOOSE_FONT_GENERIC
,
220 DIALOGS_SINGLE_CHOICE
,
221 DIALOGS_MULTI_CHOICE
,
223 DIALOGS_PASSWORD_ENTRY
,
228 DIALOGS_FILE_OPEN_GENERIC
,
229 DIALOGS_FILES_OPEN_GENERIC
,
230 DIALOGS_FILE_SAVE_GENERIC
,
232 DIALOGS_DIRNEW_CHOOSE
,
233 DIALOGS_GENERIC_DIR_CHOOSE
,
239 DIALOGS_MODELESS_BTN
,