1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common dialogs demo
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
15 // Define a new application type
16 class MyApp
: public wxApp
22 wxColour m_canvasTextColour
;
25 // A custom modeless dialog
26 class MyModelessDialog
: public wxDialog
29 MyModelessDialog(wxWindow
*parent
);
31 void OnButton(wxCommandEvent
& event
);
32 void OnClose(wxCloseEvent
& event
);
38 // A custom modal dialog
39 class MyModalDialog
: public wxDialog
42 MyModalDialog(wxWindow
*parent
);
44 void OnButton(wxCommandEvent
& event
);
47 wxButton
*m_btnFocused
;
48 wxButton
*m_btnDelete
;
53 // Define a new frame type
54 class MyFrame
: public wxFrame
57 MyFrame(wxWindow
*parent
, const wxString
& title
,
58 const wxPoint
& pos
, const wxSize
& size
);
60 void ChooseColour(wxCommandEvent
& event
);
61 void ChooseFont(wxCommandEvent
& event
);
62 void LogDialog(wxCommandEvent
& event
);
63 void MessageBox(wxCommandEvent
& event
);
64 void SingleChoice(wxCommandEvent
& event
);
65 void MultiChoice(wxCommandEvent
& event
);
66 void TextEntry(wxCommandEvent
& event
);
67 void PasswordEntry(wxCommandEvent
& event
);
68 void NumericEntry(wxCommandEvent
& event
);
69 void FileOpen(wxCommandEvent
& event
);
70 void FileOpen2(wxCommandEvent
& event
);
71 void FilesOpen(wxCommandEvent
& event
);
72 void FileSave(wxCommandEvent
& event
);
73 void DirChoose(wxCommandEvent
& event
);
74 void GenericDirChoose(wxCommandEvent
& event
);
75 void ShowTip(wxCommandEvent
& event
);
76 void ModalDlg(wxCommandEvent
& event
);
77 void ModelessDlg(wxCommandEvent
& event
);
79 void ShowProgress(wxCommandEvent
& event
);
80 #endif // wxUSE_PROGRESSDLG
82 void ShowBusyInfo(wxCommandEvent
& event
);
83 #endif // wxUSE_BUSYINFO
85 void ShowFindDialog(wxCommandEvent
& event
);
86 void ShowReplaceDialog(wxCommandEvent
& event
);
88 void OnFindDialog(wxFindDialogEvent
& event
);
89 #endif // wxUSE_FINDREPLDLG
91 #if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW
92 void ChooseColourGeneric(wxCommandEvent
& event
);
93 void ChooseFontGeneric(wxCommandEvent
& event
);
96 void OnExit(wxCommandEvent
& event
);
99 MyModelessDialog
*m_dialog
;
101 #if wxUSE_FINDREPLDLG
102 wxFindReplaceData m_findData
;
104 wxFindReplaceDialog
*m_dlgFind
,
106 #endif // wxUSE_FINDREPLDLG
108 DECLARE_EVENT_TABLE()
111 class MyCanvas
: public wxScrolledWindow
114 MyCanvas(wxWindow
*parent
) :
115 wxScrolledWindow(parent
,-1,wxDefaultPosition
,wxDefaultSize
,wxNO_FULL_REPAINT_ON_RESIZE
) { }
117 void OnPaint(wxPaintEvent
& event
);
119 DECLARE_EVENT_TABLE()
126 DIALOGS_CHOOSE_COLOUR
= 1,
127 DIALOGS_CHOOSE_COLOUR_GENERIC
,
129 DIALOGS_CHOOSE_FONT_GENERIC
,
131 DIALOGS_SINGLE_CHOICE
,
132 DIALOGS_MULTI_CHOICE
,
134 DIALOGS_PASSWORD_ENTRY
,
140 DIALOGS_GENERIC_DIR_CHOOSE
,
146 DIALOGS_MODELESS_BTN
,