summaryrefslogtreecommitdiff
path: root/vcl/source/window/menufloatingwindow.cxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-11-17 01:57:33 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2023-11-19 18:12:23 +0100
commit0a626ba2073772940fd9a4610d447e00f9afa3f9 (patch)
treebf83c25a6cf671223c1dda7808a1a6dce5fc0d14 /vcl/source/window/menufloatingwindow.cxx
parentf8730aed0a5481c970cca8bd9f4f217d37bfb856 (diff)
WIP: async popup menus
A first patch to get some feedback. Asnyc LO popup menus are still buggy, as I'm not sure where to call the PopupMenu::Finish for them. Also the XDialogClosedListener is currently just for convenience and might want some separate notifier. Fun fact, that ImplExecute / ImplPopup is called for submenu, but then doesn't execute. And generally the naming of some variables is IMHO wrong; I might also prefix Menu members with "m_" for easier readability. Change-Id: Id8b413aa6b4699201e58db0113649c6b224d33b6
Diffstat (limited to 'vcl/source/window/menufloatingwindow.cxx')
-rw-r--r--vcl/source/window/menufloatingwindow.cxx31
1 files changed, 25 insertions, 6 deletions
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 95a0d3f4d02a..c0a03cca1baa 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -308,8 +308,15 @@ IMPL_LINK_NOARG(MenuFloatingWindow, PopupEnd, FloatingWindow*, void)
pMenu->pStartedFrom->ClosePopup(pMenu);
}
- if ( pM )
+ if (pM)
+ {
pM->pStartedFrom = nullptr;
+ if (m_xListener.is())
+ {
+ css::ui::dialogs::DialogClosedEvent aEvent(GetComponentInterface(), pM->GetCurItemId());
+ m_xListener->dialogClosed(aEvent);
+ }
+ }
}
IMPL_LINK_NOARG(MenuFloatingWindow, AutoScroll, Timer *, void)
@@ -443,21 +450,31 @@ void MenuFloatingWindow::End()
Window::EndSaveFocus(xFocusId);
}
+ Finish();
+
bInExecute = false;
}
-void MenuFloatingWindow::Execute()
+void MenuFloatingWindow::Popup(const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener)
{
ImplSVData* pSVData = ImplGetSVData();
-
pSVData->maAppData.mpActivePopupMenu = static_cast<PopupMenu*>(pMenu.get());
-
+ m_xListener = xListener;
Start();
+}
+void MenuFloatingWindow::Finish()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maAppData.mpActivePopupMenu = nullptr;
+}
+
+void MenuFloatingWindow::Execute()
+{
+ Popup();
while (bInExecute && !Application::IsQuit())
Application::Yield();
-
- pSVData->maAppData.mpActivePopupMenu = nullptr;
+ Finish();
}
void MenuFloatingWindow::StopExecute()
@@ -474,6 +491,7 @@ void MenuFloatingWindow::StopExecute()
// notify parent, needed for accessibility
if( pMenu && pMenu->pStartedFrom )
pMenu->pStartedFrom->ImplCallEventListeners( VclEventId::MenuSubmenuDeactivate, nPosInParent );
+ Finish();
}
void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
@@ -502,6 +520,7 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
PaintImmediately();
}
+ pPopup->Finish();
}
void MenuFloatingWindow::EndExecute()