diff --git a/samples/widgets/clrpicker.cpp b/samples/widgets/clrpicker.cpp index 1ce4e6bf7f..eff222e606 100644 --- a/samples/widgets/clrpicker.cpp +++ b/samples/widgets/clrpicker.cpp @@ -81,9 +81,6 @@ protected: // restore the checkboxes state to the initial values void Reset(); - // get the initial style for the picker of the given kind - long GetPickerStyle(); - void OnColourChange(wxColourPickerEvent &ev); void OnCheckBox(wxCommandEvent &ev); @@ -175,14 +172,7 @@ void ColourPickerWidgetsPage::CreatePicker() { delete m_clrPicker; - m_clrPicker = new wxColourPickerCtrl(this, PickerPage_Colour, *wxRED, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle()); -} - -long ColourPickerWidgetsPage::GetPickerStyle() -{ - long style = 0; + long style = GetAttrs().m_defaultFlags; if ( m_chkColourTextCtrl->GetValue() ) style |= wxCLRP_USE_TEXTCTRL; @@ -193,7 +183,9 @@ long ColourPickerWidgetsPage::GetPickerStyle() if ( m_chkColourShowAlpha->GetValue() ) style |= wxCLRP_SHOW_ALPHA; - return style; + m_clrPicker = new wxColourPickerCtrl(this, PickerPage_Colour, *wxRED, + wxDefaultPosition, wxDefaultSize, + style); } void ColourPickerWidgetsPage::RecreatePicker() diff --git a/samples/widgets/datepick.cpp b/samples/widgets/datepick.cpp index d4c3619d91..88dd3c8bea 100644 --- a/samples/widgets/datepick.cpp +++ b/samples/widgets/datepick.cpp @@ -243,7 +243,7 @@ void DatePickerWidgetsPage::CreateDatePicker() delete m_datePicker; - long style = 0; + long style = GetAttrs().m_defaultFlags; switch ( m_radioKind->GetSelection() ) { case 0: diff --git a/samples/widgets/dirctrl.cpp b/samples/widgets/dirctrl.cpp index c9a4640229..5944a62ff0 100644 --- a/samples/widgets/dirctrl.cpp +++ b/samples/widgets/dirctrl.cpp @@ -246,18 +246,27 @@ void DirCtrlWidgetsPage::CreateDirCtrl() { wxWindowUpdateLocker noUpdates(this); + long style = GetAttrs().m_defaultFlags; + if ( m_chkDirOnly->IsChecked() ) + style |= wxDIRCTRL_DIR_ONLY; + if ( m_chk3D->IsChecked() ) + style |= wxDIRCTRL_3D_INTERNAL; + if ( m_chkFirst->IsChecked() ) + style |= wxDIRCTRL_SELECT_FIRST; + if ( m_chkFilters->IsChecked() ) + style |= wxDIRCTRL_SHOW_FILTERS; + if ( m_chkLabels->IsChecked() ) + style |= wxDIRCTRL_EDIT_LABELS; + if ( m_chkMulti->IsChecked() ) + style |= wxDIRCTRL_MULTIPLE; + wxGenericDirCtrl *dirCtrl = new wxGenericDirCtrl( this, DirCtrlPage_Ctrl, wxDirDialogDefaultFolderStr, wxDefaultPosition, wxDefaultSize, - ( m_chkDirOnly->IsChecked() ? wxDIRCTRL_DIR_ONLY : 0 ) | - ( m_chk3D->IsChecked() ? wxDIRCTRL_3D_INTERNAL : 0 ) | - ( m_chkFirst->IsChecked() ? wxDIRCTRL_SELECT_FIRST : 0 ) | - ( m_chkFilters->IsChecked() ? wxDIRCTRL_SHOW_FILTERS : 0 ) | - ( m_chkLabels->IsChecked() ? wxDIRCTRL_EDIT_LABELS : 0 ) | - ( m_chkMulti->IsChecked() ? wxDIRCTRL_MULTIPLE : 0) + style ); wxString filter; diff --git a/samples/widgets/dirpicker.cpp b/samples/widgets/dirpicker.cpp index 6173bf297e..ab4a9b5cd1 100644 --- a/samples/widgets/dirpicker.cpp +++ b/samples/widgets/dirpicker.cpp @@ -83,9 +83,6 @@ protected: // restore the checkboxes state to the initial values void Reset(); - // get the initial style for the picker of the given kind - long GetPickerStyle(); - void OnDirChange(wxFileDirPickerEvent &ev); void OnCheckBox(wxCommandEvent &ev); @@ -194,15 +191,7 @@ void DirPickerWidgetsPage::CreatePicker() { delete m_dirPicker; - m_dirPicker = new wxDirPickerCtrl(this, PickerPage_Dir, - wxGetHomeDir(), wxT("Hello!"), - wxDefaultPosition, wxDefaultSize, - GetPickerStyle()); -} - -long DirPickerWidgetsPage::GetPickerStyle() -{ - long style = 0; + long style = GetAttrs().m_defaultFlags; if ( m_chkDirTextCtrl->GetValue() ) style |= wxDIRP_USE_TEXTCTRL; @@ -216,7 +205,10 @@ long DirPickerWidgetsPage::GetPickerStyle() if ( m_chkSmall->GetValue() ) style |= wxDIRP_SMALL; - return style; + m_dirPicker = new wxDirPickerCtrl(this, PickerPage_Dir, + wxGetHomeDir(), wxT("Hello!"), + wxDefaultPosition, wxDefaultSize, + style); } void DirPickerWidgetsPage::RecreatePicker() diff --git a/samples/widgets/editlbox.cpp b/samples/widgets/editlbox.cpp index d71aa88740..383fb981aa 100644 --- a/samples/widgets/editlbox.cpp +++ b/samples/widgets/editlbox.cpp @@ -178,7 +178,7 @@ void EditableListboxWidgetsPage::Reset() void EditableListboxWidgetsPage::CreateLbox() { - int flags = 0; + long flags = GetAttrs().m_defaultFlags; if ( m_chkAllowNew->GetValue() ) flags |= wxEL_ALLOW_NEW; diff --git a/samples/widgets/filectrl.cpp b/samples/widgets/filectrl.cpp index 27d5a5bc17..9790fd78dd 100644 --- a/samples/widgets/filectrl.cpp +++ b/samples/widgets/filectrl.cpp @@ -227,11 +227,14 @@ void FileCtrlWidgetsPage::CreateFileCtrl() { wxWindowUpdateLocker noUpdates( this ); - const int style = - ( m_radioFileCtrlMode->GetSelection() == FileCtrlMode_Open ? - wxFC_OPEN : wxFC_SAVE ) | - ( m_chkMultiple->IsChecked() ? wxFC_MULTIPLE : 0 ) | - ( m_chkNoShowHidden->IsChecked() ? wxFC_NOSHOWHIDDEN : 0 ); + long style = GetAttrs().m_defaultFlags; + style |= m_radioFileCtrlMode->GetSelection() == FileCtrlMode_Open + ? wxFC_OPEN + : wxFC_SAVE; + if ( m_chkMultiple->IsChecked() ) + style |= wxFC_MULTIPLE; + if ( m_chkNoShowHidden->IsChecked() ) + style |= wxFC_NOSHOWHIDDEN; wxFileCtrl *fileCtrl = new wxFileCtrl( this, diff --git a/samples/widgets/filepicker.cpp b/samples/widgets/filepicker.cpp index 8948a8bb1b..bfb0b4fca9 100644 --- a/samples/widgets/filepicker.cpp +++ b/samples/widgets/filepicker.cpp @@ -90,9 +90,6 @@ protected: // restore the checkboxes state to the initial values void Reset(); - // get the initial style for the picker of the given kind - long GetPickerStyle(); - // update filepicker radiobox void UpdateFilePickerMode(); @@ -223,17 +220,7 @@ void FilePickerWidgetsPage::CreatePicker() { delete m_filePicker; - // pass an empty string as initial file - m_filePicker = new wxFilePickerCtrl(this, PickerPage_File, - wxEmptyString, - wxT("Hello!"), wxT("*"), - wxDefaultPosition, wxDefaultSize, - GetPickerStyle()); -} - -long FilePickerWidgetsPage::GetPickerStyle() -{ - long style = 0; + long style = GetAttrs().m_defaultFlags; if ( m_chkFileTextCtrl->GetValue() ) style |= wxFLP_USE_TEXTCTRL; @@ -255,7 +242,12 @@ long FilePickerWidgetsPage::GetPickerStyle() else style |= wxFLP_SAVE; - return style; + // pass an empty string as initial file + m_filePicker = new wxFilePickerCtrl(this, PickerPage_File, + wxEmptyString, + wxT("Hello!"), wxT("*"), + wxDefaultPosition, wxDefaultSize, + style); } void FilePickerWidgetsPage::RecreatePicker() diff --git a/samples/widgets/fontpicker.cpp b/samples/widgets/fontpicker.cpp index 4ca5add712..6afb19ba04 100644 --- a/samples/widgets/fontpicker.cpp +++ b/samples/widgets/fontpicker.cpp @@ -81,9 +81,6 @@ protected: // restore the checkboxes state to the initial values void Reset(); - // get the initial style for the picker of the given kind - long GetPickerStyle(); - void OnFontChange(wxFontPickerEvent &ev); void OnCheckBox(wxCommandEvent &ev); @@ -175,15 +172,7 @@ void FontPickerWidgetsPage::CreatePicker() { delete m_fontPicker; - m_fontPicker = new wxFontPickerCtrl(this, PickerPage_Font, - *wxSWISS_FONT, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle()); -} - -long FontPickerWidgetsPage::GetPickerStyle() -{ - long style = 0; + long style = GetAttrs().m_defaultFlags; if ( m_chkFontTextCtrl->GetValue() ) style |= wxFNTP_USE_TEXTCTRL; @@ -192,9 +181,12 @@ long FontPickerWidgetsPage::GetPickerStyle() style |= wxFNTP_USEFONT_FOR_LABEL; if ( m_chkFontDescAsLabel->GetValue() ) - style |= wxFNTP_FONTDESC_AS_LABEL; + style |= wxFNTP_FONTDESC_AS_LABEL; - return style; + m_fontPicker = new wxFontPickerCtrl(this, PickerPage_Font, + *wxSWISS_FONT, + wxDefaultPosition, wxDefaultSize, + style); } void FontPickerWidgetsPage::RecreatePicker() diff --git a/samples/widgets/hyperlnk.cpp b/samples/widgets/hyperlnk.cpp index 96553651c1..d3d7baba44 100644 --- a/samples/widgets/hyperlnk.cpp +++ b/samples/widgets/hyperlnk.cpp @@ -99,7 +99,7 @@ protected: // (re)create the hyperctrl void CreateHyperlink(); - void CreateHyperlinkLong(long); + void CreateHyperlinkLong(long align); // the controls // ------------ @@ -259,6 +259,9 @@ void HyperlinkWidgetsPage::CreateHyperlink() { const wxString label = m_hyperlink->GetLabel(); const wxString url = m_hyperlink->GetURL(); + long style = GetAttrs().m_defaultFlags; + + style |= wxHL_DEFAULT_STYLE & ~wxBORDER_MASK; wxGenericHyperlinkCtrl *hyp; if (m_checkGeneric->IsChecked()) @@ -266,14 +269,20 @@ void HyperlinkWidgetsPage::CreateHyperlink() hyp = new wxGenericHyperlinkCtrl(this, HyperlinkPage_Ctrl, label, - url); + url, + wxDefaultPosition, + wxDefaultSize, + style); } else { hyp = new wxHyperlinkCtrl(this, HyperlinkPage_Ctrl, label, - url); + url, + wxDefaultPosition, + wxDefaultSize, + style); } // update sizer's child window @@ -287,9 +296,11 @@ void HyperlinkWidgetsPage::CreateHyperlink() GetSizer()->Layout(); } -void HyperlinkWidgetsPage::CreateHyperlinkLong(long style) +void HyperlinkWidgetsPage::CreateHyperlinkLong(long align) { - style = (wxHL_DEFAULT_STYLE & ~wxHL_ALIGN_CENTRE)|style; + long style = GetAttrs().m_defaultFlags; + style |= align; + style |= wxHL_DEFAULT_STYLE & ~(wxHL_ALIGN_CENTRE | wxBORDER_MASK); wxGenericHyperlinkCtrl *hyp; if (m_checkGeneric->IsChecked()) diff --git a/samples/widgets/searchctrl.cpp b/samples/widgets/searchctrl.cpp index 7252ab078d..28bfbde471 100644 --- a/samples/widgets/searchctrl.cpp +++ b/samples/widgets/searchctrl.cpp @@ -68,7 +68,6 @@ class SearchCtrlWidgetsPage : public WidgetsPage { public: SearchCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); - virtual ~SearchCtrlWidgetsPage(){}; virtual wxWindow *GetWidget() const wxOVERRIDE { return m_srchCtrl; } virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE { return m_srchCtrl; } @@ -176,7 +175,7 @@ void SearchCtrlWidgetsPage::CreateControl() if (m_srchCtrl) m_srchCtrl->Destroy(); - int style = 0; + long style = GetAttrs().m_defaultFlags; m_srchCtrl = new wxSearchCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxSize(150, -1), style); diff --git a/samples/widgets/statbmp.cpp b/samples/widgets/statbmp.cpp index a0954e6cb1..ad100b0df8 100644 --- a/samples/widgets/statbmp.cpp +++ b/samples/widgets/statbmp.cpp @@ -132,10 +132,21 @@ void StatBmpWidgetsPage::RecreateWidget() wxLogMessage("Reading image from file '%s' failed.", filepath.c_str()); return; } + + long style = GetAttrs().m_defaultFlags; + if (m_radio->GetSelection() == 0) - m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxBitmap(image)); + { + m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxBitmap(image), + wxDefaultPosition, wxDefaultSize, + style); + } else - m_statbmp = new wxGenericStaticBitmap(this, wxID_ANY, wxBitmap(image)); + { + m_statbmp = new wxGenericStaticBitmap(this, wxID_ANY, wxBitmap(image), + wxDefaultPosition, wxDefaultSize, + style); + } wxStaticBitmapBase::ScaleMode scaleMode = (wxStaticBitmapBase::ScaleMode) m_scaleRadio->GetSelection(); m_statbmp->SetScaleMode(scaleMode); diff --git a/samples/widgets/timepick.cpp b/samples/widgets/timepick.cpp index fe457a7603..b8c0572b9a 100644 --- a/samples/widgets/timepick.cpp +++ b/samples/widgets/timepick.cpp @@ -195,7 +195,11 @@ void TimePickerWidgetsPage::CreateTimePicker() delete m_timePicker; - m_timePicker = new wxTimePickerCtrl(this, TimePickerPage_Picker, value); + long style = GetAttrs().m_defaultFlags; + + m_timePicker = new wxTimePickerCtrl(this, TimePickerPage_Picker, value, + wxDefaultPosition, wxDefaultSize, + style); m_sizerTimePicker->Add(0, 0, 1, wxCENTRE); m_sizerTimePicker->Add(m_timePicker, 1, wxCENTRE); diff --git a/samples/widgets/widgets.h b/samples/widgets/widgets.h index 0f159ba49e..b228fe110b 100644 --- a/samples/widgets/widgets.h +++ b/samples/widgets/widgets.h @@ -115,7 +115,7 @@ struct WidgetAttributes wxWindowVariant m_variant; wxCursor m_cursor; // the default flags, currently only contains border flags - int m_defaultFlags; + long m_defaultFlags; }; class WidgetsPage : public wxPanel