added wxAPPLY and wxCLOSE flags to CreateStdDialogButtonSizer() (Marcin Wojdyr)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-04-14 13:17:06 +00:00
parent db56793066
commit 57d7f9888e
6 changed files with 28 additions and 8 deletions

View File

@ -203,7 +203,8 @@ for details.
\func{wxSizer*}{CreateButtonSizer}{\param{long}{ flags}}
Creates a sizer with standard buttons. {\it flags} is a bit list
of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxHELP, wxNO\_DEFAULT.
of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE,
wxHELP, wxNO\_DEFAULT.
The sizer lays out the buttons in a manner appropriate to the platform.
@ -231,7 +232,8 @@ if no buttons were created.
\func{wxStdDialogButtonSizer*}{CreateStdDialogButtonSizer}{\param{long}{ flags}}
Creates a \helpref{wxStdDialogButtonSizer}{wxstddialogbuttonsizer} with standard buttons. {\it flags} is a bit list
of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxHELP, wxNO\_DEFAULT.
of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE,
wxHELP, wxNO\_DEFAULT.
The sizer lays out the buttons in a manner appropriate to the platform.

View File

@ -46,6 +46,7 @@ Adds a button to the wxStdDialogButtonSizer. The button must have one of the fol
\item wxID\_YES
\item wxID\_SAVE
\item wxID\_APPLY
\item wxID\_CLOSE
\item wxID\_NO
\item wxID\_CANCEL
\item wxID\_HELP

View File

@ -1653,6 +1653,8 @@ enum wxBorder
#define wxNO 0x00000008
#define wxYES_NO (wxYES | wxNO)
#define wxCANCEL 0x00000010
#define wxAPPLY 0x00000020
#define wxCLOSE 0x00000040
#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */
#define wxNO_DEFAULT 0x00000080

View File

@ -862,10 +862,10 @@ public:
protected:
wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here
wxButton *m_buttonApply;
wxButton *m_buttonApply; // wxID_APPLY
wxButton *m_buttonNegative; // wxID_NO
wxButton *m_buttonCancel;
wxButton *m_buttonHelp;
wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE
wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP
private:
DECLARE_CLASS(wxStdDialogButtonSizer)

View File

@ -227,6 +227,18 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags )
sizer->AddButton(no);
}
if (flags & wxAPPLY)
{
wxButton *apply = new wxButton(this, wxID_APPLY);
sizer->AddButton(apply);
}
if (flags & wxCLOSE)
{
wxButton *close = new wxButton(this, wxID_CLOSE);
sizer->AddButton(close);
}
if (flags & wxHELP)
{
wxButton *help = new wxButton(this, wxID_HELP);

View File

@ -1962,6 +1962,7 @@ void wxStdDialogButtonSizer::AddButton(wxButton *mybutton)
m_buttonNegative = mybutton;
break;
case wxID_CANCEL:
case wxID_CLOSE:
m_buttonCancel = mybutton;
break;
case wxID_HELP:
@ -2040,15 +2041,17 @@ void wxStdDialogButtonSizer::Realize()
Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
}
// according to HIG, in explicit apply windows the order is:
// [ Help Apply Cancel OK ]
if (m_buttonApply)
Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
if (m_buttonCancel){
Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
// Cancel or help should be default
// m_buttonCancel->SetDefaultButton();
}
if (m_buttonApply)
Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
if (m_buttonAffirmative)
Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6);
#elif defined(__WXMSW__)