From: Vadim Zeitlin Date: Tue, 23 Jun 2009 08:56:32 +0000 (+0000) Subject: remove confusing wxDialog::ButtonSizerFlags and extract button styles properly in... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/12a124ddc9f861d00370de1c7dfb660c53e6931b remove confusing wxDialog::ButtonSizerFlags and extract button styles properly in each generic dialog implementation instead (closes #9836) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dialog.h b/include/wx/dialog.h index ef747fe246..d3e9e4392d 100644 --- a/include/wx/dialog.h +++ b/include/wx/dialog.h @@ -65,12 +65,6 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; class WXDLLIMPEXP_CORE wxDialogBase : public wxTopLevelWindow { public: - enum - { - // all flags allowed in wxDialogBase::CreateButtonSizer() - ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT - }; - wxDialogBase() { Init(); } virtual ~wxDialogBase() { } diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index fb4eb2677d..3a97b383fc 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -290,14 +290,12 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, const wxPoint& pos, long styleLbox) { -#ifdef __WXMAC__ - // FIXME: why?? - if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) ) - return false; -#else + // extract the buttons styles from the dialog one and remove them from it + const long styleBtns = styleDlg & (wxOK | wxCANCEL); + styleDlg &= ~styleBtns; + if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) return false; -#endif wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); @@ -316,7 +314,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, // 3) buttons if any wxSizer * - buttonSizer = CreateSeparatedButtonSizer(styleDlg & ButtonSizerFlags); + buttonSizer = CreateSeparatedButtonSizer(styleBtns); if ( buttonSizer ) { topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index d479248158..bded8f883f 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -107,7 +107,11 @@ void wxGenericMessageDialog::DoCreateMsgdialog() int center_flag = wxEXPAND; if (m_dialogStyle & wxYES_NO) center_flag = wxALIGN_CENTRE; - wxSizer *sizerBtn = CreateSeparatedButtonSizer(m_dialogStyle & ButtonSizerFlags); + wxSizer *sizerBtn = CreateSeparatedButtonSizer + ( + m_dialogStyle & (wxOK | wxCANCEL | wxYES_NO | + wxNO_DEFAULT | wxCANCEL_DEFAULT) + ); if ( sizerBtn ) topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 ); diff --git a/src/generic/propdlg.cpp b/src/generic/propdlg.cpp index b61825d1f2..54a49b5dfa 100644 --- a/src/generic/propdlg.cpp +++ b/src/generic/propdlg.cpp @@ -120,7 +120,7 @@ void wxPropertySheetDialog::CreateButtons(int flags) wxSystemOptions::SetOption(optionName,0); #endif - wxSizer *buttonSizer = CreateButtonSizer( flags & ButtonSizerFlags ); + wxSizer *buttonSizer = CreateButtonSizer(flags); if( buttonSizer ) { m_innerSizer->Add( buttonSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2); diff --git a/src/generic/textdlgg.cpp b/src/generic/textdlgg.cpp index 16cfd7d9d5..d1f96ebfe5 100644 --- a/src/generic/textdlgg.cpp +++ b/src/generic/textdlgg.cpp @@ -107,7 +107,7 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, #endif // wxUSE_VALIDATORS // 3) buttons if any - wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & ButtonSizerFlags); + wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & (wxOK | wxCANCEL)); if ( buttonSizer ) { topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand());