diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-15 17:12:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-15 17:13:45 +0100 |
commit | 101a8f0f0770b5789181812425ddfc8847f7206a (patch) | |
tree | 5cb3350558682baa1925b299fe51ee11da4fb9fa | |
parent | 593a298dd3cf61781d0d069eaf2fa80a82eda502 (diff) |
Related: fdo#65546 sort PACK_END into visual order for tabbing
and then reverse them for layout packing
Change-Id: I417bb3f6667ddc10103623867fea1a9b8061f5eb
-rw-r--r-- | vcl/source/window/builder.cxx | 16 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 26 |
2 files changed, 27 insertions, 15 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 4c25fae78cdf..728eae56b7a6 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1720,13 +1720,15 @@ bool VclBuilder::sortIntoBestTabTraversalOrder::operator()(const Window *pA, con if (bPackA > bPackB) return false; } - //honour relative box positions with pack group - bPackA = m_pBuilder->get_window_packing_data(pA).m_nPosition; - bPackB = m_pBuilder->get_window_packing_data(pB).m_nPosition; - if (bPackA < bPackB) - return true; - if (bPackA > bPackB) - return false; + //honour relative box positions with pack group, (numerical order is reversed + //for VCL_PACK_END, they are packed from the end back, but here we need + //them in visual layout order so that tabbing works as expected) + sal_Int32 nPackA = m_pBuilder->get_window_packing_data(pA).m_nPosition; + sal_Int32 nPackB = m_pBuilder->get_window_packing_data(pB).m_nPosition; + if (nPackA < nPackB) + return ePackA == VCL_PACK_START ? true : false; + if (nPackA > nPackB) + return ePackA == VCL_PACK_START ? false : true; //sort labels of Frames before body if (pA->GetParent() == pB->GetParent()) { diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 433288125f61..118298b4e103 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -222,6 +222,22 @@ void VclBox::setAllocation(const Size &rAllocation) nExtraSpace = (getPrimaryDimension(rAllocation) - getPrimaryDimension(aRequisition)) / nExpandChildren; } + //Split into those we pack from the start onwards, and those we pack from the end backwards + std::vector<Window*> aWindows[2]; + for (Window *pChild = GetWindow(WINDOW_FIRSTCHILD); pChild; pChild = pChild->GetWindow(WINDOW_NEXT)) + { + if (!pChild->IsVisible()) + continue; + + sal_Int32 ePacking = pChild->get_pack_type(); + aWindows[ePacking].push_back(pChild); + } + + //See VclBuilder::sortIntoBestTabTraversalOrder for why they are in visual + //order under the parent which requires us to reverse them here to + //pack from the end back + std::reverse(aWindows[VCL_PACK_END].begin(),aWindows[VCL_PACK_END].end()); + for (sal_Int32 ePackType = VCL_PACK_START; ePackType <= VCL_PACK_END; ++ePackType) { Point aPos(0, 0); @@ -231,15 +247,9 @@ void VclBox::setAllocation(const Size &rAllocation) setPrimaryCoordinate(aPos, nPrimaryCoordinate + nAllocPrimaryDimension); } - for (Window *pChild = GetWindow(WINDOW_FIRSTCHILD); pChild; pChild = pChild->GetWindow(WINDOW_NEXT)) + for (std::vector<Window*>::iterator aI = aWindows[ePackType].begin(), aEnd = aWindows[ePackType].end(); aI != aEnd; ++aI) { - if (!pChild->IsVisible()) - continue; - - sal_Int32 ePacking = pChild->get_pack_type(); - - if (ePacking != ePackType) - continue; + Window *pChild = *aI; long nPadding = pChild->get_padding(); |