summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-05-12 12:38:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-05-12 16:32:23 +0200
commit0491fb82f5f264ae327ea580c0ffb8a099a73343 (patch)
treebf9ddb8db522995a7f1bc014ab8666dffe5fa131 /vcl
parent19edcfe36b32b15f86cba1eead7932b610e70ce7 (diff)
make VclPaned::set_position take effect
Change-Id: Id4ae096b413196cfb7118cd3a09a3f0a6c333f01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94053 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/layout.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 22f8f12ad13a..9225c27b05a8 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2547,7 +2547,7 @@ void VclVPaned::arrange(const Size& rAllocation, long nFirstHeight, long nSecond
{
Point aSplitterPos(0, aFirstChildSize.Height());
setLayoutAllocation(*m_pSplitter, aSplitterPos, aSplitterSize);
- set_position(aSplitterPos.Y() + aSplitterSize.Height() / 2);
+ m_nPosition = aSplitterPos.Y() + aSplitterSize.Height() / 2;
}
else if (nElement == 1)
{
@@ -2563,6 +2563,18 @@ void VclVPaned::arrange(const Size& rAllocation, long nFirstHeight, long nSecond
}
}
+void VclVPaned::set_position(long nPosition)
+{
+ VclPaned::set_position(nPosition);
+
+ Size aAllocation(GetSizePixel());
+ Size aSplitterSize(m_pSplitter->GetSizePixel());
+
+ nPosition -= aSplitterSize.Height() / 2;
+
+ arrange(aAllocation, nPosition, aAllocation.Height() - nPosition - aSplitterSize.Height());
+}
+
void VclVPaned::setAllocation(const Size& rAllocation)
{
//supporting "shrink" could be done by adjusting the allowed drag rectangle
@@ -2654,7 +2666,7 @@ void VclHPaned::arrange(const Size& rAllocation, long nFirstWidth, long nSecondW
{
Point aSplitterPos(aFirstChildSize.Width(), 0);
setLayoutAllocation(*m_pSplitter, aSplitterPos, aSplitterSize);
- set_position(aSplitterPos.X() + aSplitterSize.Width() / 2);
+ m_nPosition = aSplitterPos.X() + aSplitterSize.Width() / 2;
}
else if (nElement == 1)
{
@@ -2670,6 +2682,18 @@ void VclHPaned::arrange(const Size& rAllocation, long nFirstWidth, long nSecondW
}
}
+void VclHPaned::set_position(long nPosition)
+{
+ VclPaned::set_position(nPosition);
+
+ Size aAllocation(GetSizePixel());
+ Size aSplitterSize(m_pSplitter->GetSizePixel());
+
+ nPosition -= aSplitterSize.Width() / 2;
+
+ arrange(aAllocation, nPosition, aAllocation.Width() - nPosition - aSplitterSize.Width());
+}
+
void VclHPaned::setAllocation(const Size& rAllocation)
{
//supporting "shrink" could be done by adjusting the allowed drag rectangle