diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-12-14 15:08:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-12-15 09:45:19 +0100 |
commit | 097faa945cfc7150d5c556444991f85458e9cea9 (patch) | |
tree | a4a382e5e50aa88bcc3f2f2a06a284e429c0c5c1 /vcl | |
parent | ba48287d486190a5daec7ef9612fbe7f361228d1 (diff) |
add a way to correctly position a weld::Menu given a vcl::Window
Change-Id: I7fc6a1bb6cfca40a4a97568f957d127445b4d31c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107727
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/weldutils.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index 837220447063..bce1f478a1f1 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -16,6 +16,7 @@ #include <vcl/commandevent.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/event.hxx> +#include <vcl/floatwin.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/weldutils.hxx> @@ -595,6 +596,21 @@ IMPL_LINK_NOARG(ButtonPressRepeater, RepeatTimerHdl, Timer*, void) m_aRepeat.SetTimeout(Application::GetSettings().GetMouseSettings().GetButtonRepeat()); m_aLink.Call(m_rButton); } + +weld::Window* GetPopupParent(vcl::Window& rOutWin, tools::Rectangle& rRect) +{ + rRect.SetPos(rOutWin.OutputToScreenPixel(rRect.TopLeft())); + rRect = FloatingWindow::ImplConvertToAbsPos(&rOutWin, rRect); + + vcl::Window* pWin = &rOutWin; + while (!pWin->IsTopWindow()) + pWin = pWin->GetParent(); + + rRect = FloatingWindow::ImplConvertToRelPos(pWin, rRect); + rRect.SetPos(pWin->ScreenToOutputPixel(rRect.TopLeft())); + + return rOutWin.GetFrameWeld(); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |