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:
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; }
......
......@@ -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()
......
......@@ -252,8 +252,8 @@ IMPL_LINK_NOARG(MenuFloatingWindow, PopupEnd)
}
else
{
if (pMenu)
pMenu->CloseStartedFrom();
if (pMenu && pMenu->pStartedFrom)
pMenu->pStartedFrom->ClosePopup(pMenu);
}
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