Kaydet (Commit) 2636ab88 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

vcl menu: Rename CloseStartedFrom() to ClosePopup() + adapt code.

Fixes a regression from fcc49e11 (clicking
outside of an opened menubar's menu did not close the menubar).

Change-Id: Ib6efddd6c250b173469772c7b2ae642b5ef609aa
üst 44c39434
...@@ -186,7 +186,7 @@ protected: ...@@ -186,7 +186,7 @@ protected:
SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel ); SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel );
/// Close the 'pStartedFrom' menu window. /// Close the 'pStartedFrom' menu window.
virtual void CloseStartedFrom() = 0; virtual void ClosePopup(Menu* pMenu) = 0;
/// Deactivate the MenuBarWindow. /// Deactivate the MenuBarWindow.
virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId); virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
...@@ -420,7 +420,7 @@ public: ...@@ -420,7 +420,7 @@ public:
virtual bool IsMenuBar() const SAL_OVERRIDE { return true; } virtual bool IsMenuBar() const SAL_OVERRIDE { return true; }
/// Close the 'pStartedFrom' menu window. /// Close the 'pStartedFrom' menu window.
virtual void CloseStartedFrom() SAL_OVERRIDE; virtual void ClosePopup(Menu* pMenu) SAL_OVERRIDE;
/// Deactivate the MenuBarWindow. /// Deactivate the MenuBarWindow.
virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId) SAL_OVERRIDE; virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId) SAL_OVERRIDE;
...@@ -513,7 +513,7 @@ public: ...@@ -513,7 +513,7 @@ public:
virtual bool IsMenuBar() const SAL_OVERRIDE { return false; } virtual bool IsMenuBar() const SAL_OVERRIDE { return false; }
/// Close the 'pStartedFrom' menu window. /// Close the 'pStartedFrom' menu window.
virtual void CloseStartedFrom() SAL_OVERRIDE; virtual void ClosePopup(Menu* pMenu) SAL_OVERRIDE;
void SetText( const OUString& rTitle ) { aTitleText = rTitle; } void SetText( const OUString& rTitle ) { aTitleText = rTitle; }
const OUString& GetText() const { return aTitleText; } const OUString& GetText() const { return aTitleText; }
......
...@@ -2420,24 +2420,19 @@ MenuBar::~MenuBar() ...@@ -2420,24 +2420,19 @@ MenuBar::~MenuBar()
ImplDestroy( this, true ); ImplDestroy( this, true );
} }
void MenuBar::CloseStartedFrom() void MenuBar::ClosePopup(Menu *pMenu)
{ {
// if the window was closed by TH, there is another menu MenuBarWindow* p = dynamic_cast<MenuBarWindow*>(ImplGetWindow());
// which has this window as pActivePopup
if (!pStartedFrom)
return;
MenuBarWindow* p = (MenuBarWindow*) pStartedFrom->ImplGetWindow();
if (p) if (p)
p->PopupClosed(this); p->PopupClosed(pMenu);
} }
sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId) sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId)
{ {
nFocusId = ((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->GetFocusId(); nFocusId = dynamic_cast<MenuBarWindow*>(ImplGetWindow())->GetFocusId();
if (nFocusId) if (nFocusId)
{ {
((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->SetFocusId(0); dynamic_cast<MenuBarWindow*>(ImplGetWindow())->SetFocusId(0);
ImplGetSVData()->maWinData.mbNoDeactivate = false; ImplGetSVData()->maWinData.mbNoDeactivate = false;
} }
...@@ -2701,17 +2696,12 @@ PopupMenu::~PopupMenu() ...@@ -2701,17 +2696,12 @@ PopupMenu::~PopupMenu()
*pRefAutoSubMenu = NULL; // #111060# avoid second delete in ~MenuItemData *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 MenuFloatingWindow* p = dynamic_cast<MenuFloatingWindow*>(ImplGetWindow());
// which has this window as pActivePopup PopupMenu *pPopup = dynamic_cast<PopupMenu*>(pMenu);
if (!pStartedFrom)
return;
MenuFloatingWindow* p = (MenuFloatingWindow*) pStartedFrom->ImplGetWindow();
PopupMenu *pMenu = dynamic_cast<PopupMenu*>(this);
if (p && pMenu) if (p && pMenu)
p->KillActivePopup(pMenu); p->KillActivePopup(pPopup);
} }
bool PopupMenu::IsInExecute() bool PopupMenu::IsInExecute()
......
...@@ -252,8 +252,8 @@ IMPL_LINK_NOARG(MenuFloatingWindow, PopupEnd) ...@@ -252,8 +252,8 @@ IMPL_LINK_NOARG(MenuFloatingWindow, PopupEnd)
} }
else else
{ {
if (pMenu) if (pMenu && pMenu->pStartedFrom)
pMenu->CloseStartedFrom(); pMenu->pStartedFrom->ClosePopup(pMenu);
} }
if ( pM ) if ( pM )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment