]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix Yes/No/Cancel buttons order in wxGTK wxStdDialogButtonSizer.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 18 Aug 2010 22:48:15 +0000 (22:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 18 Aug 2010 22:48:15 +0000 (22:48 +0000)
"Yes" and "No" buttons should be positioned next to each other for consistency
with the native message box instead of separating them with the "Cancel"
button.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/sizer.cpp

index ebf81ecc1f267c5cadf75e99d9ce5fd66494a99b..518ccce91fa034e619f9c5c48cbf0572005c3d24 100644 (file)
@@ -2578,19 +2578,35 @@ 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);
+        {
+            // according to HIG, in explicit apply windows the order is:
+            // [ Help                     Apply   Cancel   OK ]
 
-        if (m_buttonCancel){
-            Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
-            // Cancel or help should be default
-            // m_buttonCancel->SetDefaultButton();
+            Add((wxWindow*)m_buttonApply,
+                0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
+
+            if (m_buttonCancel)
+                Add((wxWindow*)m_buttonCancel,
+                    0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
+
+            if (m_buttonAffirmative)
+                Add((wxWindow*)m_buttonAffirmative,
+                     0, wxALIGN_CENTRE | wxLEFT, 6);
+        }
+        else
+        {
+            // without an Apply button, have the buttons representing
+            // affirmative and negative close to each other.
+
+            if (m_buttonAffirmative)
+                Add((wxWindow*)m_buttonAffirmative,
+                    0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
+
+            if (m_buttonCancel)
+                Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT, 6);
         }
 
-        if (m_buttonAffirmative)
-            Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6);
 #elif defined(__WXMSW__)
         // Windows