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 {
29  m_xDrawingArea->connect_size_allocate(LINK(this, CustomWeld, DoResize));
30  m_xDrawingArea->connect_draw(LINK(this, CustomWeld, DoPaint));
31  m_xDrawingArea->connect_mouse_press(LINK(this, CustomWeld, DoMouseButtonDown));
32  m_xDrawingArea->connect_mouse_move(LINK(this, CustomWeld, DoMouseMove));
33  m_xDrawingArea->connect_mouse_release(LINK(this, CustomWeld, DoMouseButtonUp));
34  m_xDrawingArea->connect_focus_in(LINK(this, CustomWeld, DoGetFocus));
35  m_xDrawingArea->connect_focus_out(LINK(this, CustomWeld, DoLoseFocus));
36  m_xDrawingArea->connect_key_press(LINK(this, CustomWeld, DoKeyPress));
37  m_xDrawingArea->connect_focus_rect(LINK(this, CustomWeld, DoFocusRect));
38  m_xDrawingArea->connect_style_updated(LINK(this, CustomWeld, DoStyleUpdated));
39  m_xDrawingArea->connect_command(LINK(this, CustomWeld, DoCommand));
40  m_xDrawingArea->connect_query_tooltip(LINK(this, CustomWeld, DoRequestHelp));
41  m_xDrawingArea->connect_im_context_get_surrounding(LINK(this, CustomWeld, DoGetSurrounding));
42  m_xDrawingArea->connect_im_context_delete_surrounding(
43  LINK(this, CustomWeld, DoDeleteSurrounding));
44 }
45 
46 IMPL_LINK(CustomWeld, DoResize, const Size&, rSize, void)
47 {
48  m_rWidgetController.SetOutputSizePixel(rSize);
49  m_rWidgetController.Resize();
50 }
51 
53 {
54  m_rWidgetController.Paint(aPayload.first, aPayload.second);
55 }
56 
57 IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, bool)
58 {
59  return m_rWidgetController.MouseButtonDown(rMEvt);
60 }
61 
62 IMPL_LINK(CustomWeld, DoMouseMove, const MouseEvent&, rMEvt, bool)
63 {
64  return m_rWidgetController.MouseMove(rMEvt);
65 }
66 
67 IMPL_LINK(CustomWeld, DoMouseButtonUp, const MouseEvent&, rMEvt, bool)
68 {
69  return m_rWidgetController.MouseButtonUp(rMEvt);
70 }
71 
72 IMPL_LINK_NOARG(CustomWeld, DoGetFocus, weld::Widget&, void) { m_rWidgetController.GetFocus(); }
73 
74 IMPL_LINK_NOARG(CustomWeld, DoLoseFocus, weld::Widget&, void) { m_rWidgetController.LoseFocus(); }
75 
76 IMPL_LINK(CustomWeld, DoKeyPress, const KeyEvent&, rKEvt, bool)
77 {
78  return m_rWidgetController.KeyInput(rKEvt);
79 }
80 
82 {
83  return m_rWidgetController.GetFocusRect();
84 }
85 
86 IMPL_LINK_NOARG(CustomWeld, DoStyleUpdated, weld::Widget&, void)
87 {
88  m_rWidgetController.StyleUpdated();
89 }
90 
91 IMPL_LINK(CustomWeld, DoCommand, const CommandEvent&, rPos, bool)
92 {
93  return m_rWidgetController.Command(rPos);
94 }
95 
96 IMPL_LINK(CustomWeld, DoRequestHelp, tools::Rectangle&, rHelpArea, OUString)
97 {
98  return m_rWidgetController.RequestHelp(rHelpArea);
99 }
100 
101 IMPL_LINK(CustomWeld, DoGetSurrounding, OUString&, rSurrounding, int)
102 {
103  return m_rWidgetController.GetSurroundingText(rSurrounding);
104 }
105 
106 IMPL_LINK(CustomWeld, DoDeleteSurrounding, const Selection&, rSelection, bool)
107 {
108  return m_rWidgetController.DeleteSurroundingText(rSelection);
109 }
110 }
111 
112 /* 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:148
std::pair< vcl::RenderContext &, const tools::Rectangle & > draw_args
Definition: weld.hxx:2140
IMPL_LINK(CustomWeld, DoResize, const Size &, rSize, void)
Definition: customweld.cxx:46
IMPL_LINK_NOARG(HexColorControl, OnAsyncModifyHdl, void *, void)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
Definition: customweld.hxx:48
weld::CustomWidgetController & m_rWidgetController
Definition: customweld.hxx:147