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:
@@ -203,7 +203,8 @@ for details.
|
|||||||
\func{wxSizer*}{CreateButtonSizer}{\param{long}{ flags}}
|
\func{wxSizer*}{CreateButtonSizer}{\param{long}{ flags}}
|
||||||
|
|
||||||
Creates a sizer with standard buttons. {\it flags} is a bit list
|
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.
|
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}}
|
\func{wxStdDialogButtonSizer*}{CreateStdDialogButtonSizer}{\param{long}{ flags}}
|
||||||
|
|
||||||
Creates a \helpref{wxStdDialogButtonSizer}{wxstddialogbuttonsizer} with standard buttons. {\it flags} is a bit list
|
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.
|
The sizer lays out the buttons in a manner appropriate to the platform.
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@ Adds a button to the wxStdDialogButtonSizer. The button must have one of the fol
|
|||||||
\item wxID\_YES
|
\item wxID\_YES
|
||||||
\item wxID\_SAVE
|
\item wxID\_SAVE
|
||||||
\item wxID\_APPLY
|
\item wxID\_APPLY
|
||||||
|
\item wxID\_CLOSE
|
||||||
\item wxID\_NO
|
\item wxID\_NO
|
||||||
\item wxID\_CANCEL
|
\item wxID\_CANCEL
|
||||||
\item wxID\_HELP
|
\item wxID\_HELP
|
||||||
|
@@ -1653,6 +1653,8 @@ enum wxBorder
|
|||||||
#define wxNO 0x00000008
|
#define wxNO 0x00000008
|
||||||
#define wxYES_NO (wxYES | wxNO)
|
#define wxYES_NO (wxYES | wxNO)
|
||||||
#define wxCANCEL 0x00000010
|
#define wxCANCEL 0x00000010
|
||||||
|
#define wxAPPLY 0x00000020
|
||||||
|
#define wxCLOSE 0x00000040
|
||||||
|
|
||||||
#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */
|
#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */
|
||||||
#define wxNO_DEFAULT 0x00000080
|
#define wxNO_DEFAULT 0x00000080
|
||||||
|
@@ -862,10 +862,10 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here
|
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_buttonNegative; // wxID_NO
|
||||||
wxButton *m_buttonCancel;
|
wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE
|
||||||
wxButton *m_buttonHelp;
|
wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_CLASS(wxStdDialogButtonSizer)
|
DECLARE_CLASS(wxStdDialogButtonSizer)
|
||||||
|
@@ -227,6 +227,18 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags )
|
|||||||
sizer->AddButton(no);
|
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)
|
if (flags & wxHELP)
|
||||||
{
|
{
|
||||||
wxButton *help = new wxButton(this, wxID_HELP);
|
wxButton *help = new wxButton(this, wxID_HELP);
|
||||||
|
@@ -1962,6 +1962,7 @@ void wxStdDialogButtonSizer::AddButton(wxButton *mybutton)
|
|||||||
m_buttonNegative = mybutton;
|
m_buttonNegative = mybutton;
|
||||||
break;
|
break;
|
||||||
case wxID_CANCEL:
|
case wxID_CANCEL:
|
||||||
|
case wxID_CLOSE:
|
||||||
m_buttonCancel = mybutton;
|
m_buttonCancel = mybutton;
|
||||||
break;
|
break;
|
||||||
case wxID_HELP:
|
case wxID_HELP:
|
||||||
@@ -2040,15 +2041,17 @@ void wxStdDialogButtonSizer::Realize()
|
|||||||
Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
|
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){
|
if (m_buttonCancel){
|
||||||
Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
|
Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
|
||||||
// Cancel or help should be default
|
// Cancel or help should be default
|
||||||
// m_buttonCancel->SetDefaultButton();
|
// m_buttonCancel->SetDefaultButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_buttonApply)
|
|
||||||
Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
|
|
||||||
|
|
||||||
if (m_buttonAffirmative)
|
if (m_buttonAffirmative)
|
||||||
Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6);
|
Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6);
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
|
Reference in New Issue
Block a user