From c9c361c8cf16bfd68a7d6ac4d6dceecfce72ee17 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 24 May 2020 20:26:54 +0100 Subject: support activate-on-single-click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iac0231b3bd84d664b1ab59023ef8242f3bd08940 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94773 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/treelist/svimpbox.cxx | 9 ++++++--- vcl/source/treelist/treelistbox.cxx | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'vcl') 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)) -- cgit