summaryrefslogtreecommitdiffstats
path: root/vcl/inc/WidgetDrawInterface.hxx
blob: 78d5d7625491f1680a36d4c81bf26684bc188274 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* -*- 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/.
 *
 */

#ifndef INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX
#define INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX

#include <vcl/dllapi.h>
#include <vcl/salnativewidgets.hxx>
#include <vcl/settings.hxx>

namespace vcl
{
class VCL_PLUGIN_PUBLIC WidgetDrawInterface
{
public:
    virtual ~WidgetDrawInterface() COVERITY_NOEXCEPT_FALSE {}

    /**
     * Query the platform layer for native control support.
     *
     * @param [in] eType The widget type.
     * @param [in] ePart The part of the widget.
     * @return true if the platform supports native drawing of the widget type defined by part.
     */
    virtual inline bool isNativeControlSupported(ControlType eType, ControlPart ePart);

    /**
     * Query if a position is inside the native widget part.
     *
     * Mainly used for scrollbars.
     *
     * @param [in] eType The widget type.
     * @param [in] ePart The part of the widget.
     * @param [in] rBoundingControlRegion The bounding Rectangle of
                   the complete control in VCL frame coordinates.
     * @param [in] aPos The position to check the hit.
     * @param [out] rIsInside true, if \a aPos was inside the native widget.
     * @return true, if the query was successful.
     */
    virtual inline bool hitTestNativeControl(ControlType eType, ControlPart ePart,
                                             const tools::Rectangle& rBoundingControlRegion,
                                             const Point& aPos, bool& rIsInside);

    /**
     * Draw the requested control.
     *
     * @param [in] eType The widget type.
     * @param [in] ePart The part of the widget.
     * @param [in] rBoundingControlRegion The bounding rectangle of
     *             the complete control in VCL frame coordinates.
     * @param [in] eState The general state of the control (enabled, focused, etc.).
     * @param [in] aValue Addition control specific information.
     * @param [in] aCaption  A caption or title string (like button text etc.).
     * @param [in] rBackgroundColor Background color for the control (may be COL_AUTO)
     * @return true, if the control could be drawn.
     */
    virtual inline bool drawNativeControl(ControlType eType, ControlPart ePart,
                                          const tools::Rectangle& rBoundingControlRegion,
                                          ControlState eState, const ImplControlValue& aValue,
                                          const OUString& aCaptions, const Color& rBackgroundColor);

    /**
     * Get the native control regions for the control part.
     *
     * If the return value is true, \a rNativeBoundingRegion contains
     * the true bounding region covered by the control including any
     * adornment, while \a rNativeContentRegion contains the area
     * within the control that can be safely drawn into without drawing over
     * the borders of the control.
     *
     * @param [in] eType Type of the widget.
     * @param [in] ePart Specification of the widget's part if it consists of more than one.
     * @param [in] rBoundingControlRegion The bounding region of the control in VCL frame coordinates.
     * @param [in] eState The general state of the control (enabled, focused, etc.).
     * @param [in] aValue Addition control specific information.
     * @param [in] aCaption A caption or title string (like button text etc.).
     * @param [out] rNativeBoundingRegion The region covered by the control including any adornment.
     * @param [out] rNativeContentRegion The region within the control that can be safely drawn into.
     * @return true, if the regions are filled.
     */
    virtual inline bool getNativeControlRegion(ControlType eType, ControlPart ePart,
                                               const tools::Rectangle& rBoundingControlRegion,
                                               ControlState eState, const ImplControlValue& aValue,
                                               const OUString& aCaption,
                                               tools::Rectangle& rNativeBoundingRegion,
                                               tools::Rectangle& rNativeContentRegion);

    virtual inline bool updateSettings(AllSettings& rSettings);
};

bool WidgetDrawInterface::isNativeControlSupported(ControlType, ControlPart) { return false; }

bool WidgetDrawInterface::hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&,
                                               const Point&, bool&)
{
    return false;
}

bool WidgetDrawInterface::drawNativeControl(ControlType, ControlPart, const tools::Rectangle&,
                                            ControlState, const ImplControlValue&, const OUString&,
                                            const Color& /*rBackgroundColor*/)
{
    return false;
}

bool WidgetDrawInterface::getNativeControlRegion(ControlType, ControlPart, const tools::Rectangle&,
                                                 ControlState, const ImplControlValue&,
                                                 const OUString&, tools::Rectangle&,
                                                 tools::Rectangle&)
{
    return false;
}

bool WidgetDrawInterface::updateSettings(AllSettings&) { return false; }
}

#endif

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