summaryrefslogtreecommitdiffstats
path: root/vcl/source/app/customweld.cxx
blob: 14fbef0774541976aca0c5a199ed3c84a0101fd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <vcl/customweld.hxx>

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)
    , m_xDrawingArea(rBuilder.weld_drawing_area(rDrawingId, rWidgetController.CreateAccessible(),
                                                rWidgetController.GetUITestFactory(),
                                                &rWidgetController))
{
    m_rWidgetController.SetDrawingArea(m_xDrawingArea.get());
    m_xDrawingArea->connect_size_allocate(LINK(this, CustomWeld, DoResize));
    m_xDrawingArea->connect_draw(LINK(this, CustomWeld, DoPaint));
    m_xDrawingArea->connect_mouse_press(LINK(this, CustomWeld, DoMouseButtonDown));
    m_xDrawingArea->connect_mouse_move(LINK(this, CustomWeld, DoMouseMove));
    m_xDrawingArea->connect_mouse_release(LINK(this, CustomWeld, DoMouseButtonUp));
    m_xDrawingArea->connect_focus_in(LINK(this, CustomWeld, DoGetFocus));
    m_xDrawingArea->connect_focus_out(LINK(this, CustomWeld, DoLoseFocus));
    m_xDrawingArea->connect_key_press(LINK(this, CustomWeld, DoKeyPress));
    m_xDrawingArea->connect_focus_rect(LINK(this, CustomWeld, DoFocusRect));
    m_xDrawingArea->connect_style_updated(LINK(this, CustomWeld, DoStyleUpdated));
    m_xDrawingArea->connect_command(LINK(this, CustomWeld, DoCommand));
    m_xDrawingArea->connect_query_tooltip(LINK(this, CustomWeld, DoRequestHelp));
    m_xDrawingArea->connect_im_context_get_surrounding(LINK(this, CustomWeld, DoGetSurrounding));
    m_xDrawingArea->connect_im_context_delete_surrounding(
        LINK(this, CustomWeld, DoDeleteSurrounding));
}

IMPL_LINK(CustomWeld, DoResize, const Size&, rSize, void)
{
    m_rWidgetController.SetOutputSizePixel(rSize);
    m_rWidgetController.Resize();
}

IMPL_LINK(CustomWeld, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
    m_rWidgetController.Paint(aPayload.first, aPayload.second);
}

IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, bool)
{
    return m_rWidgetController.MouseButtonDown(rMEvt);
}

IMPL_LINK(CustomWeld, DoMouseMove, const MouseEvent&, rMEvt, bool)
{
    return m_rWidgetController.MouseMove(rMEvt);
}

IMPL_LINK(CustomWeld, DoMouseButtonUp, const MouseEvent&, rMEvt, bool)
{
    return m_rWidgetController.MouseButtonUp(rMEvt);
}

IMPL_LINK_NOARG(CustomWeld, DoGetFocus, weld::Widget&, void) { m_rWidgetController.GetFocus(); }

IMPL_LINK_NOARG(CustomWeld, DoLoseFocus, weld::Widget&, void) { m_rWidgetController.LoseFocus(); }

IMPL_LINK(CustomWeld, DoKeyPress, const KeyEvent&, rKEvt, bool)
{
    return m_rWidgetController.KeyInput(rKEvt);
}

IMPL_LINK_NOARG(CustomWeld, DoFocusRect, weld::Widget&, tools::Rectangle)
{
    return m_rWidgetController.GetFocusRect();
}

IMPL_LINK_NOARG(CustomWeld, DoStyleUpdated, weld::Widget&, void)
{
    m_rWidgetController.StyleUpdated();
}

IMPL_LINK(CustomWeld, DoCommand, const CommandEvent&, rPos, bool)
{
    return m_rWidgetController.Command(rPos);
}

IMPL_LINK(CustomWeld, DoRequestHelp, tools::Rectangle&, rHelpArea, OUString)
{
    return m_rWidgetController.RequestHelp(rHelpArea);
}

IMPL_LINK(CustomWeld, DoGetSurrounding, OUString&, rSurrounding, int)
{
    return m_rWidgetController.GetSurroundingText(rSurrounding);
}

IMPL_LINK(CustomWeld, DoDeleteSurrounding, const Selection&, rSelection, bool)
{
    return m_rWidgetController.DeleteSurroundingText(rSelection);
}
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */