From fa8c85fa90e9565a357b247a69f930098d11ff84 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 16 Jan 2020 16:38:15 +0000 Subject: weld gallery panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4aebb3f90e9943044d106a507972c39434988f03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87003 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/app/customweld.cxx | 5 +++++ vcl/source/app/salvtables.cxx | 14 ++++++++++++++ vcl/source/window/layout.cxx | 12 ++++++++++++ 3 files changed, 31 insertions(+) (limited to 'vcl/source') diff --git a/vcl/source/app/customweld.cxx b/vcl/source/app/customweld.cxx index d6465ff289f5..07dc7935b198 100644 --- a/vcl/source/app/customweld.cxx +++ b/vcl/source/app/customweld.cxx @@ -13,6 +13,11 @@ namespace weld { CustomWidgetController::~CustomWidgetController() {} +IMPL_LINK_NOARG(CustomWidgetController, DragBeginHdl, weld::DrawingArea&, bool) +{ + return StartDrag(); +} + CustomWeld::CustomWeld(weld::Builder& rBuilder, const OString& rDrawingId, CustomWidgetController& rWidgetController) : m_rWidgetController(rWidgetController) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 3b6697755bf0..a8f90b24afdd 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5711,6 +5711,7 @@ private: DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void); DECL_LINK(CommandHdl, const CommandEvent&, bool); DECL_LINK(QueryTooltipHdl, tools::Rectangle&, OUString); + DECL_LINK(StartDragHdl, VclDrawingArea*, bool); // SalInstanceWidget has a generic listener for all these // events, ignore the ones we have specializations for @@ -5757,6 +5758,7 @@ public: m_xDrawingArea->SetStyleUpdatedHdl(LINK(this, SalInstanceDrawingArea, StyleUpdatedHdl)); m_xDrawingArea->SetCommandHdl(LINK(this, SalInstanceDrawingArea, CommandHdl)); m_xDrawingArea->SetQueryTooltipHdl(LINK(this, SalInstanceDrawingArea, QueryTooltipHdl)); + m_xDrawingArea->SetStartDragHdl(LINK(this, SalInstanceDrawingArea, StartDragHdl)); } virtual void queue_draw() override @@ -5830,6 +5832,11 @@ public: return m_xDrawingArea->OutputToAbsoluteScreenPixel(Point()); } + virtual void enable_drag_source(rtl::Reference& rHelper, sal_uInt8 eDNDConstants) override + { + m_xDrawingArea->SetDragHelper(rHelper, eDNDConstants); + } + virtual ~SalInstanceDrawingArea() override { m_xDrawingArea->SetQueryTooltipHdl(Link()); @@ -5905,6 +5912,13 @@ IMPL_LINK(SalInstanceDrawingArea, QueryTooltipHdl, tools::Rectangle&, rHelpArea, return m_aQueryTooltipHdl.Call(rHelpArea); } +IMPL_LINK_NOARG(SalInstanceDrawingArea, StartDragHdl, VclDrawingArea*, bool) +{ + if (m_aDragBeginHdl.Call(*this)) + return true; + return false; +} + namespace { //ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index be8313c12f00..ce8b3379dbc1 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -2694,4 +2694,16 @@ bool isLayoutEnabled(const vcl::Window *pWindow) return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(GetWindowType::Next); } +void VclDrawingArea::StartDrag(sal_Int8, const Point&) +{ + if (m_aStartDragHdl.Call(this)) + return; + + rtl::Reference xContainer = m_xTransferHelper; + if (!m_xTransferHelper.is()) + return; + + xContainer->StartDrag(this, m_nDragAction); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit