[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 22 08:01:37 UTC 2021
include/vcl/weldutils.hxx | 10 ++++++++++
vcl/source/app/weldutils.cxx | 17 +++++++++++++++++
2 files changed, 27 insertions(+)
New commits:
commit ec97d25ed63e0db98cc13d090c1d8830e2132a44
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Dec 14 15:08:33 2020 +0000
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Apr 22 10:01:06 2021 +0200
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 at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114408
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index 9a29e89d7b5f..ecfe2c7e7dbb 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -24,6 +24,11 @@
class CalendarWrapper;
+namespace vcl
+{
+class Window;
+}
+
namespace weld
{
typedef cppu::WeakComponentImplHelper<css::awt::XWindow> TransportAsXWindow_Base;
@@ -401,6 +406,11 @@ VCL_DLLPUBLIC void RemoveParentKeepChildren(weld::TreeView& rTreeView, weld::Tre
// return the min height of a weld::Entry
VCL_DLLPUBLIC int GetMinimumEditHeight();
+
+// return the weld::Window of the SalFrame rOutWin is in, and convert rRect
+// from relative to rOutWin to relative to that weld::Window suitable for use
+// with popup_at_rect
+VCL_DLLPUBLIC weld::Window* GetPopupParent(vcl::Window& rOutWin, tools::Rectangle& rRect);
}
#endif
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx
index 237645076330..a4c3de5097b6 100644
--- a/vcl/source/app/weldutils.cxx
+++ b/vcl/source/app/weldutils.cxx
@@ -14,6 +14,8 @@
#include <svl/zformat.hxx>
#include <vcl/builderpage.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>
@@ -546,6 +548,21 @@ void WidgetStatusListener::dispose()
mxFrame.clear();
mWidget = nullptr;
}
+
+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: */
More information about the Libreoffice-commits
mailing list