[Libreoffice-commits] core.git: include/vcl vcl/source

Caolán McNamara caolanm at redhat.com
Fri May 3 03:32:00 PDT 2013


 include/vcl/builder.hxx       |    1 +
 vcl/source/window/builder.cxx |   24 ++++++++++++++++++++++--
 vcl/source/window/layout.cxx  |    3 +--
 3 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit bfa360c6e761a1e9b3e34665b9b36d724979fdfd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 3 11:30:00 2013 +0100

    unset WB_GROUP on non-initial buttons in groups
    
    Change-Id: I8846318e8d7fef862bb105af878b2df17045d7ff

diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 9ad812e..51d3efc 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -297,6 +297,7 @@ public:
     void setDeferredProperties();
 
     //Helpers to retrofit all the existing code to the builder
+    static void reorderWithinParent(std::vector<Window*>& rChilds, bool bIsButtonBox);
     static void reorderWithinParent(Window &rWindow, sal_uInt16 nNewPosition);
 private:
     Window *insertObject(Window *pParent, const OString &rClass, const OString &rID,
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 362786a..cc3919e 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1580,11 +1580,12 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
                             aChilds.push_back(pChild);
                         }
 
+                        bool bIsButtonBox = dynamic_cast<VclButtonBox*>(pCurrentChild) != NULL;
+
                         //sort child order within parent so that tabbing
                         //between controls goes in a visually sensible sequence
                         std::stable_sort(aChilds.begin(), aChilds.end(), sortIntoBestTabTraversalOrder(this));
-                        for (size_t i = 0; i < aChilds.size(); ++i)
-                            reorderWithinParent(*aChilds[i], i);
+                        reorderWithinParent(aChilds, bIsButtonBox);
                     }
                 }
             }
@@ -1607,6 +1608,25 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
     }
 }
 
+void VclBuilder::reorderWithinParent(std::vector<Window*>& rChilds, bool bIsButtonBox)
+{
+    for (size_t i = 0; i < rChilds.size(); ++i)
+    {
+        reorderWithinParent(*rChilds[i], i);
+
+        if (!bIsButtonBox)
+            break;
+
+        //The first member of the group for legacy code needs WB_GROUP set and the
+        //others not
+        WinBits nBits = rChilds[i]->GetStyle();
+        nBits &= ~WB_GROUP;
+        if (i == 0)
+            nBits |= WB_GROUP;
+        rChilds[i]->SetStyle(nBits);
+    }
+}
+
 void VclBuilder::collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
 {
     xmlreader::Span span;
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index d19ffae..c3935d9 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -697,8 +697,7 @@ void VclButtonBox::sort_native_button_order()
     //sort child order within parent so that we match the platform
     //button order
     std::stable_sort(aChilds.begin(), aChilds.end(), sortButtons(m_bVerticalContainer));
-    for (size_t i = 0; i < aChilds.size(); ++i)
-        VclBuilder::reorderWithinParent(*aChilds[i], i);
+    VclBuilder::reorderWithinParent(aChilds, true);
 }
 
 VclGrid::array_type VclGrid::assembleGrid() const


More information about the Libreoffice-commits mailing list