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__) || defined(__WXGTK20__) ) &&   \ 
  19         !defined(__WXUNIVERSAL__)                                                 \ 
  23 #define USE_FONTDLG_GENERIC                                                       \ 
  26         ( defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) ) &&      \ 
  27         !defined(__WXUNIVERSAL__)                                                 \ 
  30 #define USE_DIRDLG_GENERIC       0 
  32 #define USE_MODAL_PRESENTATION   1 
  34 // Define a new application type 
  35 class MyApp
: public wxApp
 
  41     wxColour     m_canvasTextColour
; 
  44 // A custom modeless dialog 
  45 class MyModelessDialog 
: public wxDialog
 
  48     MyModelessDialog(wxWindow 
*parent
); 
  50     void OnButton(wxCommandEvent
& event
); 
  51     void OnClose(wxCloseEvent
& event
); 
  57 // A custom modal dialog 
  58 class MyModalDialog 
: public wxDialog
 
  61     MyModalDialog(wxWindow 
*parent
); 
  63     void OnButton(wxCommandEvent
& event
); 
  73 // Define a new frame type 
  74 class MyFrame
: public wxFrame
 
  77     MyFrame(wxWindow 
*parent
, const wxString
& title
); 
  79     void MessageBox(wxCommandEvent
& event
); 
  82     void ChooseColour(wxCommandEvent
& event
); 
  83 #endif // wxUSE_COLOURDLG 
  86     void ChooseFont(wxCommandEvent
& event
); 
  87 #endif // wxUSE_FONTDLG 
  90     void LogDialog(wxCommandEvent
& event
); 
  91 #endif // wxUSE_LOG_DIALOG 
  94     void SingleChoice(wxCommandEvent
& event
); 
  95     void MultiChoice(wxCommandEvent
& event
); 
  96 #endif // wxUSE_CHOICEDLG 
  99     void TextEntry(wxCommandEvent
& event
); 
 100     void PasswordEntry(wxCommandEvent
& event
); 
 101 #endif // wxUSE_TEXTDLG 
 104     void NumericEntry(wxCommandEvent
& event
); 
 105 #endif // wxUSE_NUMBERDLG 
 108     void FileOpen(wxCommandEvent
& event
); 
 109     void FileOpen2(wxCommandEvent
& event
); 
 110     void FilesOpen(wxCommandEvent
& event
); 
 111     void FileSave(wxCommandEvent
& event
); 
 112 #endif // wxUSE_FILEDLG 
 115     void DirChoose(wxCommandEvent
& event
); 
 116     void DirChooseNew(wxCommandEvent
& event
); 
 117 #endif // wxUSE_DIRDLG 
 119 #if USE_DIRDLG_GENERIC 
 120     void GenericDirChoose(wxCommandEvent
& event
); 
 121 #endif // USE_DIRDLG_GENERIC 
 123 #if wxUSE_STARTUP_TIPS 
 124     void ShowTip(wxCommandEvent
& event
); 
 125 #endif // wxUSE_STARTUP_TIPS 
 127 #if USE_MODAL_PRESENTATION 
 128     void ModalDlg(wxCommandEvent
& event
); 
 129     void ModelessDlg(wxCommandEvent
& event
); 
 130 #endif // USE_MODAL_PRESENTATION 
 132 #if wxUSE_PROGRESSDLG 
 133     void ShowProgress(wxCommandEvent
& event
); 
 134 #endif // wxUSE_PROGRESSDLG 
 137     void ShowBusyInfo(wxCommandEvent
& event
); 
 138 #endif // wxUSE_BUSYINFO 
 140 #if wxUSE_FINDREPLDLG 
 141     void ShowFindDialog(wxCommandEvent
& event
); 
 142     void ShowReplaceDialog(wxCommandEvent
& event
); 
 143     void OnFindDialog(wxFindDialogEvent
& event
); 
 144 #endif // wxUSE_FINDREPLDLG 
 146 #if USE_COLOURDLG_GENERIC 
 147     void ChooseColourGeneric(wxCommandEvent
& event
); 
 148 #endif // USE_COLOURDLG_GENERIC 
 150 #if USE_FONTDLG_GENERIC 
 151     void ChooseFontGeneric(wxCommandEvent
& event
); 
 152 #endif // USE_FONTDLG_GENERIC 
 154     void OnExit(wxCommandEvent
& event
); 
 158     void DoDirChoose(int style
); 
 159 #endif // wxUSE_DIRDLG 
 161 #if USE_MODAL_PRESENTATION 
 162     MyModelessDialog 
*m_dialog
; 
 163 #endif // USE_MODAL_PRESENTATION 
 165 #if wxUSE_FINDREPLDLG 
 166     wxFindReplaceData m_findData
; 
 168     wxFindReplaceDialog 
*m_dlgFind
, 
 170 #endif // wxUSE_FINDREPLDLG 
 172     wxColourData m_clrData
; 
 174     DECLARE_EVENT_TABLE() 
 177 class MyCanvas
: public wxScrolledWindow
 
 180     MyCanvas(wxWindow 
*parent
) :  
 181        wxScrolledWindow(parent
,wxID_ANY
,wxDefaultPosition
,wxDefaultSize
,wxNO_FULL_REPAINT_ON_RESIZE
) { } 
 183     void OnPaint(wxPaintEvent
& event
); 
 185     DECLARE_EVENT_TABLE() 
 192     DIALOGS_CHOOSE_COLOUR 
= wxID_HIGHEST
, 
 193     DIALOGS_CHOOSE_COLOUR_GENERIC
, 
 195     DIALOGS_CHOOSE_FONT_GENERIC
, 
 197     DIALOGS_SINGLE_CHOICE
, 
 198     DIALOGS_MULTI_CHOICE
, 
 200     DIALOGS_PASSWORD_ENTRY
, 
 206     DIALOGS_DIRNEW_CHOOSE
, 
 207     DIALOGS_GENERIC_DIR_CHOOSE
, 
 213     DIALOGS_MODELESS_BTN
,