diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-12-18 16:54:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-12-18 21:58:37 +0100 |
commit | f3c63fc6024a95daf51aa3ca14ba57dacfecad31 (patch) | |
tree | b8cdef63304b8f5db5a42025fa5cecfe4fee57af /basctl | |
parent | 3dc2e629b247873bfbd3190c11152d8d2bab1a03 (diff) |
weld basctl popup menus
Change-Id: I28b18df7a27cd65e81f9e2e6f1ab96b5f1938e6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107975
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 30 |
2 files changed, 13 insertions, 19 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index dfe78c588ebe..06045356bccb 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -164,7 +164,6 @@ class BreakPointWindow final : public vcl::Window sal_uInt16 nMarkerPos; BreakPointList aBreakPointList; bool bErrorMarker; - std::unique_ptr<VclBuilder> mpUIBuilder; virtual void DataChanged(DataChangedEvent const & rDCEvt) override; @@ -180,7 +179,6 @@ class BreakPointWindow final : public vcl::Window public: BreakPointWindow (vcl::Window* pParent, ModulWindow*); - virtual void dispose() override; void SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false ); void SetNoMarker (); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 4a8ab6fe0e54..5ebca907749e 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -46,10 +46,10 @@ #include <sfx2/viewfrm.hxx> #include <tools/debug.hxx> #include <vcl/weld.hxx> +#include <vcl/weldutils.hxx> #include <svl/urihelper.hxx> #include <svx/svxids.hrc> #include <vcl/commandevent.hxx> -#include <vcl/menu.hxx> #include <vcl/xtextedt.hxx> #include <vcl/textview.hxx> #include <vcl/txtattr.hxx> @@ -1493,18 +1493,20 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt ) if ( rCEvt.GetCommand() != CommandEventId::ContextMenu ) return; - if (!mpUIBuilder) - mpUIBuilder.reset(new VclBuilder(nullptr, AllSettings::GetUIRootDir(), "modules/BasicIDE/ui/breakpointmenus.ui", "")); - Point aPos( rCEvt.IsMouseEvent() ? rCEvt.GetMousePosPixel() : Point(1,1) ); + tools::Rectangle aRect(aPos, Size(1, 1)); + weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect); + + std::unique_ptr<weld::Builder> xUIBuilder(Application::CreateBuilder(pPopupParent, "modules/BasicIDE/ui/breakpointmenus.ui")); + Point aEventPos( PixelToLogic( aPos ) ); BreakPoint* pBrk = rCEvt.IsMouseEvent() ? FindBreakPoint( aEventPos ) : nullptr; if ( pBrk ) { // test if break point is enabled... - VclPtr<PopupMenu> xBrkPropMenu = mpUIBuilder->get_menu("breakmenu"); - xBrkPropMenu->CheckItem("active", pBrk->bEnabled); - OString sCommand = xBrkPropMenu->GetItemIdent(xBrkPropMenu->Execute(this, aPos)); + std::unique_ptr<weld::Menu> xBrkPropMenu = xUIBuilder->weld_menu("breakmenu"); + xBrkPropMenu->set_active("active", pBrk->bEnabled); + OString sCommand = xBrkPropMenu->popup_at_rect(pPopupParent, aRect); if (sCommand == "active") { pBrk->bEnabled = !pBrk->bEnabled; @@ -1513,7 +1515,7 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt ) } else if (sCommand == "properties") { - BreakPointDialog aBrkDlg(GetFrameWeld(), GetBreakPoints()); + BreakPointDialog aBrkDlg(pPopupParent, GetBreakPoints()); aBrkDlg.SetCurrentBreakPoint( *pBrk ); aBrkDlg.run(); Invalidate(); @@ -1521,11 +1523,11 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt ) } else { - VclPtr<PopupMenu> xBrkListMenu = mpUIBuilder->get_menu("breaklistmenu"); - OString sCommand = xBrkListMenu->GetItemIdent(xBrkListMenu->Execute(this, aPos)); + std::unique_ptr<weld::Menu> xBrkListMenu = xUIBuilder->weld_menu("breaklistmenu"); + OString sCommand = xBrkListMenu->popup_at_rect(pPopupParent, aRect); if (sCommand == "manage") { - BreakPointDialog aBrkDlg(GetFrameWeld(), GetBreakPoints()); + BreakPointDialog aBrkDlg(pPopupParent, GetBreakPoints()); aBrkDlg.run(); Invalidate(); } @@ -1570,12 +1572,6 @@ void BreakPointWindow::setBackgroundColor(Color aColor) SetBackground(Wallpaper(aColor)); } -void BreakPointWindow::dispose() -{ - mpUIBuilder.reset(); - Window::dispose(); -} - namespace { struct WatchItem |