include/vcl/toolkit/MenuButton.hxx | 9 --------- vcl/source/control/MenuButton.cxx | 34 +++++----------------------------- 2 files changed, 5 insertions(+), 38 deletions(-)
New commits: commit 06cc9c200a5f59bd76920edc65022fe2e522aae2 Author: Noel Grandin <[email protected]> AuthorDate: Thu Sep 4 10:57:06 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Sep 4 14:04:41 2025 +0200 MenuButton::SetDelayMenu is unused since commit d925df3929ac305c1bb104ebc4a7573a88809c34 Author: Michael Weghorn <[email protected]> Date: Sat Jul 26 10:11:50 2025 +0200 tdf#130857 weld: Drop unused weld::MenuToggleButton Change-Id: I82003551b0c8f61cb3d4e930935fa675ef770eb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190576 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/vcl/toolkit/MenuButton.hxx b/include/vcl/toolkit/MenuButton.hxx index b185fbf1e737..79f0edd9d71a 100644 --- a/include/vcl/toolkit/MenuButton.hxx +++ b/include/vcl/toolkit/MenuButton.hxx @@ -43,7 +43,6 @@ private: sal_uInt16 mnCurItemId; // whether the MenuButton is the owner of mpMenu bool mbOwnPopupMenu = false; - bool mbDelayMenu; bool mbStartingMenu; Link<MenuButton*,void> maActivateHdl; Link<MenuButton*,void> maSelectHdl; @@ -74,14 +73,6 @@ public: bool InPopupMode() const; void CancelMenu(); - //if false then the whole button launches the menu - //if true, then the button has a separator - //where the right portion launches the menu immediately - //where the left portion activates the underlying Button handlers - //before launching the menu in an idle, allowing it to be cancelled - //before being shown - void SetDelayMenu(bool bDelay) { mbDelayMenu = bDelay; } - void SetPopupMenu(PopupMenu* pNewMenu, bool bTakeOwnership); PopupMenu* GetPopupMenu() const { return mpMenu; } diff --git a/vcl/source/control/MenuButton.cxx b/vcl/source/control/MenuButton.cxx index b674fe7c8a7b..d7b80ded0702 100644 --- a/vcl/source/control/MenuButton.cxx +++ b/vcl/source/control/MenuButton.cxx @@ -150,7 +150,6 @@ bool MenuButton::InPopupMode() const MenuButton::MenuButton( vcl::Window* pParent, WinBits nWinBits ) : PushButton(WindowType::MENUBUTTON) , mnCurItemId(0) - , mbDelayMenu(false) , mbStartingMenu(false) { mnDDStyle = PushButtonDropdownStyle::MenuButton; @@ -185,33 +184,11 @@ IMPL_LINK_NOARG(MenuButton, ImplMenuTimeoutHdl, Timer *, void) void MenuButton::MouseButtonDown( const MouseEvent& rMEvt ) { - bool bExecute = true; - if (mbDelayMenu) + if ( PushButton::ImplHitTestPushButton( this, rMEvt.GetPosPixel() ) ) { - // If the separated dropdown symbol is not hit, delay the popup execution - if( rMEvt.GetPosPixel().X() <= ImplGetSeparatorX() ) - { - if ( !mpMenuTimer ) - { - mpMenuTimer.reset(new Timer("MenuTimer")); - mpMenuTimer->SetInvokeHandler( LINK( this, MenuButton, ImplMenuTimeoutHdl ) ); - } - - mpMenuTimer->SetTimeout( MouseSettings::GetActionDelay() ); - mpMenuTimer->Start(); - - PushButton::MouseButtonDown( rMEvt ); - bExecute = false; - } - } - if( bExecute ) - { - if ( PushButton::ImplHitTestPushButton( this, rMEvt.GetPosPixel() ) ) - { - if ( !(GetStyle() & WB_NOPOINTERFOCUS) ) - GrabFocus(); - ExecuteMenu(); - } + if ( !(GetStyle() & WB_NOPOINTERFOCUS) ) + GrabFocus(); + ExecuteMenu(); } } @@ -221,8 +198,7 @@ void MenuButton::KeyInput( const KeyEvent& rKEvt ) sal_uInt16 nCode = aKeyCode.GetCode(); if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() ) ExecuteMenu(); - else if ( !mbDelayMenu && - !aKeyCode.GetModifier() && + else if ( !aKeyCode.GetModifier() && ((nCode == KEY_RETURN) || (nCode == KEY_SPACE)) ) ExecuteMenu(); else
