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 #if USE_SETTINGS_DIALOG
197 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame::OnPropertySheet
)
200 EVT_MENU(DIALOGS_REQUEST
, MyFrame::OnRequestUserAttention
)
202 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
205 #if USE_MODAL_PRESENTATION
207 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
208 EVT_BUTTON(wxID_ANY
, MyModalDialog::OnButton
)
211 BEGIN_EVENT_TABLE(MyModelessDialog
, wxDialog
)
212 EVT_BUTTON(DIALOGS_MODELESS_BTN
, MyModelessDialog::OnButton
)
213 EVT_CLOSE(MyModelessDialog::OnClose
)
216 #endif // USE_MODAL_PRESENTATION
218 MyCanvas
*myCanvas
= (MyCanvas
*) NULL
;
220 // `Main program' equivalent, creating windows and returning main app frame
224 wxInitAllImageHandlers();
227 m_canvasTextColour
= wxColour(_T("BLACK"));
228 m_canvasFont
= *wxNORMAL_FONT
;
230 // Create the main frame window
231 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets dialogs example"));
234 wxMenu
*file_menu
= new wxMenu
;
236 file_menu
->Append(DIALOGS_MESSAGE_BOX
, _T("&Message box\tCtrl-M"));
239 #if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
241 wxMenu
*choices_menu
= new wxMenu
;
244 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR
, _T("&Choose colour"));
245 #endif // wxUSE_COLOURDLG
248 choices_menu
->Append(DIALOGS_CHOOSE_FONT
, _T("Choose &font"));
249 #endif // wxUSE_FONTDLG
252 choices_menu
->Append(DIALOGS_SINGLE_CHOICE
, _T("&Single choice\tCtrl-C"));
253 choices_menu
->Append(DIALOGS_MULTI_CHOICE
, _T("M&ultiple choice\tCtrl-U"));
254 #endif // wxUSE_CHOICEDLG
256 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
257 choices_menu
->AppendSeparator();
258 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
260 #if USE_COLOURDLG_GENERIC
261 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR_GENERIC
, _T("&Choose colour (generic)"));
262 #endif // USE_COLOURDLG_GENERIC
264 #if USE_FONTDLG_GENERIC
265 choices_menu
->Append(DIALOGS_CHOOSE_FONT_GENERIC
, _T("Choose &font (generic)"));
266 #endif // USE_FONTDLG_GENERIC
268 file_menu
->Append(wxID_ANY
,_T("&Choices and selectors"),choices_menu
);
269 #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
272 #if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
274 wxMenu
*entry_menu
= new wxMenu
;
277 entry_menu
->Append(DIALOGS_TEXT_ENTRY
, _T("Text &entry\tCtrl-E"));
278 entry_menu
->Append(DIALOGS_PASSWORD_ENTRY
, _T("&Password entry\tCtrl-P"));
279 #endif // wxUSE_TEXTDLG
282 entry_menu
->Append(DIALOGS_NUM_ENTRY
, _T("&Numeric entry\tCtrl-N"));
283 #endif // wxUSE_NUMBERDLG
285 file_menu
->Append(wxID_ANY
,_T("&Entry dialogs"),entry_menu
);
287 #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
292 wxMenu
*filedlg_menu
= new wxMenu
;
293 filedlg_menu
->Append(DIALOGS_FILE_OPEN
, _T("&Open file\tCtrl-O"));
294 filedlg_menu
->Append(DIALOGS_FILE_OPEN2
, _T("&Second open file\tCtrl-2"));
295 filedlg_menu
->Append(DIALOGS_FILES_OPEN
, _T("Open &files\tCtrl-Q"));
296 filedlg_menu
->Append(DIALOGS_FILE_SAVE
, _T("Sa&ve file\tCtrl-S"));
298 #if USE_FILEDLG_GENERIC
299 filedlg_menu
->AppendSeparator();
300 filedlg_menu
->Append(DIALOGS_FILE_OPEN_GENERIC
, _T("&Open file (generic)"));
301 filedlg_menu
->Append(DIALOGS_FILES_OPEN_GENERIC
, _T("Open &files (generic)"));
302 filedlg_menu
->Append(DIALOGS_FILE_SAVE_GENERIC
, _T("Sa&ve file (generic)"));
303 #endif // USE_FILEDLG_GENERIC
305 file_menu
->Append(wxID_ANY
,_T("&File operations"),filedlg_menu
);
307 #endif // wxUSE_FILEDLG
310 wxMenu
*dir_menu
= new wxMenu
;
312 dir_menu
->Append(DIALOGS_DIR_CHOOSE
, _T("&Choose a directory\tCtrl-D"));
313 dir_menu
->Append(DIALOGS_DIRNEW_CHOOSE
, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
314 file_menu
->Append(wxID_ANY
,_T("&Directory operations"),dir_menu
);
316 #if USE_DIRDLG_GENERIC
317 dir_menu
->AppendSeparator();
318 dir_menu
->Append(DIALOGS_GENERIC_DIR_CHOOSE
, _T("&Choose a directory (generic)"));
319 #endif // USE_DIRDLG_GENERIC
321 #endif // wxUSE_DIRDLG
324 #if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
326 wxMenu
*info_menu
= new wxMenu
;
328 #if wxUSE_STARTUP_TIPS
329 info_menu
->Append(DIALOGS_TIP
, _T("&Tip of the day\tCtrl-T"));
330 #endif // wxUSE_STARTUP_TIPS
332 #if wxUSE_PROGRESSDLG
333 info_menu
->Append(DIALOGS_PROGRESS
, _T("Pro&gress dialog\tCtrl-G"));
334 #endif // wxUSE_PROGRESSDLG
337 info_menu
->Append(DIALOGS_BUSYINFO
, _T("&Busy info dialog\tCtrl-B"));
338 #endif // wxUSE_BUSYINFO
341 info_menu
->Append(DIALOGS_LOG_DIALOG
, _T("&Log dialog\tCtrl-L"));
342 #endif // wxUSE_LOG_DIALOG
344 file_menu
->Append(wxID_ANY
,_T("&Informative dialogs"),info_menu
);
346 #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
349 #if wxUSE_FINDREPLDLG
350 wxMenu
*find_menu
= new wxMenu
;
351 find_menu
->AppendCheckItem(DIALOGS_FIND
, _T("&Find dialog\tCtrl-F"));
352 find_menu
->AppendCheckItem(DIALOGS_REPLACE
, _T("Find and &replace dialog\tShift-Ctrl-F"));
353 file_menu
->Append(wxID_ANY
,_T("&Searching"),find_menu
);
354 #endif // wxUSE_FINDREPLDLG
356 #if USE_MODAL_PRESENTATION
357 wxMenu
*modal_menu
= new wxMenu
;
358 modal_menu
->Append(DIALOGS_MODAL
, _T("Mo&dal dialog\tCtrl-W"));
359 modal_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Modeless &dialog\tCtrl-Z"));
360 file_menu
->Append(wxID_ANY
,_T("&Modal/Modeless"),modal_menu
);
361 #endif // USE_MODAL_PRESENTATION
363 #if USE_SETTINGS_DIALOG
364 file_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Property Sheet Dialog\tCtrl-P"));
367 file_menu
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
369 file_menu
->AppendSeparator();
370 file_menu
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
372 wxMenuBar
*menu_bar
= new wxMenuBar
;
373 menu_bar
->Append(file_menu
, _T("&File"));
374 frame
->SetMenuBar(menu_bar
);
376 myCanvas
= new MyCanvas(frame
);
377 myCanvas
->SetBackgroundColour(*wxWHITE
);
379 frame
->Centre(wxBOTH
);
389 // My frame constructor
390 MyFrame::MyFrame(wxWindow
*parent
,
391 const wxString
& title
)
392 : wxFrame(parent
, wxID_ANY
, title
)
396 #if USE_MODAL_PRESENTATION
397 m_dialog
= (MyModelessDialog
*)NULL
;
398 #endif // USE_MODAL_PRESENTATION
400 #if wxUSE_FINDREPLDLG
406 m_clrData
.SetChooseFull(true);
407 for (int i
= 0; i
< 16; i
++)
409 m_clrData
.SetCustomColour(
412 (unsigned char)(i
*16),
413 (unsigned char)(i
*16),
414 (unsigned char)(i
*16)
418 #endif // wxUSE_COLOURDLG
422 void MyFrame::ChooseColour(wxCommandEvent
& WXUNUSED(event
) )
424 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
426 wxColourDialog
dialog(this, &m_clrData
);
427 dialog
.SetTitle(_T("Choose the background colour"));
428 if (dialog
.ShowModal() == wxID_OK
)
430 m_clrData
= dialog
.GetColourData();
431 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
432 myCanvas
->ClearBackground();
436 #endif // wxUSE_COLOURDLG
438 #if USE_COLOURDLG_GENERIC
439 void MyFrame::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
441 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
443 //FIXME:TODO:This has no effect...
444 m_clrData
.SetChooseFull(true);
446 for (int i
= 0; i
< 16; i
++)
449 (unsigned char)(i
*16),
450 (unsigned char)(i
*16),
451 (unsigned char)(i
*16)
453 m_clrData
.SetCustomColour(i
, colour
);
456 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
457 if (dialog
->ShowModal() == wxID_OK
)
459 m_clrData
= dialog
->GetColourData();
460 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
461 myCanvas
->ClearBackground();
466 #endif // USE_COLOURDLG_GENERIC
469 void MyFrame::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
472 data
.SetInitialFont(wxGetApp().m_canvasFont
);
473 data
.SetColour(wxGetApp().m_canvasTextColour
);
475 // you might also do this:
477 // wxFontDialog dialog;
478 // if ( !dialog.Create(this, data) { ... error ... }
480 wxFontDialog
dialog(this, data
);
482 if (dialog
.ShowModal() == wxID_OK
)
484 wxFontData retData
= dialog
.GetFontData();
485 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
486 wxGetApp().m_canvasTextColour
= retData
.GetColour();
489 //else: cancelled by the user, don't change the font
491 #endif // wxUSE_FONTDLG
493 #if USE_FONTDLG_GENERIC
494 void MyFrame::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
497 data
.SetInitialFont(wxGetApp().m_canvasFont
);
498 data
.SetColour(wxGetApp().m_canvasTextColour
);
500 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, &data
);
501 if (dialog
->ShowModal() == wxID_OK
)
503 wxFontData retData
= dialog
->GetFontData();
504 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
505 wxGetApp().m_canvasTextColour
= retData
.GetColour();
510 #endif // USE_FONTDLG_GENERIC
513 void MyFrame::LogDialog(wxCommandEvent
& WXUNUSED(event
))
515 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
516 // being flushed -- test it
519 wxLogMessage(wxT("This is some message - everything is ok so far."));
520 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
521 wxLogWarning(wxT("And then something went wrong!"));
523 // and if ~wxBusyCursor doesn't do it, then call it manually
527 wxLogError(wxT("Intermediary error handler decided to abort."));
528 wxLogError(wxT("The top level caller detected an unrecoverable error."));
530 wxLog::FlushActive();
532 wxLogMessage(wxT("And this is the same dialog but with only one message."));
534 #endif // wxUSE_LOG_DIALOG
536 void MyFrame::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
538 wxMessageDialog
dialog( NULL
, _T("This is a message box\nA long, long string to test out the message box properly"),
539 _T("Message box text"), wxNO_DEFAULT
|wxYES_NO
|wxCANCEL
|wxICON_INFORMATION
);
541 switch ( dialog
.ShowModal() )
544 wxLogStatus(wxT("You pressed \"Yes\""));
548 wxLogStatus(wxT("You pressed \"No\""));
552 wxLogStatus(wxT("You pressed \"Cancel\""));
556 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
561 void MyFrame::NumericEntry(wxCommandEvent
& WXUNUSED(event
) )
563 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
564 _T("Even two rows of text."),
565 _T("Enter a number:"), _T("Numeric input test"),
572 msg
= _T("Invalid number entered or dialog cancelled.");
577 msg
.Printf(_T("You've entered %lu"), res
);
578 icon
= wxICON_INFORMATION
;
581 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
583 #endif // wxUSE_NUMBERDLG
586 void MyFrame::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
588 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
589 _T("Password entry dialog"),
594 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd
.c_str()),
595 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
599 void MyFrame::TextEntry(wxCommandEvent
& WXUNUSED(event
))
601 wxTextEntryDialog
dialog(this,
602 _T("This is a small sample\n")
603 _T("A long, long string to test out the text entrybox"),
604 _T("Please enter a string"),
608 if (dialog
.ShowModal() == wxID_OK
)
610 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
613 #endif // wxUSE_TEXTDLG
616 void MyFrame::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
618 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
620 wxSingleChoiceDialog
dialog(this,
621 _T("This is a small sample\n")
622 _T("A single-choice convenience dialog"),
623 _T("Please select a value"),
624 WXSIZEOF(choices
), choices
);
626 dialog
.SetSelection(2);
628 if (dialog
.ShowModal() == wxID_OK
)
630 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
635 void MyFrame::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
637 const wxString choices
[] =
639 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
640 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
641 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
644 wxArrayInt selections
;
645 size_t count
= wxGetMultipleChoices(selections
,
646 _T("This is a small sample\n")
647 _T("A multi-choice convenience dialog"),
648 _T("Please select a value"),
649 WXSIZEOF(choices
), choices
,
654 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
655 for ( size_t n
= 0; n
< count
; n
++ )
657 msg
+= wxString::Format(wxT("\t%u: %u (%s)\n"),
658 (unsigned)n
, (unsigned)selections
[n
],
659 choices
[selections
[n
]].c_str());
663 //else: cancelled or nothing selected
665 #endif // wxUSE_CHOICEDLG
668 void MyFrame::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
673 _T("Testing open file dialog"),
677 _T("C++ files (*.cpp)|*.cpp")
679 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
683 dialog
.SetDirectory(wxGetHomeDir());
685 if (dialog
.ShowModal() == wxID_OK
)
688 info
.Printf(_T("Full file name: %s\n")
691 dialog
.GetPath().c_str(),
692 dialog
.GetDirectory().c_str(),
693 dialog
.GetFilename().c_str());
694 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
699 // this shows how to take advantage of specifying a default extension in the
700 // call to wxFileSelector: it is remembered after each new call and the next
701 // one will use it by default
702 void MyFrame::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
704 static wxString s_extDef
;
705 wxString path
= wxFileSelector(
706 _T("Select the file to load"),
707 wxEmptyString
, wxEmptyString
,
711 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
712 wxFileSelectorDefaultWildcardStr
,
713 wxFileSelectorDefaultWildcardStr
722 // it is just a sample, would use wxSplitPath in real program
723 s_extDef
= path
.AfterLast(_T('.'));
725 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
726 (const wxChar
*) path
, (const wxChar
*) s_extDef
);
729 void MyFrame::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
733 _T("C++ files (*.cpp)|*.cpp");
737 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
738 wxFileSelectorDefaultWildcardStr
,
739 wxFileSelectorDefaultWildcardStr
742 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
743 wxEmptyString
, wxEmptyString
, wildcards
,
746 if (dialog
.ShowModal() == wxID_OK
)
748 wxArrayString paths
, filenames
;
750 dialog
.GetPaths(paths
);
751 dialog
.GetFilenames(filenames
);
754 size_t count
= paths
.GetCount();
755 for ( size_t n
= 0; n
< count
; n
++ )
757 s
.Printf(_T("File %d: %s (%s)\n"),
758 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
762 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
765 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
770 void MyFrame::FileSave(wxCommandEvent
& WXUNUSED(event
) )
772 wxFileDialog
dialog(this,
773 _T("Testing save file dialog"),
776 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
777 wxSAVE
|wxOVERWRITE_PROMPT
);
779 dialog
.SetFilterIndex(1);
781 if (dialog
.ShowModal() == wxID_OK
)
783 wxLogMessage(_T("%s, filter %d"),
784 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
787 #endif // wxUSE_FILEDLG
789 #if USE_FILEDLG_GENERIC
790 void MyFrame::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
792 wxGenericFileDialog dialog
795 _T("Testing open file dialog"),
798 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
801 dialog
.SetDirectory(wxGetHomeDir());
803 if (dialog
.ShowModal() == wxID_OK
)
806 info
.Printf(_T("Full file name: %s\n")
809 dialog
.GetPath().c_str(),
810 dialog
.GetDirectory().c_str(),
811 dialog
.GetFilename().c_str());
812 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
817 void MyFrame::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
819 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
820 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
821 wxEmptyString
, wxEmptyString
, wildcards
,
824 if (dialog
.ShowModal() == wxID_OK
)
826 wxArrayString paths
, filenames
;
828 dialog
.GetPaths(paths
);
829 dialog
.GetFilenames(filenames
);
832 size_t count
= paths
.GetCount();
833 for ( size_t n
= 0; n
< count
; n
++ )
835 s
.Printf(_T("File %d: %s (%s)\n"),
836 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
840 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
843 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
848 void MyFrame::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
850 wxGenericFileDialog
dialog(this,
851 _T("Testing save file dialog"),
854 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
855 wxSAVE
|wxOVERWRITE_PROMPT
);
857 dialog
.SetFilterIndex(1);
859 if (dialog
.ShowModal() == wxID_OK
)
861 wxLogMessage(_T("%s, filter %d"),
862 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
865 #endif // USE_FILEDLG_GENERIC
868 void MyFrame::DoDirChoose(int style
)
870 // pass some initial dir to wxDirDialog
872 wxGetHomeDir(&dirHome
);
874 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
876 if (dialog
.ShowModal() == wxID_OK
)
878 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
882 void MyFrame::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
884 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_NEW_DIR_BUTTON
);
887 void MyFrame::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
889 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_NEW_DIR_BUTTON
);
891 #endif // wxUSE_DIRDLG
893 #if USE_DIRDLG_GENERIC
894 void MyFrame::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
896 // pass some initial dir to wxDirDialog
898 wxGetHomeDir(&dirHome
);
900 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
902 if (dialog
.ShowModal() == wxID_OK
)
904 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
908 #endif // USE_DIRDLG_GENERIC
910 #if USE_MODAL_PRESENTATION
911 void MyFrame::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
913 MyModalDialog
dlg(this);
917 void MyFrame::ModelessDlg(wxCommandEvent
& event
)
919 bool show
= GetMenuBar()->IsChecked(event
.GetId());
925 m_dialog
= new MyModelessDialog(this);
928 m_dialog
->Show(true);
932 // If m_dialog is NULL, then possibly the system
933 // didn't report the checked menu item status correctly.
934 // It should be true just after the menu item was selected,
935 // if there was no modeless dialog yet.
937 wxASSERT( m_dialog
!= NULL
);
942 #endif // USE_MODAL_PRESENTATION
944 #if wxUSE_STARTUP_TIPS
945 void MyFrame::ShowTip(wxCommandEvent
& WXUNUSED(event
))
947 static size_t s_index
= (size_t)-1;
949 if ( s_index
== (size_t)-1 )
953 // this is completely bogus, we don't know how many lines are there
954 // in the file, but who cares, it's a demo only...
955 s_index
= rand() % 5;
958 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
960 bool showAtStartup
= wxShowTip(this, tipProvider
);
964 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
965 wxOK
| wxICON_INFORMATION
, this);
968 s_index
= tipProvider
->GetCurrentTip();
971 #endif // wxUSE_STARTUP_TIPS
973 #if USE_SETTINGS_DIALOG
974 void MyFrame::OnPropertySheet(wxCommandEvent
& WXUNUSED(event
))
976 SettingsDialog
dialog(this);
979 #endif // USE_SETTINGS_DIALOG
981 void MyFrame::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
983 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
987 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
990 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
) )
995 #if wxUSE_PROGRESSDLG
997 void MyFrame::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
999 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1000 // check the performance
1001 int countrandomnumbers
= 0, count
= 0;
1002 wxTimeSpan
tsTest(0,0,0,250);
1003 wxDateTime DT2
, DT1
= wxDateTime::UNow();
1008 ++countrandomnumbers
;
1009 if ( countrandomnumbers
== 1000 )
1012 countrandomnumbers
= 0;
1014 DT2
= wxDateTime::UNow();
1015 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1016 if ( ts
.IsLongerThan( tsTest
) )
1022 const int max
= 40 * count
;
1024 static const int max
= 10;
1025 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
1027 wxProgressDialog
dialog(_T("Progress dialog example"),
1028 _T("An informative message"),
1034 // wxPD_AUTO_HIDE | -- try this as well
1036 wxPD_ESTIMATED_TIME
|
1037 wxPD_REMAINING_TIME
|
1042 // each skip will move progress about quarter forward
1043 for ( int i
= 0; i
<= max
; i
= wxMin(i
+(skip
?int(max
/4):1), max
+1), skip
= false )
1045 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1046 // do (almost) the same operations as we did for the performance test
1048 for ( int j
= 0; j
< 1000; j
++ )
1053 DT2
= wxDateTime::UNow();
1054 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1055 if ( ts
.IsLongerThan( tsTest
) )
1069 msg
= _T("That's all, folks!");
1071 else if ( i
> max
/ 2 )
1073 msg
= _T("Only a half left (very long message)!");
1076 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1077 if ( (i
% (max
/100)) == 0 ) // // only 100 updates, this makes it much faster
1079 cont
= dialog
.Update(i
, msg
, &skip
);
1082 cont
= dialog
.Update(i
, msg
, &skip
);
1087 if ( wxMessageBox(_T("Do you really want to cancel?"),
1088 _T("Progress dialog question"), // caption
1089 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1099 wxLogStatus(wxT("Progress dialog aborted!"));
1103 wxLogStatus(wxT("Countdown from %d finished"), max
);
1107 #endif // wxUSE_PROGRESSDLG
1111 void MyFrame::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1113 wxWindowDisabler disableAll
;
1115 wxBusyInfo
info(_T("Working, please wait..."), this);
1117 for ( int i
= 0; i
< 18; i
++ )
1127 #endif // wxUSE_BUSYINFO
1129 #if wxUSE_FINDREPLDLG
1131 void MyFrame::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1135 delete m_dlgReplace
;
1136 m_dlgReplace
= NULL
;
1140 m_dlgReplace
= new wxFindReplaceDialog
1144 _T("Find and replace dialog"),
1148 m_dlgReplace
->Show(true);
1152 void MyFrame::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1161 m_dlgFind
= new wxFindReplaceDialog
1170 m_dlgFind
->Show(true);
1174 static wxString
DecodeFindDialogEventFlags(int flags
)
1177 str
<< (flags
& wxFR_DOWN
? _T("down") : _T("up")) << _T(", ")
1178 << (flags
& wxFR_WHOLEWORD
? _T("whole words only, ") : _T(""))
1179 << (flags
& wxFR_MATCHCASE
? _T("") : _T("not "))
1180 << _T("case sensitive");
1185 void MyFrame::OnFindDialog(wxFindDialogEvent
& event
)
1187 wxEventType type
= event
.GetEventType();
1189 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1191 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1192 type
== wxEVT_COMMAND_FIND_NEXT
? wxT("next ") : wxT(""),
1193 event
.GetFindString().c_str(),
1194 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1196 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1197 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1199 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1200 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
? _T("all ") : wxT(""),
1201 event
.GetFindString().c_str(),
1202 event
.GetReplaceString().c_str(),
1203 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1205 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1207 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1211 if ( dlg
== m_dlgFind
)
1214 idMenu
= DIALOGS_FIND
;
1217 else if ( dlg
== m_dlgReplace
)
1219 txt
= _T("Replace");
1220 idMenu
= DIALOGS_REPLACE
;
1221 m_dlgReplace
= NULL
;
1225 txt
= _T("Unknown");
1228 wxFAIL_MSG( _T("unexpected event") );
1231 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1233 if ( idMenu
!= wxID_ANY
)
1235 GetMenuBar()->Check(idMenu
, false);
1242 wxLogError(wxT("Unknown find dialog event!"));
1246 #endif // wxUSE_FINDREPLDLG
1248 // ----------------------------------------------------------------------------
1250 // ----------------------------------------------------------------------------
1252 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1255 dc
.SetFont(wxGetApp().m_canvasFont
);
1256 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1257 dc
.SetBackgroundMode(wxTRANSPARENT
);
1259 _T("wxWidgets common dialogs")
1260 #if !defined(__SMARTPHONE__)
1261 _T(" test application")
1266 #if USE_MODAL_PRESENTATION
1268 // ----------------------------------------------------------------------------
1270 // ----------------------------------------------------------------------------
1272 MyModelessDialog::MyModelessDialog(wxWindow
*parent
)
1273 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1275 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1277 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1278 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1281 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1282 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1286 sizerTop
->SetSizeHints(this);
1287 sizerTop
->Fit(this);
1290 void MyModelessDialog::OnButton(wxCommandEvent
& WXUNUSED(event
))
1292 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1293 wxOK
| wxICON_INFORMATION
, this);
1296 void MyModelessDialog::OnClose(wxCloseEvent
& event
)
1298 if ( event
.CanVeto() )
1300 wxMessageBox(_T("Use the menu item to close this dialog"),
1301 _T("Modeless dialog"),
1302 wxOK
| wxICON_INFORMATION
, this);
1308 // ----------------------------------------------------------------------------
1310 // ----------------------------------------------------------------------------
1312 MyModalDialog::MyModalDialog(wxWindow
*parent
)
1313 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1315 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1317 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1318 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1319 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1321 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1322 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1323 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1324 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1325 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1329 sizerTop
->SetSizeHints(this);
1330 sizerTop
->Fit(this);
1332 m_btnModal
->SetFocus();
1333 m_btnModal
->SetDefault();
1336 void MyModalDialog::OnButton(wxCommandEvent
& event
)
1338 if ( event
.GetEventObject() == m_btnDelete
)
1343 m_btnDelete
->Disable();
1345 else if ( event
.GetEventObject() == m_btnModal
)
1348 wxGetTextFromUser(_T("Dummy prompt"),
1349 _T("Modal dialog called from dialog"),
1350 wxEmptyString
, this);
1352 wxMessageBox(_T("Modal dialog called from dialog"));
1353 #endif // wxUSE_TEXTDLG
1355 else if ( event
.GetEventObject() == m_btnModeless
)
1357 (new MyModelessDialog(this))->Show();
1365 #endif // USE_MODAL_PRESENTATION
1367 #if USE_SETTINGS_DIALOG
1368 // ----------------------------------------------------------------------------
1370 // ----------------------------------------------------------------------------
1372 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1374 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1377 SettingsDialog::SettingsDialog(wxWindow
* win
)
1379 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
|wxWS_EX_VALIDATE_RECURSIVELY
);
1381 Create(win
, wxID_ANY
, _("Preferences"), wxDefaultPosition
, wxDefaultSize
,
1382 wxDEFAULT_DIALOG_STYLE
1387 CreateButtons(wxOK
|wxCANCEL
|wxHELP
);
1389 wxBookCtrlBase
* notebook
= GetBookCtrl();
1391 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
1392 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
1394 notebook
->AddPage(generalSettings
, _("General"));
1395 notebook
->AddPage(aestheticSettings
, _("Aesthetics"));
1400 wxPanel
* SettingsDialog::CreateGeneralSettingsPage(wxWindow
* parent
)
1402 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1404 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1405 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1409 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
1410 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
1411 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1412 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
1416 wxString autoSaveLabel
= _("&Auto-save every");
1417 wxString minsLabel
= _("mins");
1419 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
1420 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
1423 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
1424 wxDefaultPosition
, wxSize(40, wxDefaultCoord
), wxSP_ARROW_KEYS
, 1, 60, 1);
1427 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1429 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1431 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1432 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
1436 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
1437 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
1438 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1439 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
1441 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1443 panel
->SetSizer(topSizer
);
1444 topSizer
->Fit(panel
);
1449 wxPanel
* SettingsDialog::CreateAestheticSettingsPage(wxWindow
* parent
)
1451 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1453 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1454 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1456 //// PROJECT OR GLOBAL
1457 wxString globalOrProjectChoices
[2];
1458 globalOrProjectChoices
[0] = _("&New projects");
1459 globalOrProjectChoices
[1] = _("&This project");
1461 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
1462 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
1463 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
1465 projectOrGlobal
->SetSelection(0);
1467 //// BACKGROUND STYLE
1468 wxArrayString backgroundStyleChoices
;
1469 backgroundStyleChoices
.Add(wxT("Colour"));
1470 backgroundStyleChoices
.Add(wxT("Image"));
1471 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, wxID_ANY
, _("Background style:"));
1473 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
1474 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
1476 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
1478 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
1480 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1481 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
1482 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1484 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
1487 //// FONT SIZE SELECTION
1489 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, wxID_ANY
, _("Tile font size:"));
1490 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
1492 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
1493 wxSize(80, wxDefaultCoord
));
1494 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
1496 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
1499 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1500 topSizer
->AddSpacer(5);
1502 panel
->SetSizer(topSizer
);
1503 topSizer
->Fit(panel
);
1508 #endif // USE_SETTINGS_DIALOG