diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-31 19:13:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-06-01 21:08:30 +0200 |
commit | d56ed8a462fb672f61a07279f30eb8597033f40b (patch) | |
tree | a68d92e128618343873b0bf7cd6b1f0b32d939cf | |
parent | 31db2a1c9e1597e7ab7d9b3505b99e2b08a53d9d (diff) |
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@redhat.com>
-rw-r--r-- | include/vcl/treelistbox.hxx | 8 | ||||
-rw-r--r-- | vcl/source/treelist/svimpbox.cxx | 6 | ||||
-rw-r--r-- | vcl/source/treelist/treelistbox.cxx | 6 |
3 files changed, 16 insertions, 4 deletions
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx index 288314af8232..586686e81de1 100644 --- a/include/vcl/treelistbox.hxx +++ b/include/vcl/treelistbox.hxx @@ -221,8 +221,9 @@ class VCL_DLLPUBLIC SvTreeListBox bool mbContextBmpExpanded; bool mbAlternatingRowColors; bool mbUpdateAlternatingRows; - 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 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; @@ -723,6 +724,9 @@ public: // 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 2fc2d0bf9d3c..dff21f931e5f 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -2074,7 +2074,11 @@ void SvImpLBox::MouseMove( const MouseEvent& rMEvt) { SvTreeListEntry* pEntry = GetClickedEntry( rMEvt.GetPosPixel() ); if ( !MouseMoveCheckCtrl( rMEvt, pEntry ) && ( m_aSelEng.GetSelectionMode() != SelectionMode::NONE ) ) - m_aSelEng.SelMouseMove( rMEvt ); + { + m_aSelEng.SelMouseMove(rMEvt); + if (m_pView->mbHoverSelection && !m_pView->IsSelected(pEntry)) + m_pView->Select(pEntry); + } } void SvImpLBox::ExpandAll() diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 3c68f1331f0b..389ed170828f 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -403,6 +403,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) : mbUpdateAlternatingRows(false), mbQuickSearch(false), mbActivateOnSingleClick(false), + mbHoverSelection(false), eSelMode(SelectionMode::NONE), nMinWidthInChars(0), mnDragAction(DND_ACTION_COPYMOVE | DND_ACTION_LINK), @@ -2337,7 +2338,6 @@ void SvTreeListBox::MouseMove( const MouseEvent& rMEvt ) pImpl->MouseMove( rMEvt ); } - void SvTreeListBox::SetUpdateMode( bool bUpdate ) { pImpl->SetUpdateMode( bUpdate ); @@ -3585,6 +3585,10 @@ bool SvTreeListBox::set_property(const OString &rKey, const OUString &rValue) { SetActivateOnSingleClick(toBool(rValue)); } + else if (rKey == "hover-selection") + { + SetHoverSelection(toBool(rValue)); + } else if (rKey == "reorderable") { if (toBool(rValue)) |