Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / vcl / source / app / customweld.cxx
blobd6465ff289f5c5982f4c5557f80d3242af39cc44
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <vcl/customweld.hxx>
12 namespace weld
14 CustomWidgetController::~CustomWidgetController() {}
16 CustomWeld::CustomWeld(weld::Builder& rBuilder, const OString& rDrawingId,
17 CustomWidgetController& rWidgetController)
18 : m_rWidgetController(rWidgetController)
19 , m_xDrawingArea(rBuilder.weld_drawing_area(rDrawingId, rWidgetController.CreateAccessible(),
20 rWidgetController.GetUITestFactory(),
21 &rWidgetController))
23 m_xDrawingArea->connect_size_allocate(LINK(this, CustomWeld, DoResize));
24 m_xDrawingArea->connect_draw(LINK(this, CustomWeld, DoPaint));
25 m_xDrawingArea->connect_mouse_press(LINK(this, CustomWeld, DoMouseButtonDown));
26 m_xDrawingArea->connect_mouse_move(LINK(this, CustomWeld, DoMouseMove));
27 m_xDrawingArea->connect_mouse_release(LINK(this, CustomWeld, DoMouseButtonUp));
28 m_xDrawingArea->connect_focus_in(LINK(this, CustomWeld, DoGetFocus));
29 m_xDrawingArea->connect_focus_out(LINK(this, CustomWeld, DoLoseFocus));
30 m_xDrawingArea->connect_key_press(LINK(this, CustomWeld, DoKeyPress));
31 m_xDrawingArea->connect_focus_rect(LINK(this, CustomWeld, DoFocusRect));
32 m_xDrawingArea->connect_style_updated(LINK(this, CustomWeld, DoStyleUpdated));
33 m_xDrawingArea->connect_command(LINK(this, CustomWeld, DoCommand));
34 m_xDrawingArea->connect_query_tooltip(LINK(this, CustomWeld, DoRequestHelp));
35 m_rWidgetController.SetDrawingArea(m_xDrawingArea.get());
38 IMPL_LINK(CustomWeld, DoResize, const Size&, rSize, void)
40 m_rWidgetController.SetOutputSizePixel(rSize);
41 m_rWidgetController.Resize();
44 IMPL_LINK(CustomWeld, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
46 m_rWidgetController.Paint(aPayload.first, aPayload.second);
49 IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, bool)
51 return m_rWidgetController.MouseButtonDown(rMEvt);
54 IMPL_LINK(CustomWeld, DoMouseMove, const MouseEvent&, rMEvt, bool)
56 return m_rWidgetController.MouseMove(rMEvt);
59 IMPL_LINK(CustomWeld, DoMouseButtonUp, const MouseEvent&, rMEvt, bool)
61 return m_rWidgetController.MouseButtonUp(rMEvt);
64 IMPL_LINK_NOARG(CustomWeld, DoGetFocus, weld::Widget&, void) { m_rWidgetController.GetFocus(); }
66 IMPL_LINK_NOARG(CustomWeld, DoLoseFocus, weld::Widget&, void) { m_rWidgetController.LoseFocus(); }
68 IMPL_LINK(CustomWeld, DoKeyPress, const KeyEvent&, rKEvt, bool)
70 return m_rWidgetController.KeyInput(rKEvt);
73 IMPL_LINK_NOARG(CustomWeld, DoFocusRect, weld::Widget&, tools::Rectangle)
75 return m_rWidgetController.GetFocusRect();
78 IMPL_LINK_NOARG(CustomWeld, DoStyleUpdated, weld::Widget&, void)
80 m_rWidgetController.StyleUpdated();
83 IMPL_LINK(CustomWeld, DoCommand, const CommandEvent&, rPos, bool)
85 return m_rWidgetController.Command(rPos);
88 IMPL_LINK(CustomWeld, DoRequestHelp, tools::Rectangle&, rHelpArea, OUString)
90 return m_rWidgetController.RequestHelp(rHelpArea);
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */