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() { }
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 );
// 3) buttons if any
wxSizer *
- buttonSizer = CreateSeparatedButtonSizer(styleDlg & ButtonSizerFlags);
+ buttonSizer = CreateSeparatedButtonSizer(styleBtns);
if ( buttonSizer )
{
topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
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 );
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);
#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());