[Libreoffice-commits] core.git: include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 12 14:33:05 UTC 2020
include/vcl/layout.hxx | 4 +++-
vcl/source/window/layout.cxx | 28 ++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 3 deletions(-)
New commits:
commit 0491fb82f5f264ae327ea580c0ffb8a099a73343
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 12 12:38:31 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 12 16:32:23 2020 +0200
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 at redhat.com>
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 4eb1d72bc464..8a5b881644e4 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -386,7 +386,7 @@ public:
virtual ~VclPaned() override;
virtual void dispose() override;
long get_position() const { return m_nPosition; }
- void set_position(long nPosition) { m_nPosition = nPosition; }
+ virtual void set_position(long nPosition) { m_nPosition = nPosition; }
};
class VclVPaned final : public VclPaned
@@ -400,6 +400,7 @@ public:
virtual ~VclVPaned() override;
virtual Size calculateRequisition() const override;
virtual void setAllocation(const Size &rAllocation) override;
+ virtual void set_position(long nPosition) override;
};
class VclHPaned final : public VclPaned
@@ -413,6 +414,7 @@ public:
virtual ~VclHPaned() override;
virtual Size calculateRequisition() const override;
virtual void setAllocation(const Size &rAllocation) override;
+ virtual void set_position(long nPosition) override;
};
class VclFrame final : public VclBin
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
More information about the Libreoffice-commits
mailing list