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"
32 #include "wx/bookctrl.h"
35 #include "wx/colordlg.h"
36 #endif // wxUSE_COLOURDLG
39 #include "wx/choicdlg.h"
40 #endif // wxUSE_CHOICEDLG
42 #if wxUSE_STARTUP_TIPS
43 #include "wx/tipdlg.h"
44 #endif // wxUSE_STARTUP_TIPS
47 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
48 #include <wx/datetime.h> // wxDateTime
51 #include "wx/progdlg.h"
52 #endif // wxUSE_PROGRESSDLG
55 #include "wx/busyinfo.h"
56 #endif // wxUSE_BUSYINFO
59 #include "wx/numdlg.h"
60 #endif // wxUSE_NUMBERDLG
63 #include "wx/filedlg.h"
64 #endif // wxUSE_FILEDLG
67 #include "wx/dirdlg.h"
68 #endif // wxUSE_DIRDLG
71 #include "wx/fontdlg.h"
72 #endif // wxUSE_FONTDLG
75 #include "wx/fdrepdlg.h"
76 #endif // wxUSE_FINDREPLDLG
79 #include "wx/spinctrl.h"
82 #include "wx/propdlg.h"
86 #if USE_COLOURDLG_GENERIC
87 #include "wx/generic/colrdlgg.h"
88 #endif // USE_COLOURDLG_GENERIC
90 #if USE_DIRDLG_GENERIC
91 #include "wx/generic/dirdlgg.h"
92 #endif // USE_DIRDLG_GENERIC
94 #if USE_FILEDLG_GENERIC
95 #include "wx/generic/filedlgg.h"
96 #endif // USE_FILEDLG_GENERIC
98 #if USE_FONTDLG_GENERIC
99 #include "wx/generic/fontdlgg.h"
100 #endif // USE_FONTDLG_GENERIC
104 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
105 EVT_PAINT(MyCanvas::OnPaint
)
110 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
111 EVT_MENU(DIALOGS_MESSAGE_BOX
, MyFrame::MessageBox
)
114 EVT_MENU(DIALOGS_CHOOSE_COLOUR
, MyFrame::ChooseColour
)
115 #endif // wxUSE_COLOURDLG
118 EVT_MENU(DIALOGS_CHOOSE_FONT
, MyFrame::ChooseFont
)
119 #endif // wxUSE_FONTDLG
122 EVT_MENU(DIALOGS_LOG_DIALOG
, MyFrame::LogDialog
)
123 #endif // wxUSE_LOG_DIALOG
126 EVT_MENU(DIALOGS_TEXT_ENTRY
, MyFrame::TextEntry
)
127 EVT_MENU(DIALOGS_PASSWORD_ENTRY
, MyFrame::PasswordEntry
)
128 #endif // wxUSE_TEXTDLG
131 EVT_MENU(DIALOGS_NUM_ENTRY
, MyFrame::NumericEntry
)
132 #endif // wxUSE_NUMBERDLG
135 EVT_MENU(DIALOGS_SINGLE_CHOICE
, MyFrame::SingleChoice
)
136 EVT_MENU(DIALOGS_MULTI_CHOICE
, MyFrame::MultiChoice
)
137 #endif // wxUSE_CHOICEDLG
140 EVT_MENU(DIALOGS_FILE_OPEN
, MyFrame::FileOpen
)
141 EVT_MENU(DIALOGS_FILE_OPEN2
, MyFrame::FileOpen2
)
142 EVT_MENU(DIALOGS_FILES_OPEN
, MyFrame::FilesOpen
)
143 EVT_MENU(DIALOGS_FILE_SAVE
, MyFrame::FileSave
)
144 #endif // wxUSE_FILEDLG
146 #if USE_FILEDLG_GENERIC
147 EVT_MENU(DIALOGS_FILE_OPEN_GENERIC
, MyFrame::FileOpenGeneric
)
148 EVT_MENU(DIALOGS_FILES_OPEN_GENERIC
, MyFrame::FilesOpenGeneric
)
149 EVT_MENU(DIALOGS_FILE_SAVE_GENERIC
, MyFrame::FileSaveGeneric
)
150 #endif // USE_FILEDLG_GENERIC
153 EVT_MENU(DIALOGS_DIR_CHOOSE
, MyFrame::DirChoose
)
154 EVT_MENU(DIALOGS_DIRNEW_CHOOSE
, MyFrame::DirChooseNew
)
155 #endif // wxUSE_DIRDLG
157 #if USE_MODAL_PRESENTATION
158 EVT_MENU(DIALOGS_MODAL
, MyFrame::ModalDlg
)
159 EVT_MENU(DIALOGS_MODELESS
, MyFrame::ModelessDlg
)
162 #if wxUSE_STARTUP_TIPS
163 EVT_MENU(DIALOGS_TIP
, MyFrame::ShowTip
)
164 #endif // wxUSE_STARTUP_TIPS
166 #if USE_FONTDLG_GENERIC
167 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC
, MyFrame::ChooseFontGeneric
)
168 #endif // USE_FONTDLG_GENERIC
170 #if USE_DIRDLG_GENERIC
171 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE
, MyFrame::GenericDirChoose
)
172 #endif // wxMSW || wxMAC
174 #if USE_COLOURDLG_GENERIC
175 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC
, MyFrame::ChooseColourGeneric
)
176 #endif // USE_COLOURDLG_GENERIC
178 #if wxUSE_PROGRESSDLG
179 EVT_MENU(DIALOGS_PROGRESS
, MyFrame::ShowProgress
)
180 #endif // wxUSE_PROGRESSDLG
183 EVT_MENU(DIALOGS_BUSYINFO
, MyFrame::ShowBusyInfo
)
184 #endif // wxUSE_BUSYINFO
186 #if wxUSE_FINDREPLDLG
187 EVT_MENU(DIALOGS_FIND
, MyFrame::ShowFindDialog
)
188 EVT_MENU(DIALOGS_REPLACE
, MyFrame::ShowReplaceDialog
)
190 EVT_FIND(wxID_ANY
, MyFrame::OnFindDialog
)
191 EVT_FIND_NEXT(wxID_ANY
, MyFrame::OnFindDialog
)
192 EVT_FIND_REPLACE(wxID_ANY
, MyFrame::OnFindDialog
)
193 EVT_FIND_REPLACE_ALL(wxID_ANY
, MyFrame::OnFindDialog
)
194 EVT_FIND_CLOSE(wxID_ANY
, MyFrame::OnFindDialog
)
195 #endif // wxUSE_FINDREPLDLG
197 #if USE_SETTINGS_DIALOG
198 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame::OnPropertySheet
)
201 EVT_MENU(DIALOGS_REQUEST
, MyFrame::OnRequestUserAttention
)
203 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
206 #if USE_MODAL_PRESENTATION
208 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
209 EVT_BUTTON(wxID_ANY
, MyModalDialog::OnButton
)
212 BEGIN_EVENT_TABLE(MyModelessDialog
, wxDialog
)
213 EVT_BUTTON(DIALOGS_MODELESS_BTN
, MyModelessDialog::OnButton
)
214 EVT_CLOSE(MyModelessDialog::OnClose
)
217 #endif // USE_MODAL_PRESENTATION
219 MyCanvas
*myCanvas
= (MyCanvas
*) NULL
;
221 // `Main program' equivalent, creating windows and returning main app frame
225 wxInitAllImageHandlers();
228 m_canvasTextColour
= wxColour(_T("BLACK"));
229 m_canvasFont
= *wxNORMAL_FONT
;
231 // Create the main frame window
232 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets dialogs example"));
235 wxMenu
*file_menu
= new wxMenu
;
237 file_menu
->Append(DIALOGS_MESSAGE_BOX
, _T("&Message box\tCtrl-M"));
240 #if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
242 wxMenu
*choices_menu
= new wxMenu
;
245 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR
, _T("&Choose colour"));
246 #endif // wxUSE_COLOURDLG
249 choices_menu
->Append(DIALOGS_CHOOSE_FONT
, _T("Choose &font"));
250 #endif // wxUSE_FONTDLG
253 choices_menu
->Append(DIALOGS_SINGLE_CHOICE
, _T("&Single choice\tCtrl-C"));
254 choices_menu
->Append(DIALOGS_MULTI_CHOICE
, _T("M&ultiple choice\tCtrl-U"));
255 #endif // wxUSE_CHOICEDLG
257 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
258 choices_menu
->AppendSeparator();
259 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
261 #if USE_COLOURDLG_GENERIC
262 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR_GENERIC
, _T("&Choose colour (generic)"));
263 #endif // USE_COLOURDLG_GENERIC
265 #if USE_FONTDLG_GENERIC
266 choices_menu
->Append(DIALOGS_CHOOSE_FONT_GENERIC
, _T("Choose &font (generic)"));
267 #endif // USE_FONTDLG_GENERIC
269 file_menu
->Append(wxID_ANY
,_T("&Choices and selectors"),choices_menu
);
270 #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
273 #if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
275 wxMenu
*entry_menu
= new wxMenu
;
278 entry_menu
->Append(DIALOGS_TEXT_ENTRY
, _T("Text &entry\tCtrl-E"));
279 entry_menu
->Append(DIALOGS_PASSWORD_ENTRY
, _T("&Password entry\tCtrl-P"));
280 #endif // wxUSE_TEXTDLG
283 entry_menu
->Append(DIALOGS_NUM_ENTRY
, _T("&Numeric entry\tCtrl-N"));
284 #endif // wxUSE_NUMBERDLG
286 file_menu
->Append(wxID_ANY
,_T("&Entry dialogs"),entry_menu
);
288 #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
293 wxMenu
*filedlg_menu
= new wxMenu
;
294 filedlg_menu
->Append(DIALOGS_FILE_OPEN
, _T("&Open file\tCtrl-O"));
295 filedlg_menu
->Append(DIALOGS_FILE_OPEN2
, _T("&Second open file\tCtrl-2"));
296 filedlg_menu
->Append(DIALOGS_FILES_OPEN
, _T("Open &files\tCtrl-Q"));
297 filedlg_menu
->Append(DIALOGS_FILE_SAVE
, _T("Sa&ve file\tCtrl-S"));
299 #if USE_FILEDLG_GENERIC
300 filedlg_menu
->AppendSeparator();
301 filedlg_menu
->Append(DIALOGS_FILE_OPEN_GENERIC
, _T("&Open file (generic)"));
302 filedlg_menu
->Append(DIALOGS_FILES_OPEN_GENERIC
, _T("Open &files (generic)"));
303 filedlg_menu
->Append(DIALOGS_FILE_SAVE_GENERIC
, _T("Sa&ve file (generic)"));
304 #endif // USE_FILEDLG_GENERIC
306 file_menu
->Append(wxID_ANY
,_T("&File operations"),filedlg_menu
);
308 #endif // wxUSE_FILEDLG
311 wxMenu
*dir_menu
= new wxMenu
;
313 dir_menu
->Append(DIALOGS_DIR_CHOOSE
, _T("&Choose a directory\tCtrl-D"));
314 dir_menu
->Append(DIALOGS_DIRNEW_CHOOSE
, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
315 file_menu
->Append(wxID_ANY
,_T("&Directory operations"),dir_menu
);
317 #if USE_DIRDLG_GENERIC
318 dir_menu
->AppendSeparator();
319 dir_menu
->Append(DIALOGS_GENERIC_DIR_CHOOSE
, _T("&Choose a directory (generic)"));
320 #endif // USE_DIRDLG_GENERIC
322 #endif // wxUSE_DIRDLG
325 #if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
327 wxMenu
*info_menu
= new wxMenu
;
329 #if wxUSE_STARTUP_TIPS
330 info_menu
->Append(DIALOGS_TIP
, _T("&Tip of the day\tCtrl-T"));
331 #endif // wxUSE_STARTUP_TIPS
333 #if wxUSE_PROGRESSDLG
334 info_menu
->Append(DIALOGS_PROGRESS
, _T("Pro&gress dialog\tCtrl-G"));
335 #endif // wxUSE_PROGRESSDLG
338 info_menu
->Append(DIALOGS_BUSYINFO
, _T("&Busy info dialog\tCtrl-B"));
339 #endif // wxUSE_BUSYINFO
342 info_menu
->Append(DIALOGS_LOG_DIALOG
, _T("&Log dialog\tCtrl-L"));
343 #endif // wxUSE_LOG_DIALOG
345 file_menu
->Append(wxID_ANY
,_T("&Informative dialogs"),info_menu
);
347 #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
350 #if wxUSE_FINDREPLDLG
351 wxMenu
*find_menu
= new wxMenu
;
352 find_menu
->AppendCheckItem(DIALOGS_FIND
, _T("&Find dialog\tCtrl-F"));
353 find_menu
->AppendCheckItem(DIALOGS_REPLACE
, _T("Find and &replace dialog\tShift-Ctrl-F"));
354 file_menu
->Append(wxID_ANY
,_T("&Searching"),find_menu
);
355 #endif // wxUSE_FINDREPLDLG
357 #if USE_MODAL_PRESENTATION
358 wxMenu
*modal_menu
= new wxMenu
;
359 modal_menu
->Append(DIALOGS_MODAL
, _T("Mo&dal dialog\tCtrl-W"));
360 modal_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Modeless &dialog\tCtrl-Z"));
361 file_menu
->Append(wxID_ANY
,_T("&Modal/Modeless"),modal_menu
);
362 #endif // USE_MODAL_PRESENTATION
364 #if USE_SETTINGS_DIALOG
365 file_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Property Sheet Dialog\tCtrl-P"));
368 file_menu
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
370 file_menu
->AppendSeparator();
371 file_menu
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
373 wxMenuBar
*menu_bar
= new wxMenuBar
;
374 menu_bar
->Append(file_menu
, _T("&File"));
375 frame
->SetMenuBar(menu_bar
);
377 myCanvas
= new MyCanvas(frame
);
378 myCanvas
->SetBackgroundColour(*wxWHITE
);
380 frame
->Centre(wxBOTH
);
390 // My frame constructor
391 MyFrame::MyFrame(wxWindow
*parent
,
392 const wxString
& title
)
393 : wxFrame(parent
, wxID_ANY
, title
)
397 #if USE_MODAL_PRESENTATION
398 m_dialog
= (MyModelessDialog
*)NULL
;
399 #endif // USE_MODAL_PRESENTATION
401 #if wxUSE_FINDREPLDLG
407 m_clrData
.SetChooseFull(true);
408 for (int i
= 0; i
< 16; i
++)
410 m_clrData
.SetCustomColour(
413 (unsigned char)(i
*16),
414 (unsigned char)(i
*16),
415 (unsigned char)(i
*16)
419 #endif // wxUSE_COLOURDLG
423 void MyFrame::ChooseColour(wxCommandEvent
& WXUNUSED(event
) )
425 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
427 wxColourDialog
dialog(this, &m_clrData
);
428 dialog
.SetTitle(_T("Choose the background colour"));
429 if (dialog
.ShowModal() == wxID_OK
)
431 m_clrData
= dialog
.GetColourData();
432 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
433 myCanvas
->ClearBackground();
437 #endif // wxUSE_COLOURDLG
439 #if USE_COLOURDLG_GENERIC
440 void MyFrame::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
442 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
444 //FIXME:TODO:This has no effect...
445 m_clrData
.SetChooseFull(true);
447 for (int i
= 0; i
< 16; i
++)
450 (unsigned char)(i
*16),
451 (unsigned char)(i
*16),
452 (unsigned char)(i
*16)
454 m_clrData
.SetCustomColour(i
, colour
);
457 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
458 if (dialog
->ShowModal() == wxID_OK
)
460 m_clrData
= dialog
->GetColourData();
461 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
462 myCanvas
->ClearBackground();
467 #endif // USE_COLOURDLG_GENERIC
470 void MyFrame::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
473 data
.SetInitialFont(wxGetApp().m_canvasFont
);
474 data
.SetColour(wxGetApp().m_canvasTextColour
);
476 // you might also do this:
478 // wxFontDialog dialog;
479 // if ( !dialog.Create(this, data) { ... error ... }
481 wxFontDialog
dialog(this, data
);
483 if (dialog
.ShowModal() == wxID_OK
)
485 wxFontData retData
= dialog
.GetFontData();
486 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
487 wxGetApp().m_canvasTextColour
= retData
.GetColour();
490 //else: cancelled by the user, don't change the font
492 #endif // wxUSE_FONTDLG
494 #if USE_FONTDLG_GENERIC
495 void MyFrame::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
498 data
.SetInitialFont(wxGetApp().m_canvasFont
);
499 data
.SetColour(wxGetApp().m_canvasTextColour
);
501 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, &data
);
502 if (dialog
->ShowModal() == wxID_OK
)
504 wxFontData retData
= dialog
->GetFontData();
505 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
506 wxGetApp().m_canvasTextColour
= retData
.GetColour();
511 #endif // USE_FONTDLG_GENERIC
514 void MyFrame::LogDialog(wxCommandEvent
& WXUNUSED(event
))
516 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
517 // being flushed -- test it
520 wxLogMessage(wxT("This is some message - everything is ok so far."));
521 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
522 wxLogWarning(wxT("And then something went wrong!"));
524 // and if ~wxBusyCursor doesn't do it, then call it manually
528 wxLogError(wxT("Intermediary error handler decided to abort."));
529 wxLogError(wxT("The top level caller detected an unrecoverable error."));
531 wxLog::FlushActive();
533 wxLogMessage(wxT("And this is the same dialog but with only one message."));
535 #endif // wxUSE_LOG_DIALOG
537 void MyFrame::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
539 wxMessageDialog
dialog( NULL
, _T("This is a message box\nA long, long string to test out the message box properly"),
540 _T("Message box text"), wxNO_DEFAULT
|wxYES_NO
|wxCANCEL
|wxICON_INFORMATION
);
542 switch ( dialog
.ShowModal() )
545 wxLogStatus(wxT("You pressed \"Yes\""));
549 wxLogStatus(wxT("You pressed \"No\""));
553 wxLogStatus(wxT("You pressed \"Cancel\""));
557 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
562 void MyFrame::NumericEntry(wxCommandEvent
& WXUNUSED(event
) )
564 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
565 _T("Even two rows of text."),
566 _T("Enter a number:"), _T("Numeric input test"),
573 msg
= _T("Invalid number entered or dialog cancelled.");
578 msg
.Printf(_T("You've entered %lu"), res
);
579 icon
= wxICON_INFORMATION
;
582 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
584 #endif // wxUSE_NUMBERDLG
587 void MyFrame::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
589 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
590 _T("Password entry dialog"),
595 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd
.c_str()),
596 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
600 void MyFrame::TextEntry(wxCommandEvent
& WXUNUSED(event
))
602 wxTextEntryDialog
dialog(this,
603 _T("This is a small sample\n")
604 _T("A long, long string to test out the text entrybox"),
605 _T("Please enter a string"),
609 if (dialog
.ShowModal() == wxID_OK
)
611 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
614 #endif // wxUSE_TEXTDLG
617 void MyFrame::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
619 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
621 wxSingleChoiceDialog
dialog(this,
622 _T("This is a small sample\n")
623 _T("A single-choice convenience dialog"),
624 _T("Please select a value"),
625 WXSIZEOF(choices
), choices
);
627 dialog
.SetSelection(2);
629 if (dialog
.ShowModal() == wxID_OK
)
631 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
636 void MyFrame::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
638 const wxString choices
[] =
640 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
641 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
642 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
645 wxArrayInt selections
;
646 size_t count
= wxGetMultipleChoices(selections
,
647 _T("This is a small sample\n")
648 _T("A multi-choice convenience dialog"),
649 _T("Please select a value"),
650 WXSIZEOF(choices
), choices
,
655 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
656 for ( size_t n
= 0; n
< count
; n
++ )
658 msg
+= wxString::Format(wxT("\t%u: %u (%s)\n"),
659 (unsigned)n
, (unsigned)selections
[n
],
660 choices
[selections
[n
]].c_str());
664 //else: cancelled or nothing selected
666 #endif // wxUSE_CHOICEDLG
669 void MyFrame::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
674 _T("Testing open file dialog"),
678 _T("C++ files (*.cpp)|*.cpp")
680 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
684 dialog
.SetDirectory(wxGetHomeDir());
686 if (dialog
.ShowModal() == wxID_OK
)
689 info
.Printf(_T("Full file name: %s\n")
692 dialog
.GetPath().c_str(),
693 dialog
.GetDirectory().c_str(),
694 dialog
.GetFilename().c_str());
695 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
700 // this shows how to take advantage of specifying a default extension in the
701 // call to wxFileSelector: it is remembered after each new call and the next
702 // one will use it by default
703 void MyFrame::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
705 static wxString s_extDef
;
706 wxString path
= wxFileSelector(
707 _T("Select the file to load"),
708 wxEmptyString
, wxEmptyString
,
712 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
713 wxFileSelectorDefaultWildcardStr
,
714 wxFileSelectorDefaultWildcardStr
723 // it is just a sample, would use wxSplitPath in real program
724 s_extDef
= path
.AfterLast(_T('.'));
726 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
727 (const wxChar
*) path
, (const wxChar
*) s_extDef
);
730 void MyFrame::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
734 _T("C++ files (*.cpp)|*.cpp");
738 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
739 wxFileSelectorDefaultWildcardStr
,
740 wxFileSelectorDefaultWildcardStr
743 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
744 wxEmptyString
, wxEmptyString
, wildcards
,
747 if (dialog
.ShowModal() == wxID_OK
)
749 wxArrayString paths
, filenames
;
751 dialog
.GetPaths(paths
);
752 dialog
.GetFilenames(filenames
);
755 size_t count
= paths
.GetCount();
756 for ( size_t n
= 0; n
< count
; n
++ )
758 s
.Printf(_T("File %d: %s (%s)\n"),
759 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
763 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
766 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
771 void MyFrame::FileSave(wxCommandEvent
& WXUNUSED(event
) )
773 wxFileDialog
dialog(this,
774 _T("Testing save file dialog"),
777 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
778 wxSAVE
|wxOVERWRITE_PROMPT
);
780 dialog
.SetFilterIndex(1);
782 if (dialog
.ShowModal() == wxID_OK
)
784 wxLogMessage(_T("%s, filter %d"),
785 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
788 #endif // wxUSE_FILEDLG
790 #if USE_FILEDLG_GENERIC
791 void MyFrame::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
793 wxGenericFileDialog dialog
796 _T("Testing open file dialog"),
799 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
802 dialog
.SetDirectory(wxGetHomeDir());
804 if (dialog
.ShowModal() == wxID_OK
)
807 info
.Printf(_T("Full file name: %s\n")
810 dialog
.GetPath().c_str(),
811 dialog
.GetDirectory().c_str(),
812 dialog
.GetFilename().c_str());
813 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
818 void MyFrame::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
820 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
821 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
822 wxEmptyString
, wxEmptyString
, wildcards
,
825 if (dialog
.ShowModal() == wxID_OK
)
827 wxArrayString paths
, filenames
;
829 dialog
.GetPaths(paths
);
830 dialog
.GetFilenames(filenames
);
833 size_t count
= paths
.GetCount();
834 for ( size_t n
= 0; n
< count
; n
++ )
836 s
.Printf(_T("File %d: %s (%s)\n"),
837 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
841 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
844 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
849 void MyFrame::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
851 wxGenericFileDialog
dialog(this,
852 _T("Testing save file dialog"),
855 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
856 wxSAVE
|wxOVERWRITE_PROMPT
);
858 dialog
.SetFilterIndex(1);
860 if (dialog
.ShowModal() == wxID_OK
)
862 wxLogMessage(_T("%s, filter %d"),
863 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
866 #endif // USE_FILEDLG_GENERIC
869 void MyFrame::DoDirChoose(int style
)
871 // pass some initial dir to wxDirDialog
873 wxGetHomeDir(&dirHome
);
875 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
877 if (dialog
.ShowModal() == wxID_OK
)
879 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
883 void MyFrame::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
885 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_NEW_DIR_BUTTON
);
888 void MyFrame::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
890 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_NEW_DIR_BUTTON
);
892 #endif // wxUSE_DIRDLG
894 #if USE_DIRDLG_GENERIC
895 void MyFrame::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
897 // pass some initial dir to wxDirDialog
899 wxGetHomeDir(&dirHome
);
901 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
903 if (dialog
.ShowModal() == wxID_OK
)
905 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
909 #endif // USE_DIRDLG_GENERIC
911 #if USE_MODAL_PRESENTATION
912 void MyFrame::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
914 MyModalDialog
dlg(this);
918 void MyFrame::ModelessDlg(wxCommandEvent
& event
)
920 bool show
= GetMenuBar()->IsChecked(event
.GetId());
926 m_dialog
= new MyModelessDialog(this);
929 m_dialog
->Show(true);
933 // If m_dialog is NULL, then possibly the system
934 // didn't report the checked menu item status correctly.
935 // It should be true just after the menu item was selected,
936 // if there was no modeless dialog yet.
938 wxASSERT( m_dialog
!= NULL
);
943 #endif // USE_MODAL_PRESENTATION
945 #if wxUSE_STARTUP_TIPS
946 void MyFrame::ShowTip(wxCommandEvent
& WXUNUSED(event
))
948 static size_t s_index
= (size_t)-1;
950 if ( s_index
== (size_t)-1 )
954 // this is completely bogus, we don't know how many lines are there
955 // in the file, but who cares, it's a demo only...
956 s_index
= rand() % 5;
959 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
961 bool showAtStartup
= wxShowTip(this, tipProvider
);
965 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
966 wxOK
| wxICON_INFORMATION
, this);
969 s_index
= tipProvider
->GetCurrentTip();
972 #endif // wxUSE_STARTUP_TIPS
974 #if USE_SETTINGS_DIALOG
975 void MyFrame::OnPropertySheet(wxCommandEvent
& WXUNUSED(event
))
977 SettingsDialog
dialog(this);
980 #endif // USE_SETTINGS_DIALOG
982 void MyFrame::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
984 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
988 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
991 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
) )
996 #if wxUSE_PROGRESSDLG
998 void MyFrame::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
1000 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1001 // check the performance
1002 int countrandomnumbers
= 0, count
= 0;
1003 wxTimeSpan
tsTest(0,0,0,250);
1004 wxDateTime DT2
, DT1
= wxDateTime::UNow();
1009 ++countrandomnumbers
;
1010 if ( countrandomnumbers
== 1000 )
1013 countrandomnumbers
= 0;
1015 DT2
= wxDateTime::UNow();
1016 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1017 if ( ts
.IsLongerThan( tsTest
) )
1023 const int max
= 40 * count
;
1025 static const int max
= 10;
1026 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
1028 wxProgressDialog
dialog(_T("Progress dialog example"),
1029 _T("An informative message"),
1035 // wxPD_AUTO_HIDE | -- try this as well
1037 wxPD_ESTIMATED_TIME
|
1038 wxPD_REMAINING_TIME
|
1043 // each skip will move progress about quarter forward
1044 for ( int i
= 0; i
<= max
; i
= wxMin(i
+(skip
?int(max
/4):1), max
+1), skip
= false )
1046 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1047 // do (almost) the same operations as we did for the performance test
1049 for ( int j
= 0; j
< 1000; j
++ )
1054 DT2
= wxDateTime::UNow();
1055 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1056 if ( ts
.IsLongerThan( tsTest
) )
1070 msg
= _T("That's all, folks!");
1072 else if ( i
> max
/ 2 )
1074 msg
= _T("Only a half left (very long message)!");
1077 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1078 if ( (i
% (max
/100)) == 0 ) // // only 100 updates, this makes it much faster
1080 cont
= dialog
.Update(i
, msg
, &skip
);
1083 cont
= dialog
.Update(i
, msg
, &skip
);
1088 if ( wxMessageBox(_T("Do you really want to cancel?"),
1089 _T("Progress dialog question"), // caption
1090 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1100 wxLogStatus(wxT("Progress dialog aborted!"));
1104 wxLogStatus(wxT("Countdown from %d finished"), max
);
1108 #endif // wxUSE_PROGRESSDLG
1112 void MyFrame::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1114 wxWindowDisabler disableAll
;
1116 wxBusyInfo
info(_T("Working, please wait..."), this);
1118 for ( int i
= 0; i
< 18; i
++ )
1128 #endif // wxUSE_BUSYINFO
1130 #if wxUSE_FINDREPLDLG
1132 void MyFrame::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1136 delete m_dlgReplace
;
1137 m_dlgReplace
= NULL
;
1141 m_dlgReplace
= new wxFindReplaceDialog
1145 _T("Find and replace dialog"),
1149 m_dlgReplace
->Show(true);
1153 void MyFrame::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1162 m_dlgFind
= new wxFindReplaceDialog
1171 m_dlgFind
->Show(true);
1175 static wxString
DecodeFindDialogEventFlags(int flags
)
1178 str
<< (flags
& wxFR_DOWN
? _T("down") : _T("up")) << _T(", ")
1179 << (flags
& wxFR_WHOLEWORD
? _T("whole words only, ") : _T(""))
1180 << (flags
& wxFR_MATCHCASE
? _T("") : _T("not "))
1181 << _T("case sensitive");
1186 void MyFrame::OnFindDialog(wxFindDialogEvent
& event
)
1188 wxEventType type
= event
.GetEventType();
1190 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1192 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1193 type
== wxEVT_COMMAND_FIND_NEXT
? wxT("next ") : wxT(""),
1194 event
.GetFindString().c_str(),
1195 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1197 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1198 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1200 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1201 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
? _T("all ") : wxT(""),
1202 event
.GetFindString().c_str(),
1203 event
.GetReplaceString().c_str(),
1204 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1206 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1208 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1212 if ( dlg
== m_dlgFind
)
1215 idMenu
= DIALOGS_FIND
;
1218 else if ( dlg
== m_dlgReplace
)
1220 txt
= _T("Replace");
1221 idMenu
= DIALOGS_REPLACE
;
1222 m_dlgReplace
= NULL
;
1226 txt
= _T("Unknown");
1229 wxFAIL_MSG( _T("unexpected event") );
1232 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1234 if ( idMenu
!= wxID_ANY
)
1236 GetMenuBar()->Check(idMenu
, false);
1243 wxLogError(wxT("Unknown find dialog event!"));
1247 #endif // wxUSE_FINDREPLDLG
1249 // ----------------------------------------------------------------------------
1251 // ----------------------------------------------------------------------------
1253 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1256 dc
.SetFont(wxGetApp().m_canvasFont
);
1257 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1258 dc
.SetBackgroundMode(wxTRANSPARENT
);
1260 _T("wxWidgets common dialogs")
1261 #if !defined(__SMARTPHONE__)
1262 _T(" test application")
1267 #if USE_MODAL_PRESENTATION
1269 // ----------------------------------------------------------------------------
1271 // ----------------------------------------------------------------------------
1273 MyModelessDialog::MyModelessDialog(wxWindow
*parent
)
1274 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1276 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1278 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1279 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1282 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1283 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1287 sizerTop
->SetSizeHints(this);
1288 sizerTop
->Fit(this);
1291 void MyModelessDialog::OnButton(wxCommandEvent
& WXUNUSED(event
))
1293 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1294 wxOK
| wxICON_INFORMATION
, this);
1297 void MyModelessDialog::OnClose(wxCloseEvent
& event
)
1299 if ( event
.CanVeto() )
1301 wxMessageBox(_T("Use the menu item to close this dialog"),
1302 _T("Modeless dialog"),
1303 wxOK
| wxICON_INFORMATION
, this);
1309 // ----------------------------------------------------------------------------
1311 // ----------------------------------------------------------------------------
1313 MyModalDialog::MyModalDialog(wxWindow
*parent
)
1314 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1316 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1318 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1319 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1320 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1322 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1323 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1324 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1325 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1326 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1330 sizerTop
->SetSizeHints(this);
1331 sizerTop
->Fit(this);
1333 m_btnModal
->SetFocus();
1334 m_btnModal
->SetDefault();
1337 void MyModalDialog::OnButton(wxCommandEvent
& event
)
1339 if ( event
.GetEventObject() == m_btnDelete
)
1344 m_btnDelete
->Disable();
1346 else if ( event
.GetEventObject() == m_btnModal
)
1349 wxGetTextFromUser(_T("Dummy prompt"),
1350 _T("Modal dialog called from dialog"),
1351 wxEmptyString
, this);
1353 wxMessageBox(_T("Modal dialog called from dialog"));
1354 #endif // wxUSE_TEXTDLG
1356 else if ( event
.GetEventObject() == m_btnModeless
)
1358 (new MyModelessDialog(this))->Show();
1366 #endif // USE_MODAL_PRESENTATION
1368 #if USE_SETTINGS_DIALOG
1369 // ----------------------------------------------------------------------------
1371 // ----------------------------------------------------------------------------
1373 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1375 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1378 SettingsDialog::SettingsDialog(wxWindow
* win
)
1380 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
|wxWS_EX_VALIDATE_RECURSIVELY
);
1382 Create(win
, wxID_ANY
, _("Preferences"), wxDefaultPosition
, wxDefaultSize
,
1383 wxDEFAULT_DIALOG_STYLE
1388 CreateButtons(wxOK
|wxCANCEL
|wxHELP
);
1390 wxBookCtrlBase
* notebook
= GetBookCtrl();
1392 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
1393 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
1395 notebook
->AddPage(generalSettings
, _("General"));
1396 notebook
->AddPage(aestheticSettings
, _("Aesthetics"));
1401 wxPanel
* SettingsDialog::CreateGeneralSettingsPage(wxWindow
* parent
)
1403 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1405 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1406 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1410 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
1411 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
1412 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1413 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
1417 wxString autoSaveLabel
= _("&Auto-save every");
1418 wxString minsLabel
= _("mins");
1420 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
1421 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
1424 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
1425 wxDefaultPosition
, wxSize(40, wxDefaultCoord
), wxSP_ARROW_KEYS
, 1, 60, 1);
1428 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1430 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1432 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1433 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
1437 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
1438 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
1439 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1440 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
1442 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1444 panel
->SetSizer(topSizer
);
1445 topSizer
->Fit(panel
);
1450 wxPanel
* SettingsDialog::CreateAestheticSettingsPage(wxWindow
* parent
)
1452 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1454 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1455 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1457 //// PROJECT OR GLOBAL
1458 wxString globalOrProjectChoices
[2];
1459 globalOrProjectChoices
[0] = _("&New projects");
1460 globalOrProjectChoices
[1] = _("&This project");
1462 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
1463 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
1464 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
1466 projectOrGlobal
->SetSelection(0);
1468 //// BACKGROUND STYLE
1469 wxArrayString backgroundStyleChoices
;
1470 backgroundStyleChoices
.Add(wxT("Colour"));
1471 backgroundStyleChoices
.Add(wxT("Image"));
1472 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, wxID_ANY
, _("Background style:"));
1474 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
1475 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
1477 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
1479 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
1481 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1482 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
1483 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1485 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
1488 //// FONT SIZE SELECTION
1490 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, wxID_ANY
, _("Tile font size:"));
1491 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
1493 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
1494 wxSize(80, wxDefaultCoord
));
1495 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
1497 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
1500 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1501 topSizer
->AddSpacer(5);
1503 panel
->SetSizer(topSizer
);
1504 topSizer
->Fit(panel
);
1509 #endif // USE_SETTINGS_DIALOG