1 /////////////////////////////////////////////////////////////////////////////
2 // Program: wxWidgets Widgets Sample
3 // Name: samples/widgets/widgets.cpp
4 // Purpose: Sample showing most of the simple wxWidgets widgets
5 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 Vadim Zeitlin
9 // License: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx/wx.h".
21 #include "wx/wxprec.h"
27 // for all others, include the necessary headers
34 #include "wx/button.h"
35 #include "wx/checkbox.h"
36 #include "wx/listbox.h"
37 #include "wx/statbox.h"
38 #include "wx/stattext.h"
39 #include "wx/textctrl.h"
40 #include "wx/msgdlg.h"
43 #include "wx/sysopt.h"
44 #include "wx/bookctrl.h"
45 #include "wx/treebook.h"
47 #include "wx/colordlg.h"
48 #include "wx/fontdlg.h"
49 #include "wx/textdlg.h"
50 #include "wx/imaglist.h"
51 #include "wx/wupdlock.h"
55 #include "../sample.xpm"
57 // ----------------------------------------------------------------------------
59 // ----------------------------------------------------------------------------
64 Widgets_ClearLog
= 100,
71 #endif // wxUSE_TOOLTIPS
83 Widgets_BorderDefault
,
85 Widgets_GlobalBusyCursor
,
89 Widgets_GoToPageLast
= Widgets_GoToPage
+ 100
92 const wxChar
*WidgetsCategories
[MAX_PAGES
] = {
93 #if defined(__WXUNIVERSAL__)
107 // ----------------------------------------------------------------------------
109 // ----------------------------------------------------------------------------
111 // Define a new application type, each program should derive a class from wxApp
112 class WidgetsApp
: public wxApp
115 // override base class virtuals
116 // ----------------------------
118 // this one is called on application startup and is a good place for the app
119 // initialization (doing it here and not in the ctor allows to have an error
120 // return: if OnInit() returns false, the application terminates)
121 virtual bool OnInit();
124 // Define a new frame type: this is going to be our main frame
125 class WidgetsFrame
: public wxFrame
129 WidgetsFrame(const wxString
& title
);
130 virtual ~WidgetsFrame();
135 void OnButtonClearLog(wxCommandEvent
& event
);
137 void OnExit(wxCommandEvent
& event
);
140 void OnPageChanged(WidgetsBookCtrlEvent
& event
);
141 void OnGoToPage(wxCommandEvent
& event
);
144 void OnSetTooltip(wxCommandEvent
& event
);
145 #endif // wxUSE_TOOLTIPS
146 void OnSetFgCol(wxCommandEvent
& event
);
147 void OnSetBgCol(wxCommandEvent
& event
);
148 void OnSetFont(wxCommandEvent
& event
);
149 void OnEnable(wxCommandEvent
& event
);
150 void OnSetBorder(wxCommandEvent
& event
);
152 void OnToggleGlobalBusyCursor(wxCommandEvent
& event
);
153 void OnToggleBusyCursor(wxCommandEvent
& event
);
154 #endif // wxUSE_MENUS
156 // initialize the book: add all pages to it
159 // finding current page assuming book inside book
160 WidgetsPage
*CurrentPage();
163 // the panel containing everything
167 // the listbox for logging messages
168 wxListBox
*m_lboxLog
;
170 // the log target we use to redirect messages to the listbox
174 // the book containing the test pages
175 WidgetsBookCtrl
*m_book
;
178 // last chosen fg/bg colours and font
182 #endif // wxUSE_MENUS
184 // any class wishing to process wxWidgets events must use this macro
185 DECLARE_EVENT_TABLE()
189 // A log target which just redirects the messages to a listbox
190 class LboxLogger
: public wxLog
193 LboxLogger(wxListBox
*lbox
, wxLog
*logOld
)
196 //m_lbox->Disable(); -- looks ugly under MSW
200 virtual ~LboxLogger()
202 wxLog::SetActiveTarget(m_logOld
);
206 // implement sink functions
207 virtual void DoLog(wxLogLevel level
, const wxChar
*szString
, time_t t
)
209 // don't put trace messages into listbox or we can get into infinite
211 if ( level
== wxLOG_Trace
)
215 // cast is needed to call protected method
216 ((LboxLogger
*)m_logOld
)->DoLog(level
, szString
, t
);
221 wxLog::DoLog(level
, szString
, t
);
225 virtual void DoLogString(const wxChar
*szString
, time_t WXUNUSED(t
))
231 #ifdef __WXUNIVERSAL__
232 m_lbox
->AppendAndEnsureVisible(msg
);
233 #else // other ports don't have this method yet
235 m_lbox
->SetFirstItem(m_lbox
->GetCount() - 1);
239 // the control we use
242 // the old log target
248 WX_DEFINE_ARRAY_PTR(WidgetsPage
*, ArrayWidgetsPage
);
250 // ----------------------------------------------------------------------------
252 // ----------------------------------------------------------------------------
254 IMPLEMENT_APP(WidgetsApp
)
256 // ----------------------------------------------------------------------------
258 // ----------------------------------------------------------------------------
260 BEGIN_EVENT_TABLE(WidgetsFrame
, wxFrame
)
262 EVT_BUTTON(Widgets_ClearLog
, WidgetsFrame::OnButtonClearLog
)
264 EVT_BUTTON(Widgets_Quit
, WidgetsFrame::OnExit
)
267 EVT_MENU(Widgets_SetTooltip
, WidgetsFrame::OnSetTooltip
)
268 #endif // wxUSE_TOOLTIPS
271 EVT_WIDGETS_PAGE_CHANGED(wxID_ANY
, WidgetsFrame::OnPageChanged
)
272 EVT_MENU_RANGE(Widgets_GoToPage
, Widgets_GoToPageLast
,
273 WidgetsFrame::OnGoToPage
)
275 EVT_MENU(Widgets_SetFgColour
, WidgetsFrame::OnSetFgCol
)
276 EVT_MENU(Widgets_SetBgColour
, WidgetsFrame::OnSetBgCol
)
277 EVT_MENU(Widgets_SetFont
, WidgetsFrame::OnSetFont
)
278 EVT_MENU(Widgets_Enable
, WidgetsFrame::OnEnable
)
280 EVT_MENU_RANGE(Widgets_BorderNone
, Widgets_BorderDefault
,
281 WidgetsFrame::OnSetBorder
)
283 EVT_MENU(Widgets_GlobalBusyCursor
, WidgetsFrame::OnToggleGlobalBusyCursor
)
284 EVT_MENU(Widgets_BusyCursor
, WidgetsFrame::OnToggleBusyCursor
)
286 EVT_MENU(wxID_EXIT
, WidgetsFrame::OnExit
)
287 #endif // wxUSE_MENUS
290 // ============================================================================
292 // ============================================================================
294 // ----------------------------------------------------------------------------
296 // ----------------------------------------------------------------------------
298 bool WidgetsApp::OnInit()
300 if ( !wxApp::OnInit() )
303 // the reason for having these ifdef's is that I often run two copies of
304 // this sample side by side and it is useful to see which one is which
306 #if defined(__WXUNIVERSAL__)
307 title
= _T("wxUniv/");
310 #if defined(__WXMSW__)
311 title
+= _T("wxMSW");
312 #elif defined(__WXGTK__)
313 title
+= _T("wxGTK");
314 #elif defined(__WXMAC__)
315 title
+= _T("wxMAC");
316 #elif defined(__WXMOTIF__)
317 title
+= _T("wxMOTIF");
319 title
+= _T("wxWidgets");
322 wxFrame
*frame
= new WidgetsFrame(title
+ _T(" widgets demo"));
325 //wxLog::AddTraceMask(_T("listbox"));
326 //wxLog::AddTraceMask(_T("scrollbar"));
327 //wxLog::AddTraceMask(_T("focus"));
332 // ----------------------------------------------------------------------------
333 // WidgetsFrame construction
334 // ----------------------------------------------------------------------------
336 WidgetsFrame::WidgetsFrame(const wxString
& title
)
337 : wxFrame(NULL
, wxID_ANY
, title
)
339 // set the frame icon
340 SetIcon(wxICON(sample
));
344 m_lboxLog
= (wxListBox
*)NULL
;
345 m_logTarget
= (wxLog
*)NULL
;
347 m_book
= (WidgetsBookCtrl
*)NULL
;
350 // create the menubar
351 wxMenuBar
*mbar
= new wxMenuBar
;
352 wxMenu
*menuWidget
= new wxMenu
;
354 menuWidget
->Append(Widgets_SetTooltip
, _T("Set &tooltip...\tCtrl-T"));
355 menuWidget
->AppendSeparator();
356 #endif // wxUSE_TOOLTIPS
357 menuWidget
->Append(Widgets_SetFgColour
, _T("Set &foreground...\tCtrl-F"));
358 menuWidget
->Append(Widgets_SetBgColour
, _T("Set &background...\tCtrl-B"));
359 menuWidget
->Append(Widgets_SetFont
, _T("Set f&ont...\tCtrl-O"));
360 menuWidget
->AppendCheckItem(Widgets_Enable
, _T("&Enable/disable\tCtrl-E"));
362 wxMenu
*menuBorders
= new wxMenu
;
363 menuBorders
->AppendRadioItem(Widgets_BorderDefault
, _T("De&fault\tCtrl-Shift-9"));
364 menuBorders
->AppendRadioItem(Widgets_BorderNone
, _T("&None\tCtrl-Shift-0"));
365 menuBorders
->AppendRadioItem(Widgets_BorderSimple
, _T("&Simple\tCtrl-Shift-1"));
366 menuBorders
->AppendRadioItem(Widgets_BorderDouble
, _T("&Double\tCtrl-Shift-2"));
367 menuBorders
->AppendRadioItem(Widgets_BorderStatic
, _T("Stati&c\tCtrl-Shift-3"));
368 menuBorders
->AppendRadioItem(Widgets_BorderRaised
, _T("&Raised\tCtrl-Shift-4"));
369 menuBorders
->AppendRadioItem(Widgets_BorderSunken
, _T("S&unken\tCtrl-Shift-5"));
370 menuWidget
->AppendSubMenu(menuBorders
, _T("Set &border"));
372 menuWidget
->AppendSeparator();
373 menuWidget
->AppendCheckItem(Widgets_GlobalBusyCursor
,
374 _T("Toggle &global busy cursor\tCtrl-Shift-U"));
375 menuWidget
->AppendCheckItem(Widgets_BusyCursor
,
376 _T("Toggle b&usy cursor\tCtrl-U"));
378 menuWidget
->AppendSeparator();
379 menuWidget
->Append(wxID_EXIT
, _T("&Quit\tCtrl-Q"));
380 mbar
->Append(menuWidget
, _T("&Widget"));
383 mbar
->Check(Widgets_Enable
, true);
384 #endif // wxUSE_MENUS
387 m_panel
= new wxPanel(this, wxID_ANY
);
389 wxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
391 // we have 2 panes: book with pages demonstrating the controls in the
392 // upper one and the log window with some buttons in the lower
394 int style
= wxBK_DEFAULT
;
395 // Uncomment to suppress page theme (draw in solid colour)
396 //style |= wxNB_NOPAGETHEME;
398 m_book
= new WidgetsBookCtrl(m_panel
, Widgets_BookCtrl
, wxDefaultPosition
,
400 wxSize(500, wxDefaultCoord
), // under Motif, height is a function of the width...
407 #ifndef __WXHANDHELD__
408 // the lower one only has the log listbox and a button to clear it
410 wxSizer
*sizerDown
= new wxStaticBoxSizer(
411 new wxStaticBox( m_panel
, wxID_ANY
, _T("&Log window") ),
414 m_lboxLog
= new wxListBox(m_panel
, wxID_ANY
);
415 sizerDown
->Add(m_lboxLog
, 1, wxGROW
| wxALL
, 5);
416 sizerDown
->SetMinSize(100, 150);
418 wxSizer
*sizerDown
= new wxBoxSizer(wxVERTICAL
);
421 wxBoxSizer
*sizerBtns
= new wxBoxSizer(wxHORIZONTAL
);
424 btn
= new wxButton(m_panel
, Widgets_ClearLog
, _T("Clear &log"));
426 sizerBtns
->Add(10, 0); // spacer
428 btn
= new wxButton(m_panel
, Widgets_Quit
, _T("E&xit"));
430 sizerDown
->Add(sizerBtns
, 0, wxALL
| wxALIGN_RIGHT
, 5);
432 // put everything together
433 sizerTop
->Add(m_book
, 1, wxGROW
| (wxALL
& ~(wxTOP
| wxBOTTOM
)), 10);
434 sizerTop
->Add(0, 5, 0, wxGROW
); // spacer in between
435 sizerTop
->Add(sizerDown
, 0, wxGROW
| (wxALL
& ~wxTOP
), 10);
437 #else // !__WXHANDHELD__/__WXHANDHELD__
439 sizerTop
->Add(m_book
, 1, wxGROW
| wxALL
);
441 #endif // __WXHANDHELD__
443 m_panel
->SetSizer(sizerTop
);
446 sizerTop
->SetSizeHints(this);
448 #if USE_LOG && !defined(__WXCOCOA__)
449 // wxCocoa's listbox is too flakey to use for logging right now
450 // now that everything is created we can redirect the log messages to the
452 m_logTarget
= new LboxLogger(m_lboxLog
, wxLog::GetActiveTarget());
453 wxLog::SetActiveTarget(m_logTarget
);
457 void WidgetsFrame::InitBook()
459 #if USE_ICONS_IN_BOOK
460 wxImageList
*imageList
= new wxImageList(32, 32);
462 imageList
->Add(wxBitmap(sample_xpm
));
464 wxImageList
*imageList
= NULL
;
468 WidgetsBookCtrl
*books
[MAX_PAGES
];
471 ArrayWidgetsPage pages
[MAX_PAGES
];
472 wxArrayString labels
[MAX_PAGES
];
474 wxMenu
*menuPages
= new wxMenu
;
475 unsigned int nPage
= 0, nFKey
= 0;
476 int cat
, imageId
= 1;
478 // we need to first create all pages and only then add them to the book
479 // as we need the image list first
481 // we also construct the pages menu during this first iteration
482 for ( cat
= 0; cat
< MAX_PAGES
; cat
++ )
485 nPage
++; // increase for parent page
487 books
[cat
] = new WidgetsBookCtrl(m_book
,
494 for ( WidgetsPageInfo
*info
= WidgetsPage::ms_widgetPages
;
496 info
= info
->GetNext() )
498 if( (info
->GetCategories() & ( 1 << cat
)) == 0)
501 WidgetsPage
*page
= (*info
->GetCtor())(
508 pages
[cat
].Add(page
);
510 labels
[cat
].Add(info
->GetLabel());
511 if ( cat
== ALL_PAGE
)
513 wxString
radioLabel(info
->GetLabel());
517 radioLabel
<< wxT("\tF" ) << nFKey
;
520 menuPages
->AppendRadioItem(
521 Widgets_GoToPage
+ nPage
,
525 // consider only for book in book architecture
531 // consider only for treebook architecture (with subpages)
537 GetMenuBar()->Append(menuPages
, _T("&Page"));
539 #if USE_ICONS_IN_BOOK
540 m_book
->AssignImageList(imageList
);
543 for ( cat
= 0; cat
< MAX_PAGES
; cat
++ )
546 m_book
->AddPage(NULL
,WidgetsCategories
[cat
],false,0);
548 m_book
->AddPage(books
[cat
],WidgetsCategories
[cat
],false,0);
549 #if USE_ICONS_IN_BOOK
550 books
[cat
]->SetImageList(imageList
);
555 size_t count
= pages
[cat
].GetCount();
556 for ( size_t n
= 0; n
< count
; n
++ )
565 false, // don't select
572 // for treebook page #0 is empty parent page only
573 m_book
->SetSelection(1);
574 m_book
->SetSelection(0);
578 WidgetsPage
*WidgetsFrame::CurrentPage()
580 wxWindow
*page
= m_book
->GetCurrentPage();
581 if(!page
) return NULL
;
584 return wxStaticCast(page
, WidgetsPage
);
586 WidgetsBookCtrl
*subBook
= wxStaticCast(page
, WidgetsBookCtrl
);
587 if (!subBook
) return NULL
;
588 page
= subBook
->GetCurrentPage();
589 if(!page
) return NULL
;
590 return wxStaticCast(page
, WidgetsPage
);
594 WidgetsFrame::~WidgetsFrame()
601 // ----------------------------------------------------------------------------
602 // WidgetsFrame event handlers
603 // ----------------------------------------------------------------------------
605 void WidgetsFrame::OnExit(wxCommandEvent
& WXUNUSED(event
))
611 void WidgetsFrame::OnButtonClearLog(wxCommandEvent
& WXUNUSED(event
))
619 void WidgetsFrame::OnPageChanged(WidgetsBookCtrlEvent
& event
)
621 // adjust "Page" menu selection
622 wxMenuItem
*item
= GetMenuBar()->FindItem(Widgets_GoToPage
+ event
.GetSelection());
623 if (item
) item
->Check();
625 // lazy creation of the pages
626 WidgetsPage
* page
= CurrentPage();
627 if (page
&& (page
->GetChildren().GetCount()==0))
629 wxWindowUpdateLocker
noUpdates(page
);
630 page
->CreateContent();
631 WidgetsBookCtrl
*book
= wxStaticCast(page
->GetParent(), WidgetsBookCtrl
);
633 for ( size_t i
= 0; i
< book
->GetPageCount(); ++i
)
635 wxWindow
*page
= book
->GetPage(i
);
638 size
.IncTo(page
->GetSize());
647 void WidgetsFrame::OnGoToPage(wxCommandEvent
& event
)
650 m_book
->SetSelection(event
.GetId() - Widgets_GoToPage
);
652 m_book
->SetSelection(m_book
->GetPageCount()-1);
653 WidgetsBookCtrl
*book
= wxStaticCast(m_book
->GetCurrentPage(), WidgetsBookCtrl
);
654 book
->SetSelection(event
.GetId() - Widgets_GoToPage
);
660 void WidgetsFrame::OnSetTooltip(wxCommandEvent
& WXUNUSED(event
))
662 WidgetsPage
*page
= CurrentPage();
666 wxLogMessage(_T("Page not selected."));
670 static wxString s_tip
= _T("This is a tooltip");
672 wxTextEntryDialog dialog
675 _T("Tooltip text (may use \\n, leave empty to remove): "),
676 _T("Widgets sample"),
680 if ( dialog
.ShowModal() != wxID_OK
)
683 s_tip
= dialog
.GetValue();
684 s_tip
.Replace(_T("\\n"), _T("\n"));
686 page
->GetWidget()->SetToolTip(s_tip
);
688 wxControl
*ctrl2
= page
->GetWidget2();
690 ctrl2
->SetToolTip(s_tip
);
693 #endif // wxUSE_TOOLTIPS
695 void WidgetsFrame::OnSetFgCol(wxCommandEvent
& WXUNUSED(event
))
698 // allow for debugging the default colour the first time this is called
699 WidgetsPage
*page
= CurrentPage();
702 wxLogMessage(_T("Page not selected."));
707 m_colFg
= page
->GetForegroundColour();
709 wxColour col
= wxGetColourFromUser(this, m_colFg
);
715 page
->GetWidget()->SetForegroundColour(m_colFg
);
716 page
->GetWidget()->Refresh();
718 wxControl
*ctrl2
= page
->GetWidget2();
721 ctrl2
->SetForegroundColour(m_colFg
);
725 wxLogMessage(_T("Colour selection dialog not available in current build."));
729 void WidgetsFrame::OnSetBgCol(wxCommandEvent
& WXUNUSED(event
))
732 WidgetsPage
*page
= CurrentPage();
735 wxLogMessage(_T("Page not selected."));
740 m_colBg
= page
->GetBackgroundColour();
742 wxColour col
= wxGetColourFromUser(this, m_colBg
);
748 page
->GetWidget()->SetBackgroundColour(m_colBg
);
749 page
->GetWidget()->Refresh();
751 wxControl
*ctrl2
= page
->GetWidget2();
754 ctrl2
->SetBackgroundColour(m_colFg
);
758 wxLogMessage(_T("Colour selection dialog not available in current build."));
762 void WidgetsFrame::OnSetFont(wxCommandEvent
& WXUNUSED(event
))
765 WidgetsPage
*page
= CurrentPage();
768 wxLogMessage(_T("Page not selected."));
773 m_font
= page
->GetFont();
775 wxFont font
= wxGetFontFromUser(this, m_font
);
781 page
->GetWidget()->SetFont(m_font
);
782 page
->GetWidget()->Refresh();
784 wxControl
*ctrl2
= page
->GetWidget2();
787 ctrl2
->SetFont(m_font
);
791 wxLogMessage(_T("Font selection dialog not available in current build."));
795 void WidgetsFrame::OnEnable(wxCommandEvent
& event
)
797 WidgetsPage
*page
= CurrentPage();
800 wxLogMessage(_T("Page not selected."));
804 page
->GetWidget()->Enable(event
.IsChecked());
807 void WidgetsFrame::OnSetBorder(wxCommandEvent
& event
)
810 switch ( event
.GetId() )
812 case Widgets_BorderNone
: border
= wxBORDER_NONE
; break;
813 case Widgets_BorderStatic
: border
= wxBORDER_STATIC
; break;
814 case Widgets_BorderSimple
: border
= wxBORDER_SIMPLE
; break;
815 case Widgets_BorderRaised
: border
= wxBORDER_RAISED
; break;
816 case Widgets_BorderSunken
: border
= wxBORDER_SUNKEN
; break;
817 case Widgets_BorderDouble
: border
= wxBORDER_DOUBLE
; break;
820 wxFAIL_MSG( _T("unknown border style") );
823 case Widgets_BorderDefault
: border
= wxBORDER_DEFAULT
; break;
826 WidgetsPage::ms_defaultFlags
&= ~wxBORDER_MASK
;
827 WidgetsPage::ms_defaultFlags
|= border
;
829 WidgetsPage
*page
= CurrentPage();
833 wxLogMessage(_T("Page not selected."));
837 page
->RecreateWidget();
840 void WidgetsFrame::OnToggleGlobalBusyCursor(wxCommandEvent
& event
)
842 if ( event
.IsChecked() )
848 void WidgetsFrame::OnToggleBusyCursor(wxCommandEvent
& event
)
850 WidgetsPage
*page
= CurrentPage();
851 page
->GetWidget()->SetCursor(*(event
.IsChecked() ? wxHOURGLASS_CURSOR
852 : wxSTANDARD_CURSOR
));
855 #endif // wxUSE_MENUS
857 // ----------------------------------------------------------------------------
859 // ----------------------------------------------------------------------------
861 WidgetsPageInfo::WidgetsPageInfo(Constructor ctor
, const wxChar
*label
, int categories
)
863 , m_categories(categories
)
869 // dummy sorting: add and immediately sort in the list according to label
870 if ( WidgetsPage::ms_widgetPages
)
872 WidgetsPageInfo
*node_prev
= WidgetsPage::ms_widgetPages
;
873 if ( wxStrcmp(label
, node_prev
->GetLabel().c_str()) < 0 )
877 WidgetsPage::ms_widgetPages
= this;
881 WidgetsPageInfo
*node_next
;
884 node_next
= node_prev
->GetNext();
887 // add if between two
888 if ( wxStrcmp(label
, node_next
->GetLabel().c_str()) < 0 )
890 node_prev
->SetNext(this);
892 // force to break loop
899 node_prev
->SetNext(this);
902 node_prev
= node_next
;
910 WidgetsPage::ms_widgetPages
= this;
914 // ----------------------------------------------------------------------------
916 // ----------------------------------------------------------------------------
918 int WidgetsPage::ms_defaultFlags
= wxBORDER_DEFAULT
;
919 WidgetsPageInfo
*WidgetsPage::ms_widgetPages
= NULL
;
921 WidgetsPage::WidgetsPage(WidgetsBookCtrl
*book
,
922 wxImageList
*imaglist
,
924 : wxPanel(book
, wxID_ANY
,
925 wxDefaultPosition
, wxDefaultSize
,
926 wxNO_FULL_REPAINT_ON_RESIZE
|
930 #if USE_ICONS_IN_BOOK
931 imaglist
->Add(wxBitmap(icon
));
933 wxUnusedVar(imaglist
);
938 wxSizer
*WidgetsPage::CreateSizerWithText(wxControl
*control
,
942 wxSizer
*sizerRow
= new wxBoxSizer(wxHORIZONTAL
);
943 wxTextCtrl
*text
= new wxTextCtrl(this, id
, wxEmptyString
,
944 wxDefaultPosition
, wxDefaultSize
, wxTE_PROCESS_ENTER
);
946 sizerRow
->Add(control
, 0, wxRIGHT
| wxALIGN_CENTRE_VERTICAL
, 5);
947 sizerRow
->Add(text
, 1, wxLEFT
| wxALIGN_CENTRE_VERTICAL
, 5);
955 // create a sizer containing a label and a text ctrl
956 wxSizer
*WidgetsPage::CreateSizerWithTextAndLabel(const wxString
& label
,
960 return CreateSizerWithText(new wxStaticText(this, wxID_ANY
, label
),
964 // create a sizer containing a button and a text ctrl
965 wxSizer
*WidgetsPage::CreateSizerWithTextAndButton(wxWindowID idBtn
,
966 const wxString
& label
,
970 return CreateSizerWithText(new wxButton(this, idBtn
, label
), id
, ppText
);
973 wxCheckBox
*WidgetsPage::CreateCheckBoxAndAddToSizer(wxSizer
*sizer
,
974 const wxString
& label
,
977 wxCheckBox
*checkbox
= new wxCheckBox(this, id
, label
);
978 sizer
->Add(checkbox
, 0, wxLEFT
| wxRIGHT
, 5);
979 sizer
->Add(0, 2, 0, wxGROW
); // spacer