1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common dialogs demo
4 // Author: Julian Smart
5 // Modified by: ABX (2004) - adjustements for conditional building + new menu
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(__APPLE__)
13 #pragma implementation
17 // For compilers that support precompilation, includes "wx/wx.h".
18 #include "wx/wxprec.h"
28 #include "../sample.xpm"
30 #include "wx/datetime.h"
34 #include "wx/colordlg.h"
35 #endif // wxUSE_COLOURDLG
38 #include "wx/choicdlg.h"
39 #endif // wxUSE_CHOICEDLG
41 #if wxUSE_STARTUP_TIPS
42 #include "wx/tipdlg.h"
43 #endif // wxUSE_STARTUP_TIPS
46 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
47 #include <wx/datetime.h> // wxDateTime
50 #include "wx/progdlg.h"
51 #endif // wxUSE_PROGRESSDLG
54 #include "wx/busyinfo.h"
55 #endif // wxUSE_BUSYINFO
58 #include "wx/numdlg.h"
59 #endif // wxUSE_NUMBERDLG
62 #include "wx/filedlg.h"
63 #endif // wxUSE_FILEDLG
66 #include "wx/dirdlg.h"
67 #endif // wxUSE_DIRDLG
70 #include "wx/fontdlg.h"
71 #endif // wxUSE_FONTDLG
74 #include "wx/fdrepdlg.h"
75 #endif // wxUSE_FINDREPLDLG
78 #include "wx/spinctrl.h"
81 #include "wx/propdlg.h"
85 #if USE_COLOURDLG_GENERIC
86 #include "wx/generic/colrdlgg.h"
87 #endif // USE_COLOURDLG_GENERIC
89 #if USE_DIRDLG_GENERIC
90 #include "wx/generic/dirdlgg.h"
91 #endif // USE_DIRDLG_GENERIC
93 #if USE_FILEDLG_GENERIC
94 #include "wx/generic/filedlgg.h"
95 #endif // USE_FILEDLG_GENERIC
97 #if USE_FONTDLG_GENERIC
98 #include "wx/generic/fontdlgg.h"
99 #endif // USE_FONTDLG_GENERIC
103 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
104 EVT_PAINT(MyCanvas::OnPaint
)
109 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
110 EVT_MENU(DIALOGS_MESSAGE_BOX
, MyFrame::MessageBox
)
113 EVT_MENU(DIALOGS_CHOOSE_COLOUR
, MyFrame::ChooseColour
)
114 #endif // wxUSE_COLOURDLG
117 EVT_MENU(DIALOGS_CHOOSE_FONT
, MyFrame::ChooseFont
)
118 #endif // wxUSE_FONTDLG
121 EVT_MENU(DIALOGS_LOG_DIALOG
, MyFrame::LogDialog
)
122 #endif // wxUSE_LOG_DIALOG
125 EVT_MENU(DIALOGS_TEXT_ENTRY
, MyFrame::TextEntry
)
126 EVT_MENU(DIALOGS_PASSWORD_ENTRY
, MyFrame::PasswordEntry
)
127 #endif // wxUSE_TEXTDLG
130 EVT_MENU(DIALOGS_NUM_ENTRY
, MyFrame::NumericEntry
)
131 #endif // wxUSE_NUMBERDLG
134 EVT_MENU(DIALOGS_SINGLE_CHOICE
, MyFrame::SingleChoice
)
135 EVT_MENU(DIALOGS_MULTI_CHOICE
, MyFrame::MultiChoice
)
136 #endif // wxUSE_CHOICEDLG
139 EVT_MENU(DIALOGS_FILE_OPEN
, MyFrame::FileOpen
)
140 EVT_MENU(DIALOGS_FILE_OPEN2
, MyFrame::FileOpen2
)
141 EVT_MENU(DIALOGS_FILES_OPEN
, MyFrame::FilesOpen
)
142 EVT_MENU(DIALOGS_FILE_SAVE
, MyFrame::FileSave
)
143 #endif // wxUSE_FILEDLG
145 #if USE_FILEDLG_GENERIC
146 EVT_MENU(DIALOGS_FILE_OPEN_GENERIC
, MyFrame::FileOpenGeneric
)
147 EVT_MENU(DIALOGS_FILES_OPEN_GENERIC
, MyFrame::FilesOpenGeneric
)
148 EVT_MENU(DIALOGS_FILE_SAVE_GENERIC
, MyFrame::FileSaveGeneric
)
149 #endif // USE_FILEDLG_GENERIC
152 EVT_MENU(DIALOGS_DIR_CHOOSE
, MyFrame::DirChoose
)
153 EVT_MENU(DIALOGS_DIRNEW_CHOOSE
, MyFrame::DirChooseNew
)
154 #endif // wxUSE_DIRDLG
156 #if USE_MODAL_PRESENTATION
157 EVT_MENU(DIALOGS_MODAL
, MyFrame::ModalDlg
)
158 EVT_MENU(DIALOGS_MODELESS
, MyFrame::ModelessDlg
)
161 #if wxUSE_STARTUP_TIPS
162 EVT_MENU(DIALOGS_TIP
, MyFrame::ShowTip
)
163 #endif // wxUSE_STARTUP_TIPS
165 #if USE_FONTDLG_GENERIC
166 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC
, MyFrame::ChooseFontGeneric
)
167 #endif // USE_FONTDLG_GENERIC
169 #if USE_DIRDLG_GENERIC
170 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE
, MyFrame::GenericDirChoose
)
171 #endif // wxMSW || wxMAC
173 #if USE_COLOURDLG_GENERIC
174 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC
, MyFrame::ChooseColourGeneric
)
175 #endif // USE_COLOURDLG_GENERIC
177 #if wxUSE_PROGRESSDLG
178 EVT_MENU(DIALOGS_PROGRESS
, MyFrame::ShowProgress
)
179 #endif // wxUSE_PROGRESSDLG
182 EVT_MENU(DIALOGS_BUSYINFO
, MyFrame::ShowBusyInfo
)
183 #endif // wxUSE_BUSYINFO
185 #if wxUSE_FINDREPLDLG
186 EVT_MENU(DIALOGS_FIND
, MyFrame::ShowFindDialog
)
187 EVT_MENU(DIALOGS_REPLACE
, MyFrame::ShowReplaceDialog
)
189 EVT_FIND(wxID_ANY
, MyFrame::OnFindDialog
)
190 EVT_FIND_NEXT(wxID_ANY
, MyFrame::OnFindDialog
)
191 EVT_FIND_REPLACE(wxID_ANY
, MyFrame::OnFindDialog
)
192 EVT_FIND_REPLACE_ALL(wxID_ANY
, MyFrame::OnFindDialog
)
193 EVT_FIND_CLOSE(wxID_ANY
, MyFrame::OnFindDialog
)
194 #endif // wxUSE_FINDREPLDLG
196 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame::OnPropertySheet
)
197 EVT_MENU(DIALOGS_REQUEST
, MyFrame::OnRequestUserAttention
)
199 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
202 #if USE_MODAL_PRESENTATION
204 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
205 EVT_BUTTON(wxID_ANY
, MyModalDialog::OnButton
)
208 BEGIN_EVENT_TABLE(MyModelessDialog
, wxDialog
)
209 EVT_BUTTON(DIALOGS_MODELESS_BTN
, MyModelessDialog::OnButton
)
210 EVT_CLOSE(MyModelessDialog::OnClose
)
213 #endif // USE_MODAL_PRESENTATION
215 MyCanvas
*myCanvas
= (MyCanvas
*) NULL
;
217 // `Main program' equivalent, creating windows and returning main app frame
221 wxInitAllImageHandlers();
224 m_canvasTextColour
= wxColour(_T("BLACK"));
225 m_canvasFont
= *wxNORMAL_FONT
;
227 // Create the main frame window
228 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets dialogs example"));
231 wxMenu
*file_menu
= new wxMenu
;
233 file_menu
->Append(DIALOGS_MESSAGE_BOX
, _T("&Message box\tCtrl-M"));
236 #if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
238 wxMenu
*choices_menu
= new wxMenu
;
241 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR
, _T("&Choose colour"));
242 #endif // wxUSE_COLOURDLG
245 choices_menu
->Append(DIALOGS_CHOOSE_FONT
, _T("Choose &font"));
246 #endif // wxUSE_FONTDLG
249 choices_menu
->Append(DIALOGS_SINGLE_CHOICE
, _T("&Single choice\tCtrl-C"));
250 choices_menu
->Append(DIALOGS_MULTI_CHOICE
, _T("M&ultiple choice\tCtrl-U"));
251 #endif // wxUSE_CHOICEDLG
253 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
254 choices_menu
->AppendSeparator();
255 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
257 #if USE_COLOURDLG_GENERIC
258 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR_GENERIC
, _T("&Choose colour (generic)"));
259 #endif // USE_COLOURDLG_GENERIC
261 #if USE_FONTDLG_GENERIC
262 choices_menu
->Append(DIALOGS_CHOOSE_FONT_GENERIC
, _T("Choose &font (generic)"));
263 #endif // USE_FONTDLG_GENERIC
265 file_menu
->Append(wxID_ANY
,_T("&Choices and selectors"),choices_menu
);
266 #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
269 #if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
271 wxMenu
*entry_menu
= new wxMenu
;
274 entry_menu
->Append(DIALOGS_TEXT_ENTRY
, _T("Text &entry\tCtrl-E"));
275 entry_menu
->Append(DIALOGS_PASSWORD_ENTRY
, _T("&Password entry\tCtrl-P"));
276 #endif // wxUSE_TEXTDLG
279 entry_menu
->Append(DIALOGS_NUM_ENTRY
, _T("&Numeric entry\tCtrl-N"));
280 #endif // wxUSE_NUMBERDLG
282 file_menu
->Append(wxID_ANY
,_T("&Entry dialogs"),entry_menu
);
284 #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
289 wxMenu
*filedlg_menu
= new wxMenu
;
290 filedlg_menu
->Append(DIALOGS_FILE_OPEN
, _T("&Open file\tCtrl-O"));
291 filedlg_menu
->Append(DIALOGS_FILE_OPEN2
, _T("&Second open file\tCtrl-2"));
292 filedlg_menu
->Append(DIALOGS_FILES_OPEN
, _T("Open &files\tCtrl-Q"));
293 filedlg_menu
->Append(DIALOGS_FILE_SAVE
, _T("Sa&ve file\tCtrl-S"));
295 #if USE_FILEDLG_GENERIC
296 filedlg_menu
->AppendSeparator();
297 filedlg_menu
->Append(DIALOGS_FILE_OPEN_GENERIC
, _T("&Open file (generic)"));
298 filedlg_menu
->Append(DIALOGS_FILES_OPEN_GENERIC
, _T("Open &files (generic)"));
299 filedlg_menu
->Append(DIALOGS_FILE_SAVE_GENERIC
, _T("Sa&ve file (generic)"));
300 #endif // USE_FILEDLG_GENERIC
302 file_menu
->Append(wxID_ANY
,_T("&File operations"),filedlg_menu
);
304 #endif // wxUSE_FILEDLG
307 wxMenu
*dir_menu
= new wxMenu
;
309 dir_menu
->Append(DIALOGS_DIR_CHOOSE
, _T("&Choose a directory\tCtrl-D"));
310 dir_menu
->Append(DIALOGS_DIRNEW_CHOOSE
, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
311 file_menu
->Append(wxID_ANY
,_T("&Directory operations"),dir_menu
);
313 #if USE_DIRDLG_GENERIC
314 dir_menu
->AppendSeparator();
315 dir_menu
->Append(DIALOGS_GENERIC_DIR_CHOOSE
, _T("&Choose a directory (generic)"));
316 #endif // USE_DIRDLG_GENERIC
318 #endif // wxUSE_DIRDLG
321 #if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
323 wxMenu
*info_menu
= new wxMenu
;
325 #if wxUSE_STARTUP_TIPS
326 info_menu
->Append(DIALOGS_TIP
, _T("&Tip of the day\tCtrl-T"));
327 #endif // wxUSE_STARTUP_TIPS
329 #if wxUSE_PROGRESSDLG
330 info_menu
->Append(DIALOGS_PROGRESS
, _T("Pro&gress dialog\tCtrl-G"));
331 #endif // wxUSE_PROGRESSDLG
334 info_menu
->Append(DIALOGS_BUSYINFO
, _T("&Busy info dialog\tCtrl-B"));
335 #endif // wxUSE_BUSYINFO
338 info_menu
->Append(DIALOGS_LOG_DIALOG
, _T("&Log dialog\tCtrl-L"));
339 #endif // wxUSE_LOG_DIALOG
341 file_menu
->Append(wxID_ANY
,_T("&Informative dialogs"),info_menu
);
343 #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
346 #if wxUSE_FINDREPLDLG
347 wxMenu
*find_menu
= new wxMenu
;
348 find_menu
->AppendCheckItem(DIALOGS_FIND
, _T("&Find dialog\tCtrl-F"));
349 find_menu
->AppendCheckItem(DIALOGS_REPLACE
, _T("Find and &replace dialog\tShift-Ctrl-F"));
350 file_menu
->Append(wxID_ANY
,_T("&Searching"),find_menu
);
351 #endif // wxUSE_FINDREPLDLG
353 #if USE_MODAL_PRESENTATION
354 wxMenu
*modal_menu
= new wxMenu
;
355 modal_menu
->Append(DIALOGS_MODAL
, _T("Mo&dal dialog\tCtrl-W"));
356 modal_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Modeless &dialog\tCtrl-Z"));
357 file_menu
->Append(wxID_ANY
,_T("&Modal/Modeless"),modal_menu
);
358 #endif // USE_MODAL_PRESENTATION
360 file_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Property Sheet Dialog\tCtrl-P"));
361 file_menu
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
363 file_menu
->AppendSeparator();
364 file_menu
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
366 wxMenuBar
*menu_bar
= new wxMenuBar
;
367 menu_bar
->Append(file_menu
, _T("&File"));
368 frame
->SetMenuBar(menu_bar
);
370 myCanvas
= new MyCanvas(frame
);
371 myCanvas
->SetBackgroundColour(*wxWHITE
);
373 frame
->Centre(wxBOTH
);
383 // My frame constructor
384 MyFrame::MyFrame(wxWindow
*parent
,
385 const wxString
& title
)
386 : wxFrame(parent
, wxID_ANY
, title
)
390 #if USE_MODAL_PRESENTATION
391 m_dialog
= (MyModelessDialog
*)NULL
;
392 #endif // USE_MODAL_PRESENTATION
394 #if wxUSE_FINDREPLDLG
400 m_clrData
.SetChooseFull(true);
401 for (int i
= 0; i
< 16; i
++)
403 m_clrData
.SetCustomColour(
406 (unsigned char)(i
*16),
407 (unsigned char)(i
*16),
408 (unsigned char)(i
*16)
412 #endif // wxUSE_COLOURDLG
416 void MyFrame::ChooseColour(wxCommandEvent
& WXUNUSED(event
) )
418 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
420 wxColourDialog
dialog(this, &m_clrData
);
421 dialog
.SetTitle(_T("Choose the background colour"));
422 if (dialog
.ShowModal() == wxID_OK
)
424 m_clrData
= dialog
.GetColourData();
425 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
426 myCanvas
->ClearBackground();
430 #endif // wxUSE_COLOURDLG
432 #if USE_COLOURDLG_GENERIC
433 void MyFrame::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
435 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
437 //FIXME:TODO:This has no effect...
438 m_clrData
.SetChooseFull(true);
440 for (int i
= 0; i
< 16; i
++)
443 (unsigned char)(i
*16),
444 (unsigned char)(i
*16),
445 (unsigned char)(i
*16)
447 m_clrData
.SetCustomColour(i
, colour
);
450 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
451 if (dialog
->ShowModal() == wxID_OK
)
453 m_clrData
= dialog
->GetColourData();
454 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
455 myCanvas
->ClearBackground();
460 #endif // USE_COLOURDLG_GENERIC
463 void MyFrame::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
466 data
.SetInitialFont(wxGetApp().m_canvasFont
);
467 data
.SetColour(wxGetApp().m_canvasTextColour
);
469 // you might also do this:
471 // wxFontDialog dialog;
472 // if ( !dialog.Create(this, data) { ... error ... }
474 wxFontDialog
dialog(this, data
);
476 if (dialog
.ShowModal() == wxID_OK
)
478 wxFontData retData
= dialog
.GetFontData();
479 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
480 wxGetApp().m_canvasTextColour
= retData
.GetColour();
483 //else: cancelled by the user, don't change the font
485 #endif // wxUSE_FONTDLG
487 #if USE_FONTDLG_GENERIC
488 void MyFrame::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
491 data
.SetInitialFont(wxGetApp().m_canvasFont
);
492 data
.SetColour(wxGetApp().m_canvasTextColour
);
494 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, &data
);
495 if (dialog
->ShowModal() == wxID_OK
)
497 wxFontData retData
= dialog
->GetFontData();
498 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
499 wxGetApp().m_canvasTextColour
= retData
.GetColour();
504 #endif // USE_FONTDLG_GENERIC
507 void MyFrame::LogDialog(wxCommandEvent
& WXUNUSED(event
))
509 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
510 // being flushed -- test it
513 wxLogMessage(wxT("This is some message - everything is ok so far."));
514 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
515 wxLogWarning(wxT("And then something went wrong!"));
517 // and if ~wxBusyCursor doesn't do it, then call it manually
521 wxLogError(wxT("Intermediary error handler decided to abort."));
522 wxLogError(wxT("The top level caller detected an unrecoverable error."));
524 wxLog::FlushActive();
526 wxLogMessage(wxT("And this is the same dialog but with only one message."));
528 #endif // wxUSE_LOG_DIALOG
530 void MyFrame::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
532 wxMessageDialog
dialog( NULL
, _T("This is a message box\nA long, long string to test out the message box properly"),
533 _T("Message box text"), wxNO_DEFAULT
|wxYES_NO
|wxCANCEL
|wxICON_INFORMATION
);
535 switch ( dialog
.ShowModal() )
538 wxLogStatus(wxT("You pressed \"Yes\""));
542 wxLogStatus(wxT("You pressed \"No\""));
546 wxLogStatus(wxT("You pressed \"Cancel\""));
550 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
555 void MyFrame::NumericEntry(wxCommandEvent
& WXUNUSED(event
) )
557 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
558 _T("Even two rows of text."),
559 _T("Enter a number:"), _T("Numeric input test"),
566 msg
= _T("Invalid number entered or dialog cancelled.");
571 msg
.Printf(_T("You've entered %lu"), res
);
572 icon
= wxICON_INFORMATION
;
575 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
577 #endif // wxUSE_NUMBERDLG
580 void MyFrame::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
582 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
583 _T("Password entry dialog"),
588 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd
.c_str()),
589 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
593 void MyFrame::TextEntry(wxCommandEvent
& WXUNUSED(event
))
595 wxTextEntryDialog
dialog(this,
596 _T("This is a small sample\n")
597 _T("A long, long string to test out the text entrybox"),
598 _T("Please enter a string"),
602 if (dialog
.ShowModal() == wxID_OK
)
604 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
607 #endif // wxUSE_TEXTDLG
610 void MyFrame::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
612 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
614 wxSingleChoiceDialog
dialog(this,
615 _T("This is a small sample\n")
616 _T("A single-choice convenience dialog"),
617 _T("Please select a value"),
618 WXSIZEOF(choices
), choices
);
620 dialog
.SetSelection(2);
622 if (dialog
.ShowModal() == wxID_OK
)
624 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
629 void MyFrame::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
631 const wxString choices
[] =
633 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
634 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
635 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
638 wxArrayInt selections
;
639 size_t count
= wxGetMultipleChoices(selections
,
640 _T("This is a small sample\n")
641 _T("A multi-choice convenience dialog"),
642 _T("Please select a value"),
643 WXSIZEOF(choices
), choices
,
648 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
649 for ( size_t n
= 0; n
< count
; n
++ )
651 msg
+= wxString::Format(wxT("\t%u: %u (%s)\n"),
652 (unsigned)n
, (unsigned)selections
[n
],
653 choices
[selections
[n
]].c_str());
657 //else: cancelled or nothing selected
659 #endif // wxUSE_CHOICEDLG
662 void MyFrame::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
667 _T("Testing open file dialog"),
671 _T("C++ files (*.cpp)|*.cpp")
673 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
677 dialog
.SetDirectory(wxGetHomeDir());
679 if (dialog
.ShowModal() == wxID_OK
)
682 info
.Printf(_T("Full file name: %s\n")
685 dialog
.GetPath().c_str(),
686 dialog
.GetDirectory().c_str(),
687 dialog
.GetFilename().c_str());
688 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
693 // this shows how to take advantage of specifying a default extension in the
694 // call to wxFileSelector: it is remembered after each new call and the next
695 // one will use it by default
696 void MyFrame::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
698 static wxString s_extDef
;
699 wxString path
= wxFileSelector(
700 _T("Select the file to load"),
701 wxEmptyString
, wxEmptyString
,
705 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
706 wxFileSelectorDefaultWildcardStr
,
707 wxFileSelectorDefaultWildcardStr
716 // it is just a sample, would use wxSplitPath in real program
717 s_extDef
= path
.AfterLast(_T('.'));
719 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
720 (const wxChar
*) path
, (const wxChar
*) s_extDef
);
723 void MyFrame::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
727 _T("C++ files (*.cpp)|*.cpp");
731 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
732 wxFileSelectorDefaultWildcardStr
,
733 wxFileSelectorDefaultWildcardStr
736 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
737 wxEmptyString
, wxEmptyString
, wildcards
,
740 if (dialog
.ShowModal() == wxID_OK
)
742 wxArrayString paths
, filenames
;
744 dialog
.GetPaths(paths
);
745 dialog
.GetFilenames(filenames
);
748 size_t count
= paths
.GetCount();
749 for ( size_t n
= 0; n
< count
; n
++ )
751 s
.Printf(_T("File %d: %s (%s)\n"),
752 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
756 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
759 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
764 void MyFrame::FileSave(wxCommandEvent
& WXUNUSED(event
) )
766 wxFileDialog
dialog(this,
767 _T("Testing save file dialog"),
770 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
771 wxSAVE
|wxOVERWRITE_PROMPT
);
773 dialog
.SetFilterIndex(1);
775 if (dialog
.ShowModal() == wxID_OK
)
777 wxLogMessage(_T("%s, filter %d"),
778 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
781 #endif // wxUSE_FILEDLG
783 #if USE_FILEDLG_GENERIC
784 void MyFrame::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
786 wxGenericFileDialog dialog
789 _T("Testing open file dialog"),
792 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
795 dialog
.SetDirectory(wxGetHomeDir());
797 if (dialog
.ShowModal() == wxID_OK
)
800 info
.Printf(_T("Full file name: %s\n")
803 dialog
.GetPath().c_str(),
804 dialog
.GetDirectory().c_str(),
805 dialog
.GetFilename().c_str());
806 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
811 void MyFrame::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
813 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
814 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
815 wxEmptyString
, wxEmptyString
, wildcards
,
818 if (dialog
.ShowModal() == wxID_OK
)
820 wxArrayString paths
, filenames
;
822 dialog
.GetPaths(paths
);
823 dialog
.GetFilenames(filenames
);
826 size_t count
= paths
.GetCount();
827 for ( size_t n
= 0; n
< count
; n
++ )
829 s
.Printf(_T("File %d: %s (%s)\n"),
830 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
834 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
837 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
842 void MyFrame::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
844 wxGenericFileDialog
dialog(this,
845 _T("Testing save file dialog"),
848 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
849 wxSAVE
|wxOVERWRITE_PROMPT
);
851 dialog
.SetFilterIndex(1);
853 if (dialog
.ShowModal() == wxID_OK
)
855 wxLogMessage(_T("%s, filter %d"),
856 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
859 #endif // USE_FILEDLG_GENERIC
862 void MyFrame::DoDirChoose(int style
)
864 // pass some initial dir to wxDirDialog
866 wxGetHomeDir(&dirHome
);
868 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
870 if (dialog
.ShowModal() == wxID_OK
)
872 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
876 void MyFrame::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
878 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_NEW_DIR_BUTTON
);
881 void MyFrame::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
883 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_NEW_DIR_BUTTON
);
885 #endif // wxUSE_DIRDLG
887 #if USE_DIRDLG_GENERIC
888 void MyFrame::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
890 // pass some initial dir to wxDirDialog
892 wxGetHomeDir(&dirHome
);
894 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
896 if (dialog
.ShowModal() == wxID_OK
)
898 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
902 #endif // USE_DIRDLG_GENERIC
904 #if USE_MODAL_PRESENTATION
905 void MyFrame::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
907 MyModalDialog
dlg(this);
911 void MyFrame::ModelessDlg(wxCommandEvent
& event
)
913 bool show
= GetMenuBar()->IsChecked(event
.GetId());
919 m_dialog
= new MyModelessDialog(this);
922 m_dialog
->Show(true);
926 // If m_dialog is NULL, then possibly the system
927 // didn't report the checked menu item status correctly.
928 // It should be true just after the menu item was selected,
929 // if there was no modeless dialog yet.
931 wxASSERT( m_dialog
!= NULL
);
936 #endif // USE_MODAL_PRESENTATION
938 #if wxUSE_STARTUP_TIPS
939 void MyFrame::ShowTip(wxCommandEvent
& WXUNUSED(event
))
941 static size_t s_index
= (size_t)-1;
943 if ( s_index
== (size_t)-1 )
947 // this is completely bogus, we don't know how many lines are there
948 // in the file, but who cares, it's a demo only...
949 s_index
= rand() % 5;
952 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
954 bool showAtStartup
= wxShowTip(this, tipProvider
);
958 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
959 wxOK
| wxICON_INFORMATION
, this);
962 s_index
= tipProvider
->GetCurrentTip();
965 #endif // wxUSE_STARTUP_TIPS
967 void MyFrame::OnPropertySheet(wxCommandEvent
& WXUNUSED(event
))
969 SettingsDialog
dialog(this);
973 void MyFrame::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
975 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
979 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
982 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
) )
987 #if wxUSE_PROGRESSDLG
989 void MyFrame::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
991 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
992 // check the performance
993 int countrandomnumbers
= 0, count
= 0;
994 wxTimeSpan
tsTest(0,0,0,250);
995 wxDateTime DT2
, DT1
= wxDateTime::UNow();
1000 ++countrandomnumbers
;
1001 if ( countrandomnumbers
== 1000 )
1004 countrandomnumbers
= 0;
1006 DT2
= wxDateTime::UNow();
1007 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1008 if ( ts
.IsLongerThan( tsTest
) )
1014 const int max
= 40 * count
;
1016 static const int max
= 10;
1017 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
1019 wxProgressDialog
dialog(_T("Progress dialog example"),
1020 _T("An informative message"),
1026 // wxPD_AUTO_HIDE | -- try this as well
1028 wxPD_ESTIMATED_TIME
|
1029 wxPD_REMAINING_TIME
|
1034 // each skip will move progress about quarter forward
1035 for ( int i
= 0; i
<= max
; i
= wxMin(i
+(skip
?int(max
/4):1), max
+1), skip
= false )
1037 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1038 // do (almost) the same operations as we did for the performance test
1040 for ( int j
= 0; j
< 1000; j
++ )
1045 DT2
= wxDateTime::UNow();
1046 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1047 if ( ts
.IsLongerThan( tsTest
) )
1061 msg
= _T("That's all, folks!");
1063 else if ( i
> max
/ 2 )
1065 msg
= _T("Only a half left (very long message)!");
1068 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1069 if ( (i
% (max
/100)) == 0 ) // // only 100 updates, this makes it much faster
1071 cont
= dialog
.Update(i
, msg
, &skip
);
1074 cont
= dialog
.Update(i
, msg
, &skip
);
1079 if ( wxMessageBox(_T("Do you really want to cancel?"),
1080 _T("Progress dialog question"), // caption
1081 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1091 wxLogStatus(wxT("Progress dialog aborted!"));
1095 wxLogStatus(wxT("Countdown from %d finished"), max
);
1099 #endif // wxUSE_PROGRESSDLG
1103 void MyFrame::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1105 wxWindowDisabler disableAll
;
1107 wxBusyInfo
info(_T("Working, please wait..."), this);
1109 for ( int i
= 0; i
< 18; i
++ )
1119 #endif // wxUSE_BUSYINFO
1121 #if wxUSE_FINDREPLDLG
1123 void MyFrame::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1127 delete m_dlgReplace
;
1128 m_dlgReplace
= NULL
;
1132 m_dlgReplace
= new wxFindReplaceDialog
1136 _T("Find and replace dialog"),
1140 m_dlgReplace
->Show(true);
1144 void MyFrame::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1153 m_dlgFind
= new wxFindReplaceDialog
1162 m_dlgFind
->Show(true);
1166 static wxString
DecodeFindDialogEventFlags(int flags
)
1169 str
<< (flags
& wxFR_DOWN
? _T("down") : _T("up")) << _T(", ")
1170 << (flags
& wxFR_WHOLEWORD
? _T("whole words only, ") : _T(""))
1171 << (flags
& wxFR_MATCHCASE
? _T("") : _T("not "))
1172 << _T("case sensitive");
1177 void MyFrame::OnFindDialog(wxFindDialogEvent
& event
)
1179 wxEventType type
= event
.GetEventType();
1181 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1183 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1184 type
== wxEVT_COMMAND_FIND_NEXT
? wxT("next ") : wxT(""),
1185 event
.GetFindString().c_str(),
1186 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1188 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1189 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1191 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1192 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
? _T("all ") : wxT(""),
1193 event
.GetFindString().c_str(),
1194 event
.GetReplaceString().c_str(),
1195 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1197 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1199 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1203 if ( dlg
== m_dlgFind
)
1206 idMenu
= DIALOGS_FIND
;
1209 else if ( dlg
== m_dlgReplace
)
1211 txt
= _T("Replace");
1212 idMenu
= DIALOGS_REPLACE
;
1213 m_dlgReplace
= NULL
;
1217 txt
= _T("Unknown");
1220 wxFAIL_MSG( _T("unexpected event") );
1223 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1225 if ( idMenu
!= wxID_ANY
)
1227 GetMenuBar()->Check(idMenu
, false);
1234 wxLogError(wxT("Unknown find dialog event!"));
1238 #endif // wxUSE_FINDREPLDLG
1240 // ----------------------------------------------------------------------------
1242 // ----------------------------------------------------------------------------
1244 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1247 dc
.SetFont(wxGetApp().m_canvasFont
);
1248 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1249 dc
.SetBackgroundMode(wxTRANSPARENT
);
1251 _T("wxWidgets common dialogs")
1252 #if !defined(__SMARTPHONE__)
1253 _T(" test application")
1258 #if USE_MODAL_PRESENTATION
1260 // ----------------------------------------------------------------------------
1262 // ----------------------------------------------------------------------------
1264 MyModelessDialog::MyModelessDialog(wxWindow
*parent
)
1265 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1267 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1269 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1270 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1273 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1274 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1278 sizerTop
->SetSizeHints(this);
1279 sizerTop
->Fit(this);
1282 void MyModelessDialog::OnButton(wxCommandEvent
& WXUNUSED(event
))
1284 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1285 wxOK
| wxICON_INFORMATION
, this);
1288 void MyModelessDialog::OnClose(wxCloseEvent
& event
)
1290 if ( event
.CanVeto() )
1292 wxMessageBox(_T("Use the menu item to close this dialog"),
1293 _T("Modeless dialog"),
1294 wxOK
| wxICON_INFORMATION
, this);
1300 // ----------------------------------------------------------------------------
1302 // ----------------------------------------------------------------------------
1304 MyModalDialog::MyModalDialog(wxWindow
*parent
)
1305 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1307 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1309 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1310 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1311 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1313 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1314 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1315 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1316 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1317 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1321 sizerTop
->SetSizeHints(this);
1322 sizerTop
->Fit(this);
1324 m_btnModal
->SetFocus();
1325 m_btnModal
->SetDefault();
1328 void MyModalDialog::OnButton(wxCommandEvent
& event
)
1330 if ( event
.GetEventObject() == m_btnDelete
)
1335 m_btnDelete
->Disable();
1337 else if ( event
.GetEventObject() == m_btnModal
)
1340 wxGetTextFromUser(_T("Dummy prompt"),
1341 _T("Modal dialog called from dialog"),
1342 wxEmptyString
, this);
1344 wxMessageBox(_T("Modal dialog called from dialog"));
1345 #endif // wxUSE_TEXTDLG
1347 else if ( event
.GetEventObject() == m_btnModeless
)
1349 (new MyModelessDialog(this))->Show();
1357 #endif // USE_MODAL_PRESENTATION
1359 // ----------------------------------------------------------------------------
1361 // ----------------------------------------------------------------------------
1363 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1365 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1368 SettingsDialog::SettingsDialog(wxWindow
* win
)
1370 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
);
1372 Create(win
, -1, _("Preferences"), wxDefaultPosition
, wxDefaultSize
, wxDEFAULT_DIALOG_STYLE
|wxRESIZE_BORDER
);
1373 CreateButtons(wxOK
|wxCANCEL
|wxHELP
);
1375 wxBookCtrlBase
* notebook
= GetBookCtrl();
1377 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
1378 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
1380 notebook
->AddPage(generalSettings
, _("General"));
1381 notebook
->AddPage(aestheticSettings
, _("Aesthetics"));
1386 wxPanel
* SettingsDialog::CreateGeneralSettingsPage(wxWindow
* parent
)
1388 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1390 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1391 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1395 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
1396 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
1397 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1398 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
1402 wxString autoSaveLabel
= _("&Auto-save every");
1403 wxString minsLabel
= _("mins");
1405 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
1406 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
1409 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
1410 wxDefaultPosition
, wxSize(40, -1), wxSP_ARROW_KEYS
, 1, 60, 1);
1413 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1415 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1417 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1418 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
1422 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
1423 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
1424 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1425 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
1427 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1429 panel
->SetSizer(topSizer
);
1430 topSizer
->Fit(panel
);
1435 wxPanel
* SettingsDialog::CreateAestheticSettingsPage(wxWindow
* parent
)
1437 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1439 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1440 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1442 //// PROJECT OR GLOBAL
1443 wxString globalOrProjectChoices
[2];
1444 globalOrProjectChoices
[0] = _("&New projects");
1445 globalOrProjectChoices
[1] = _("&This project");
1447 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
1448 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
1449 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
1451 projectOrGlobal
->SetSelection(0);
1453 //// BACKGROUND STYLE
1454 wxArrayString backgroundStyleChoices
;
1455 backgroundStyleChoices
.Add(wxT("Colour"));
1456 backgroundStyleChoices
.Add(wxT("Image"));
1457 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, -1, _("Background style:"));
1459 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
1460 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
1462 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
1464 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
1466 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1467 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
1468 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1470 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
1473 //// FONT SIZE SELECTION
1475 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, -1, _("Tile font size:"));
1476 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
1478 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
1480 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
1482 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
1485 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1487 panel
->SetSizer(topSizer
);
1488 topSizer
->Fit(panel
);