include/vcl/treelistbox.hxx | 4 ++++ vcl/source/treelist/svimpbox.cxx | 9 ++++++--- vcl/source/treelist/treelistbox.cxx | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-)
New commits: commit c9c361c8cf16bfd68a7d6ac4d6dceecfce72ee17 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun May 24 20:26:54 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon May 25 20:17:01 2020 +0200 support activate-on-single-click Change-Id: Iac0231b3bd84d664b1ab59023ef8242f3bd08940 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94773 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx index aa161f0dd075..288314af8232 100644 --- a/include/vcl/treelistbox.hxx +++ b/include/vcl/treelistbox.hxx @@ -222,6 +222,7 @@ class VCL_DLLPUBLIC SvTreeListBox 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 SvTreeListEntry* pHdlEntry; @@ -719,6 +720,9 @@ 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; } + void SetForceMakeVisible(bool bEnable); virtual FactoryFunction GetUITestFactory() const override; diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 4385c1ae8f9d..b2d4b0dc5c42 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -585,8 +585,6 @@ void SvImpLBox::RecalcFocusRect() // Sets cursor. When using SingleSelection, the selection is adjusted. - - void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect ) { SvViewDataEntry* pViewDataNewCur = nullptr; @@ -2006,7 +2004,7 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) } - if( (rMEvt.GetClicks() % 2) == 0 ) + if( (rMEvt.GetClicks() % 2) == 0) { m_nFlags &= ~LBoxFlags::StartEditTimer; m_pView->pHdlEntry = pEntry; @@ -2067,6 +2065,9 @@ void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt) m_aEditClickPos = rMEvt.GetPosPixel(); m_aEditIdle.Start(); } + + if (m_pView->mbActivateOnSingleClick) + m_pView->DoubleClickHdl(); } void SvImpLBox::MouseMove( const MouseEvent& rMEvt) @@ -2367,6 +2368,8 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) break; case KEY_RETURN: + if (m_pView->mbActivateOnSingleClick) + m_pView->DoubleClickHdl(); bKeyUsed = false; break; diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 5638268e6691..d8bc727766b6 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -402,6 +402,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) : mbAlternatingRowColors(false), mbUpdateAlternatingRows(false), mbQuickSearch(false), + mbActivateOnSingleClick(false), eSelMode(SelectionMode::NONE), nMinWidthInChars(0), mnDragAction(DND_ACTION_COPYMOVE | DND_ACTION_LINK), @@ -488,7 +489,6 @@ bool SvTreeListBox::DoubleClickHdl() return !aDoubleClickHdl.IsSet() || aDoubleClickHdl.Call(this); } - bool SvTreeListBox::CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 nAction ) { if ( pSource == this ) @@ -3576,6 +3576,10 @@ 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 == "reorderable") { if (toBool(rValue)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits