From 5ac2c503c04282b3b456ccb8bf39d886e568d1fa Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Mon, 15 Sep 2014 10:30:18 +0200 Subject: vcl menu: Make DeactivateMenuBar() virtual to eliminate IsMenuBar() call. Change-Id: I33ba324a13e2addb678fb801222bd25a21c3ef1b --- include/vcl/menu.hxx | 5 ++++- vcl/source/window/menu.cxx | 22 ++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 8045963174d6..db133e66d3d8 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -190,7 +190,7 @@ protected: virtual void CloseStartedFrom() = 0; /// Deactivate the MenuBarWindow. - SAL_DLLPRIVATE sal_uLong DeactivateMenuBar(sal_uLong nFocusId); + virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId); /// Forward the KeyInput call to the MenuBar. SAL_DLLPRIVATE void MenuBarKeyInput(const KeyEvent& rEvent); @@ -423,6 +423,9 @@ public: /// Close the 'pStartedFrom' menu window. virtual void CloseStartedFrom() SAL_OVERRIDE; + /// Deactivate the MenuBarWindow. + virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId) SAL_OVERRIDE; + void ShowCloseButton( bool bShow = true ); bool HasCloseButton() const { return mbCloseBtnVisible; } bool HasFloatButton() const { return mbFloatBtnVisible; } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 0a58c2d9001d..60e2425ba3be 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2265,16 +2265,6 @@ bool Menu::HasValidEntries( bool bCheckPopups ) sal_uLong Menu::DeactivateMenuBar(sal_uLong nFocusId) { - if (!IsMenuBar()) - return nFocusId; - - nFocusId = ((MenuBarWindow*)(dynamic_cast(this))->ImplGetWindow())->GetFocusId(); - if (nFocusId) - { - ((MenuBarWindow*)(dynamic_cast(this))->ImplGetWindow())->SetFocusId(0); - ImplGetSVData()->maWinData.mbNoDeactivate = false; - } - return nFocusId; } @@ -2479,6 +2469,18 @@ void MenuBar::CloseStartedFrom() p->PopupClosed(this); } +sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId) +{ + nFocusId = ((MenuBarWindow*)(dynamic_cast(this))->ImplGetWindow())->GetFocusId(); + if (nFocusId) + { + ((MenuBarWindow*)(dynamic_cast(this))->ImplGetWindow())->SetFocusId(0); + ImplGetSVData()->maWinData.mbNoDeactivate = false; + } + + return nFocusId; +} + void MenuBar::ShowCloseButton(bool bShow) { ShowButtons( bShow, mbFloatBtnVisible, mbHideBtnVisible ); -- cgit