diff options
-rw-r--r-- | include/vcl/menu.hxx | 8 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 49 |
2 files changed, 32 insertions, 25 deletions
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 5eaa3c9a9968..8045963174d6 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -187,7 +187,7 @@ protected: SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel ); /// Close the 'pStartedFrom' menu window. - SAL_DLLPRIVATE void CloseStartedFrom(); + virtual void CloseStartedFrom() = 0; /// Deactivate the MenuBarWindow. SAL_DLLPRIVATE sal_uLong DeactivateMenuBar(sal_uLong nFocusId); @@ -420,6 +420,9 @@ public: virtual bool IsMenuBar() const SAL_OVERRIDE { return true; } + /// Close the 'pStartedFrom' menu window. + virtual void CloseStartedFrom() SAL_OVERRIDE; + void ShowCloseButton( bool bShow = true ); bool HasCloseButton() const { return mbCloseBtnVisible; } bool HasFloatButton() const { return mbFloatBtnVisible; } @@ -504,6 +507,9 @@ public: virtual bool IsMenuBar() const SAL_OVERRIDE { return false; } + /// Close the 'pStartedFrom' menu window. + virtual void CloseStartedFrom() SAL_OVERRIDE; + void SetText( const OUString& rTitle ) { aTitleText = rTitle; } const OUString& GetText() const { return aTitleText; } 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; |