1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include <vcl/customweld.hxx>
14 CustomWidgetController::~CustomWidgetController() {}
16 IMPL_LINK_NOARG(CustomWidgetController
, DragBeginHdl
, weld::DrawingArea
&, bool)
21 CustomWeld::CustomWeld(weld::Builder
& rBuilder
, const OUString
& rDrawingId
,
22 CustomWidgetController
& rWidgetController
)
23 : m_rWidgetController(rWidgetController
)
24 , m_xDrawingArea(rBuilder
.weld_drawing_area(rDrawingId
, rWidgetController
.CreateAccessible(),
25 rWidgetController
.GetUITestFactory(),
28 m_rWidgetController
.SetDrawingArea(m_xDrawingArea
.get());
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
));
46 IMPL_LINK(CustomWeld
, DoResize
, const Size
&, rSize
, void)
48 m_rWidgetController
.SetOutputSizePixel(rSize
);
49 m_rWidgetController
.Resize();
52 IMPL_LINK(CustomWeld
, DoPaint
, weld::DrawingArea::draw_args
, aPayload
, void)
54 m_rWidgetController
.Paint(aPayload
.first
, aPayload
.second
);
57 IMPL_LINK(CustomWeld
, DoMouseButtonDown
, const MouseEvent
&, rMEvt
, bool)
59 return m_rWidgetController
.MouseButtonDown(rMEvt
);
62 IMPL_LINK(CustomWeld
, DoMouseMove
, const MouseEvent
&, rMEvt
, bool)
64 return m_rWidgetController
.MouseMove(rMEvt
);
67 IMPL_LINK(CustomWeld
, DoMouseButtonUp
, const MouseEvent
&, rMEvt
, bool)
69 return m_rWidgetController
.MouseButtonUp(rMEvt
);
72 IMPL_LINK_NOARG(CustomWeld
, DoGetFocus
, weld::Widget
&, void) { m_rWidgetController
.GetFocus(); }
74 IMPL_LINK_NOARG(CustomWeld
, DoLoseFocus
, weld::Widget
&, void) { m_rWidgetController
.LoseFocus(); }
76 IMPL_LINK(CustomWeld
, DoKeyPress
, const KeyEvent
&, rKEvt
, bool)
78 return m_rWidgetController
.KeyInput(rKEvt
);
81 IMPL_LINK_NOARG(CustomWeld
, DoFocusRect
, weld::Widget
&, tools::Rectangle
)
83 return m_rWidgetController
.GetFocusRect();
86 IMPL_LINK_NOARG(CustomWeld
, DoStyleUpdated
, weld::Widget
&, void)
88 m_rWidgetController
.StyleUpdated();
91 IMPL_LINK(CustomWeld
, DoCommand
, const CommandEvent
&, rPos
, bool)
93 return m_rWidgetController
.Command(rPos
);
96 IMPL_LINK(CustomWeld
, DoRequestHelp
, tools::Rectangle
&, rHelpArea
, OUString
)
98 return m_rWidgetController
.RequestHelp(rHelpArea
);
101 IMPL_LINK(CustomWeld
, DoGetSurrounding
, OUString
&, rSurrounding
, int)
103 return m_rWidgetController
.GetSurroundingText(rSurrounding
);
106 IMPL_LINK(CustomWeld
, DoDeleteSurrounding
, const Selection
&, rSelection
, bool)
108 return m_rWidgetController
.DeleteSurroundingText(rSelection
);
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */