[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 30 17:23:07 UTC 2020
include/vcl/treelistbox.hxx | 10 +++++++++-
vcl/source/treelist/svimpbox.cxx | 4 ++++
vcl/source/treelist/treelistbox.cxx | 11 ++++++++++-
3 files changed, 23 insertions(+), 2 deletions(-)
New commits:
commit 6dd1bc1049cc027145d003dd89ff11f9e229154b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 31 19:13:54 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Nov 30 18:22:27 2020 +0100
support hover-selection in SvTreeListBox
Change-Id: I5ad124d7c9e5219a557069bc7283208124c734af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95269
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106880
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index 0f47b402dc91..d0fcfabd9e01 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -216,7 +216,9 @@ class VCL_DLLPUBLIC SvTreeListBox
bool mbContextBmpExpanded;
bool mbAlternatingRowColors;
bool mbUpdateAlternatingRows;
- bool mbQuickSearch; // Enables type-ahead search in the check list box.
+ bool mbQuickSearch; // Enables type-ahead search in the check list box.
+ bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does
+ bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does
SvTreeListEntry* pHdlEntry;
@@ -725,6 +727,12 @@ public:
// Enables type-ahead search in the check list box.
void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
+ // Make single click "activate" a row like a double-click normally does
+ void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
+
+ // Make mouse over a row "select" a row like a single-click normally does
+ void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
+
void SetForceMakeVisible(bool bEnable);
virtual FactoryFunction GetUITestFactory() const override;
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index e56932047df0..7ccbb5856f01 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -2099,6 +2099,10 @@ void SvImpLBox::MouseMove( const MouseEvent& rMEvt)
if (m_pView->mbHoverSelection)
{
if (aPos.X() < 0 || aPos.Y() < 0 || aPos.X() > m_aOutputSize.Width() || aPos.Y() > m_aOutputSize.Height())
+ pEntry = nullptr;
+ else
+ pEntry = GetEntry(aPos);
+ if (!pEntry)
m_pView->SelectAll(false);
else if (!m_pView->IsSelected(pEntry) && IsSelectable(pEntry))
m_pView->Select(pEntry);
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index aa56db5b718f..6e3c612093d8 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -369,6 +369,8 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) :
mbAlternatingRowColors(false),
mbUpdateAlternatingRows(false),
mbQuickSearch(false),
+ mbActivateOnSingleClick(false),
+ mbHoverSelection(false),
eSelMode(SelectionMode::NONE),
nMinWidthInChars(0),
mbCenterAndClipText(false)
@@ -2327,7 +2329,6 @@ void SvTreeListBox::MouseMove( const MouseEvent& rMEvt )
pImpl->MouseMove( rMEvt );
}
-
void SvTreeListBox::SetUpdateMode( bool bUpdate )
{
pImpl->SetUpdateMode( bUpdate );
@@ -3645,6 +3646,14 @@ bool SvTreeListBox::set_property(const OString &rKey, const OUString &rValue)
{
SetQuickSearch(toBool(rValue));
}
+ else if (rKey == "activate-on-single-click")
+ {
+ SetActivateOnSingleClick(toBool(rValue));
+ }
+ else if (rKey == "hover-selection")
+ {
+ SetHoverSelection(toBool(rValue));
+ }
else if (rKey == "reorderable")
{
if (toBool(rValue))
More information about the Libreoffice-commits
mailing list