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
This commit is contained in:
Vadim Zeitlin
2009-06-23 08:56:32 +00:00
parent 743b426605
commit 12a124ddc9
5 changed files with 12 additions and 16 deletions

View File

@@ -65,12 +65,6 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
class WXDLLIMPEXP_CORE wxDialogBase : public wxTopLevelWindow class WXDLLIMPEXP_CORE wxDialogBase : public wxTopLevelWindow
{ {
public: public:
enum
{
// all flags allowed in wxDialogBase::CreateButtonSizer()
ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT
};
wxDialogBase() { Init(); } wxDialogBase() { Init(); }
virtual ~wxDialogBase() { } virtual ~wxDialogBase() { }

View File

@@ -290,14 +290,12 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
const wxPoint& pos, const wxPoint& pos,
long styleLbox) long styleLbox)
{ {
#ifdef __WXMAC__ // extract the buttons styles from the dialog one and remove them from it
// FIXME: why?? const long styleBtns = styleDlg & (wxOK | wxCANCEL);
if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) ) styleDlg &= ~styleBtns;
return false;
#else
if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) )
return false; return false;
#endif
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
@@ -316,7 +314,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
// 3) buttons if any // 3) buttons if any
wxSizer * wxSizer *
buttonSizer = CreateSeparatedButtonSizer(styleDlg & ButtonSizerFlags); buttonSizer = CreateSeparatedButtonSizer(styleBtns);
if ( buttonSizer ) if ( buttonSizer )
{ {
topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());

View File

@@ -107,7 +107,11 @@ void wxGenericMessageDialog::DoCreateMsgdialog()
int center_flag = wxEXPAND; int center_flag = wxEXPAND;
if (m_dialogStyle & wxYES_NO) if (m_dialogStyle & wxYES_NO)
center_flag = wxALIGN_CENTRE; 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 ) if ( sizerBtn )
topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 ); topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 );

View File

@@ -120,7 +120,7 @@ void wxPropertySheetDialog::CreateButtons(int flags)
wxSystemOptions::SetOption(optionName,0); wxSystemOptions::SetOption(optionName,0);
#endif #endif
wxSizer *buttonSizer = CreateButtonSizer( flags & ButtonSizerFlags ); wxSizer *buttonSizer = CreateButtonSizer(flags);
if( buttonSizer ) if( buttonSizer )
{ {
m_innerSizer->Add( buttonSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2); m_innerSizer->Add( buttonSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2);

View File

@@ -107,7 +107,7 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
#endif // wxUSE_VALIDATORS #endif // wxUSE_VALIDATORS
// 3) buttons if any // 3) buttons if any
wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & ButtonSizerFlags); wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & (wxOK | wxCANCEL));
if ( buttonSizer ) if ( buttonSizer )
{ {
topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand()); topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand());