diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-05-03 11:30:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-03 11:31:40 +0100 |
commit | bfa360c6e761a1e9b3e34665b9b36d724979fdfd (patch) | |
tree | 3f4633e563474f6f3ad2e1e6906db637aed29137 | |
parent | da06166015689eca260c702602bef4cea58afbd3 (diff) |
unset WB_GROUP on non-initial buttons in groups
Change-Id: I8846318e8d7fef862bb105af878b2df17045d7ff
-rw-r--r-- | include/vcl/builder.hxx | 1 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 24 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 3 |
3 files changed, 24 insertions, 4 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 9ad812e7aa54..51d3efc72bd1 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 362786a33176..cc3919e35e4b 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 d19ffaeba42d..c3935d967e59 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 |