diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-09-15 10:22:49 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-09-15 12:07:17 +0200 |
commit | fcc49e118c9da28309dce3389d111a546cba19cd (patch) | |
tree | df71f55db1941a1a7ce55ed0769b68ceac14d6b4 /vcl | |
parent | 11b6b13fcc7b8e14e07fd482a4df9cc20a6b1e06 (diff) |
vcl menu: Make CloseStartedFrom() virtual to eliminate IsMenuBar() call.
Change-Id: Ifd89b7a9264075b166dd621fcb2c55225e25ea87
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/menu.cxx | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 7923acde7b33..0a58c2d9001d 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2263,30 +2263,6 @@ bool Menu::HasValidEntries( bool bCheckPopups ) return bValidEntries; } -void Menu::CloseStartedFrom() -{ - // if the window was closed by TH, there is another menu - // which has this window as pActivePopup - if (!pStartedFrom) - return; - - // pWin from parent could be 0, if the list is - // cleaned from the start, now clean up the endpopup-events - if (pStartedFrom->IsMenuBar()) - { - MenuBarWindow* p = (MenuBarWindow*) pStartedFrom->ImplGetWindow(); - if (p) - p->PopupClosed(this); - } - else - { - MenuFloatingWindow* p = (MenuFloatingWindow*) pStartedFrom->ImplGetWindow(); - PopupMenu *pMenu = dynamic_cast<PopupMenu*>(this); - if (p && pMenu) - p->KillActivePopup(pMenu); - } -} - sal_uLong Menu::DeactivateMenuBar(sal_uLong nFocusId) { if (!IsMenuBar()) @@ -2491,6 +2467,18 @@ MenuBar::~MenuBar() ImplDestroy( this, true ); } +void MenuBar::CloseStartedFrom() +{ + // if the window was closed by TH, there is another menu + // which has this window as pActivePopup + if (!pStartedFrom) + return; + + MenuBarWindow* p = (MenuBarWindow*) pStartedFrom->ImplGetWindow(); + if (p) + p->PopupClosed(this); +} + void MenuBar::ShowCloseButton(bool bShow) { ShowButtons( bShow, mbFloatBtnVisible, mbHideBtnVisible ); @@ -2717,6 +2705,19 @@ PopupMenu::~PopupMenu() *pRefAutoSubMenu = NULL; // #111060# avoid second delete in ~MenuItemData } +void PopupMenu::CloseStartedFrom() +{ + // if the window was closed by TH, there is another menu + // which has this window as pActivePopup + if (!pStartedFrom) + return; + + MenuFloatingWindow* p = (MenuFloatingWindow*) pStartedFrom->ImplGetWindow(); + PopupMenu *pMenu = dynamic_cast<PopupMenu*>(this); + if (p && pMenu) + p->KillActivePopup(pMenu); +} + bool PopupMenu::IsInExecute() { return GetActivePopupMenu() ? true : false; |