From 6dd1bc1049cc027145d003dd89ff11f9e229154b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 31 May 2020 19:13:54 +0100 Subject: support hover-selection in SvTreeListBox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5ad124d7c9e5219a557069bc7283208124c734af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95269 Tested-by: Jenkins Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106880 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos --- vcl/source/treelist/svimpbox.cxx | 4 ++++ vcl/source/treelist/treelistbox.cxx | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'vcl') 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)) -- cgit