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_FONTDLG_GENERIC \
26 ( defined(__WXMSW__) || defined(__WXPM__) ) && \
27 !defined(__WXUNIVERSAL__) \
30 #define USE_DIRDLG_GENERIC \
33 ( defined(__WXMSW__) || defined(__WXMAC__) ) && \
34 !defined(__WXUNIVERSAL__) \
38 #define USE_MODAL_PRESENTATION 1
40 // Define a new application type
41 class MyApp
: public wxApp
47 wxColour m_canvasTextColour
;
50 // A custom modeless dialog
51 class MyModelessDialog
: public wxDialog
54 MyModelessDialog(wxWindow
*parent
);
56 void OnButton(wxCommandEvent
& event
);
57 void OnClose(wxCloseEvent
& event
);
63 // A custom modal dialog
64 class MyModalDialog
: public wxDialog
67 MyModalDialog(wxWindow
*parent
);
69 void OnButton(wxCommandEvent
& event
);
79 // Define a new frame type
80 class MyFrame
: public wxFrame
83 MyFrame(wxWindow
*parent
, const wxString
& title
);
85 void MessageBox(wxCommandEvent
& event
);
88 void ChooseColour(wxCommandEvent
& event
);
89 #endif // wxUSE_COLOURDLG
92 void ChooseFont(wxCommandEvent
& event
);
93 #endif // wxUSE_FONTDLG
96 void LogDialog(wxCommandEvent
& event
);
97 #endif // wxUSE_LOG_DIALOG
100 void SingleChoice(wxCommandEvent
& event
);
101 void MultiChoice(wxCommandEvent
& event
);
102 #endif // wxUSE_CHOICEDLG
105 void TextEntry(wxCommandEvent
& event
);
106 void PasswordEntry(wxCommandEvent
& event
);
107 #endif // wxUSE_TEXTDLG
110 void NumericEntry(wxCommandEvent
& event
);
111 #endif // wxUSE_NUMBERDLG
114 void FileOpen(wxCommandEvent
& event
);
115 void FileOpen2(wxCommandEvent
& event
);
116 void FilesOpen(wxCommandEvent
& event
);
117 void FileSave(wxCommandEvent
& event
);
118 #endif // wxUSE_FILEDLG
121 void DirChoose(wxCommandEvent
& event
);
122 void DirChooseNew(wxCommandEvent
& event
);
123 #endif // wxUSE_DIRDLG
125 #if USE_DIRDLG_GENERIC
126 void GenericDirChoose(wxCommandEvent
& event
);
127 #endif // USE_DIRDLG_GENERIC
129 #if wxUSE_STARTUP_TIPS
130 void ShowTip(wxCommandEvent
& event
);
131 #endif // wxUSE_STARTUP_TIPS
133 #if USE_MODAL_PRESENTATION
134 void ModalDlg(wxCommandEvent
& event
);
135 void ModelessDlg(wxCommandEvent
& event
);
136 #endif // USE_MODAL_PRESENTATION
138 #if wxUSE_PROGRESSDLG
139 void ShowProgress(wxCommandEvent
& event
);
140 #endif // wxUSE_PROGRESSDLG
143 void ShowBusyInfo(wxCommandEvent
& event
);
144 #endif // wxUSE_BUSYINFO
146 #if wxUSE_FINDREPLDLG
147 void ShowFindDialog(wxCommandEvent
& event
);
148 void ShowReplaceDialog(wxCommandEvent
& event
);
149 void OnFindDialog(wxFindDialogEvent
& event
);
150 #endif // wxUSE_FINDREPLDLG
152 #if USE_COLOURDLG_GENERIC
153 void ChooseColourGeneric(wxCommandEvent
& event
);
154 #endif // USE_COLOURDLG_GENERIC
156 #if USE_FONTDLG_GENERIC
157 void ChooseFontGeneric(wxCommandEvent
& event
);
158 #endif // USE_FONTDLG_GENERIC
160 void OnExit(wxCommandEvent
& event
);
164 void DoDirChoose(int style
);
165 #endif // wxUSE_DIRDLG
167 #if USE_MODAL_PRESENTATION
168 MyModelessDialog
*m_dialog
;
169 #endif // USE_MODAL_PRESENTATION
171 #if wxUSE_FINDREPLDLG
172 wxFindReplaceData m_findData
;
174 wxFindReplaceDialog
*m_dlgFind
,
176 #endif // wxUSE_FINDREPLDLG
178 wxColourData m_clrData
;
180 DECLARE_EVENT_TABLE()
183 class MyCanvas
: public wxScrolledWindow
186 MyCanvas(wxWindow
*parent
) :
187 wxScrolledWindow(parent
,wxID_ANY
,wxDefaultPosition
,wxDefaultSize
,wxNO_FULL_REPAINT_ON_RESIZE
) { }
189 void OnPaint(wxPaintEvent
& event
);
191 DECLARE_EVENT_TABLE()
198 DIALOGS_CHOOSE_COLOUR
= wxID_HIGHEST
,
199 DIALOGS_CHOOSE_COLOUR_GENERIC
,
201 DIALOGS_CHOOSE_FONT_GENERIC
,
203 DIALOGS_SINGLE_CHOICE
,
204 DIALOGS_MULTI_CHOICE
,
206 DIALOGS_PASSWORD_ENTRY
,
212 DIALOGS_DIRNEW_CHOOSE
,
213 DIALOGS_GENERIC_DIR_CHOOSE
,
219 DIALOGS_MODELESS_BTN
,