]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxAPPLY and wxCLOSE flags to CreateStdDialogButtonSizer() (Marcin Wojdyr)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 14 Apr 2007 13:17:06 +0000 (13:17 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 14 Apr 2007 13:17:06 +0000 (13:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/dialog.tex
docs/latex/wx/stdbtnsz.tex
include/wx/defs.h
include/wx/sizer.h
src/common/dlgcmn.cpp
src/common/sizer.cpp

index e8edbf6e08280562226139d992563570206b8208..78ac30db3075f06a4dc6c085005c65c50975863b 100644 (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.
 
index 065acd3485b97e29ffc1b1c9081bd0827c779dc1..be6fcd54e8bf7f3c3518d75a5ffc3055af3839f7 100644 (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
index 59204076013d737291555935db12836e5bc40f6a..849e74390e4ac764adb7123295ab5e5e51eb170b 100644 (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
index 8aa759e376e2661663c537395395b58420731ba1..ce2341c36fd3d97416ddbe78befcb58f74ba265d 100644 (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)
index 67b0c89f105bbb2db7ea11fe62c2b52c7fd8a5a8..be6afab98ef04c4ee740d089feb6914e895e00f6 100644 (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);
index b4ae33b5a74b76291f83d83210f92b21b43ee220..5f3c324720f396a19abe40cfdcb75d529eb3603f 100644 (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__)