LibreOffice Module vcl (master)  1
customweld.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #include <vcl/customweld.hxx>
11 
12 namespace weld
13 {
15 
17 {
18  return StartDrag();
19 }
20 
21 CustomWeld::CustomWeld(weld::Builder& rBuilder, const OString& rDrawingId,
22  CustomWidgetController& rWidgetController)
23  : m_rWidgetController(rWidgetController)
24  , m_xDrawingArea(rBuilder.weld_drawing_area(rDrawingId, rWidgetController.CreateAccessible(),
25  rWidgetController.GetUITestFactory(),
26  &rWidgetController))
27 {
28  m_xDrawingArea->connect_size_allocate(LINK(this, CustomWeld, DoResize));
29  m_xDrawingArea->connect_draw(LINK(this, CustomWeld, DoPaint));
30  m_xDrawingArea->connect_mouse_press(LINK(this, CustomWeld, DoMouseButtonDown));
31  m_xDrawingArea->connect_mouse_move(LINK(this, CustomWeld, DoMouseMove));
32  m_xDrawingArea->connect_mouse_release(LINK(this, CustomWeld, DoMouseButtonUp));
33  m_xDrawingArea->connect_focus_in(LINK(this, CustomWeld, DoGetFocus));
34  m_xDrawingArea->connect_focus_out(LINK(this, CustomWeld, DoLoseFocus));
35  m_xDrawingArea->connect_key_press(LINK(this, CustomWeld, DoKeyPress));
36  m_xDrawingArea->connect_focus_rect(LINK(this, CustomWeld, DoFocusRect));
37  m_xDrawingArea->connect_style_updated(LINK(this, CustomWeld, DoStyleUpdated));
38  m_xDrawingArea->connect_command(LINK(this, CustomWeld, DoCommand));
39  m_xDrawingArea->connect_query_tooltip(LINK(this, CustomWeld, DoRequestHelp));
41 }
42 
43 IMPL_LINK(CustomWeld, DoResize, const Size&, rSize, void)
44 {
45  m_rWidgetController.SetOutputSizePixel(rSize);
46  m_rWidgetController.Resize();
47 }
48 
50 {
51  m_rWidgetController.Paint(aPayload.first, aPayload.second);
52 }
53 
54 IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, bool)
55 {
56  return m_rWidgetController.MouseButtonDown(rMEvt);
57 }
58 
59 IMPL_LINK(CustomWeld, DoMouseMove, const MouseEvent&, rMEvt, bool)
60 {
61  return m_rWidgetController.MouseMove(rMEvt);
62 }
63 
64 IMPL_LINK(CustomWeld, DoMouseButtonUp, const MouseEvent&, rMEvt, bool)
65 {
66  return m_rWidgetController.MouseButtonUp(rMEvt);
67 }
68 
69 IMPL_LINK_NOARG(CustomWeld, DoGetFocus, weld::Widget&, void) { m_rWidgetController.GetFocus(); }
70 
71 IMPL_LINK_NOARG(CustomWeld, DoLoseFocus, weld::Widget&, void) { m_rWidgetController.LoseFocus(); }
72 
73 IMPL_LINK(CustomWeld, DoKeyPress, const KeyEvent&, rKEvt, bool)
74 {
75  return m_rWidgetController.KeyInput(rKEvt);
76 }
77 
79 {
80  return m_rWidgetController.GetFocusRect();
81 }
82 
83 IMPL_LINK_NOARG(CustomWeld, DoStyleUpdated, weld::Widget&, void)
84 {
85  m_rWidgetController.StyleUpdated();
86 }
87 
88 IMPL_LINK(CustomWeld, DoCommand, const CommandEvent&, rPos, bool)
89 {
90  return m_rWidgetController.Command(rPos);
91 }
92 
93 IMPL_LINK(CustomWeld, DoRequestHelp, tools::Rectangle&, rHelpArea, OUString)
94 {
95  return m_rWidgetController.RequestHelp(rHelpArea);
96 }
97 }
98 
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CustomWeld(weld::Builder &rBuilder, const OString &rDrawingId, CustomWidgetController &rWidgetController)
Definition: customweld.cxx:21
std::unique_ptr< weld::DrawingArea > m_xDrawingArea
Definition: customweld.hxx:107
std::pair< vcl::RenderContext &, const tools::Rectangle & > draw_args
Definition: weld.hxx:2005
IMPL_LINK(CustomWeld, DoResize, const Size &, rSize, void)
Definition: customweld.cxx:43
IMPL_LINK_NOARG(HexColorControl, OnAsyncModifyHdl, void *, void)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
Definition: customweld.hxx:45
weld::CustomWidgetController & m_rWidgetController
Definition: customweld.hxx:106