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
{
public:
enum
{
// all flags allowed in wxDialogBase::CreateButtonSizer()
ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT
};
wxDialogBase() { Init(); }
virtual ~wxDialogBase() { }

View File

@@ -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());

View File

@@ -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 );

View File

@@ -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);

View File

@@ -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());