summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-09-15 20:13:54 +0200
committerJan Holesovsky <kendy@collabora.com>2014-09-15 20:16:26 +0200
commit2636ab883adbcb1f6593787934c6d6d3fff67c21 (patch)
tree243452cb8ec05cd4672cd169dd55e057729f89e2
parent44c394344668134c4d842aa93a454218ccdfec7c (diff)
vcl menu: Rename CloseStartedFrom() to ClosePopup() + adapt code.
Fixes a regression from fcc49e118c9da28309dce3389d111a546cba19cd (clicking outside of an opened menubar's menu did not close the menubar). Change-Id: Ib6efddd6c250b173469772c7b2ae642b5ef609aa
-rw-r--r--include/vcl/menu.hxx6
-rw-r--r--vcl/source/window/menu.cxx28
-rw-r--r--vcl/source/window/menufloatingwindow.cxx4
3 files changed, 14 insertions, 24 deletions
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 9fdabcb080e0..a4576959eb51 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -186,7 +186,7 @@ protected:
SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel );
/// Close the 'pStartedFrom' menu window.
- virtual void CloseStartedFrom() = 0;
+ virtual void ClosePopup(Menu* pMenu) = 0;
/// Deactivate the MenuBarWindow.
virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
@@ -420,7 +420,7 @@ public:
virtual bool IsMenuBar() const SAL_OVERRIDE { return true; }
/// Close the 'pStartedFrom' menu window.
- virtual void CloseStartedFrom() SAL_OVERRIDE;
+ virtual void ClosePopup(Menu* pMenu) SAL_OVERRIDE;
/// Deactivate the MenuBarWindow.
virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId) SAL_OVERRIDE;
@@ -513,7 +513,7 @@ public:
virtual bool IsMenuBar() const SAL_OVERRIDE { return false; }
/// Close the 'pStartedFrom' menu window.
- virtual void CloseStartedFrom() SAL_OVERRIDE;
+ virtual void ClosePopup(Menu* pMenu) 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 4ca8287aa02a..16a5ca592fce 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2420,24 +2420,19 @@ MenuBar::~MenuBar()
ImplDestroy( this, true );
}
-void MenuBar::CloseStartedFrom()
+void MenuBar::ClosePopup(Menu *pMenu)
{
- // 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();
+ MenuBarWindow* p = dynamic_cast<MenuBarWindow*>(ImplGetWindow());
if (p)
- p->PopupClosed(this);
+ p->PopupClosed(pMenu);
}
sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId)
{
- nFocusId = ((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->GetFocusId();
+ nFocusId = dynamic_cast<MenuBarWindow*>(ImplGetWindow())->GetFocusId();
if (nFocusId)
{
- ((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->SetFocusId(0);
+ dynamic_cast<MenuBarWindow*>(ImplGetWindow())->SetFocusId(0);
ImplGetSVData()->maWinData.mbNoDeactivate = false;
}
@@ -2701,17 +2696,12 @@ PopupMenu::~PopupMenu()
*pRefAutoSubMenu = NULL; // #111060# avoid second delete in ~MenuItemData
}
-void PopupMenu::CloseStartedFrom()
+void PopupMenu::ClosePopup(Menu* pMenu)
{
- // 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);
+ MenuFloatingWindow* p = dynamic_cast<MenuFloatingWindow*>(ImplGetWindow());
+ PopupMenu *pPopup = dynamic_cast<PopupMenu*>(pMenu);
if (p && pMenu)
- p->KillActivePopup(pMenu);
+ p->KillActivePopup(pPopup);
}
bool PopupMenu::IsInExecute()
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 51511107bc84..26d279df95c3 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -252,8 +252,8 @@ IMPL_LINK_NOARG(MenuFloatingWindow, PopupEnd)
}
else
{
- if (pMenu)
- pMenu->CloseStartedFrom();
+ if (pMenu && pMenu->pStartedFrom)
+ pMenu->pStartedFrom->ClosePopup(pMenu);
}
if ( pM )