bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / widgetdraw / WidgetDefinition.hxx
blob65a4dcb32c294ea3fa31ee396deeaa0bf6dfb818
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 */
11 #ifndef INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
12 #define INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
14 #include <vcl/dllapi.h>
15 #include <memory>
16 #include <rtl/ustring.hxx>
17 #include <tools/color.hxx>
18 #include <unordered_map>
19 #include <vector>
20 #include <cstddef>
21 #include <o3tl/hash_combine.hxx>
22 #include <vcl/salnativewidgets.hxx>
24 namespace vcl
26 enum class WidgetDrawActionType
28 RECTANGLE,
29 LINE,
30 IMAGE,
31 EXTERNAL
34 class VCL_DLLPUBLIC WidgetDrawAction
36 public:
37 WidgetDrawAction(WidgetDrawActionType aType)
38 : maType(aType)
42 WidgetDrawActionType maType;
45 class VCL_DLLPUBLIC WidgetDrawActionShape : public WidgetDrawAction
47 public:
48 WidgetDrawActionShape(WidgetDrawActionType aType)
49 : WidgetDrawAction(aType)
50 , mnStrokeWidth(-1)
54 Color maStrokeColor;
55 Color maFillColor;
56 sal_Int32 mnStrokeWidth;
59 class VCL_DLLPUBLIC WidgetDrawActionRectangle : public WidgetDrawActionShape
61 public:
62 sal_Int32 mnRx;
63 sal_Int32 mnRy;
65 float mfX1;
66 float mfY1;
67 float mfX2;
68 float mfY2;
70 WidgetDrawActionRectangle()
71 : WidgetDrawActionShape(WidgetDrawActionType::RECTANGLE)
72 , mnRx(0)
73 , mnRy(0)
74 , mfX1(0.0f)
75 , mfY1(0.0f)
76 , mfX2(1.0f)
77 , mfY2(1.0f)
82 class VCL_DLLPUBLIC WidgetDrawActionLine : public WidgetDrawActionShape
84 public:
85 float mfX1;
86 float mfY1;
87 float mfX2;
88 float mfY2;
90 WidgetDrawActionLine()
91 : WidgetDrawActionShape(WidgetDrawActionType::LINE)
92 , mfX1(0.0)
93 , mfY1(0.0)
94 , mfX2(0.0)
95 , mfY2(0.0)
100 class VCL_DLLPUBLIC WidgetDrawActionImage : public WidgetDrawAction
102 public:
103 OUString msSource;
105 WidgetDrawActionImage()
106 : WidgetDrawAction(WidgetDrawActionType::IMAGE)
111 class VCL_DLLPUBLIC WidgetDrawActionExternal : public WidgetDrawAction
113 public:
114 OUString msSource;
116 WidgetDrawActionExternal()
117 : WidgetDrawAction(WidgetDrawActionType::EXTERNAL)
122 struct VCL_DLLPUBLIC ControlTypeAndPart
124 ControlType meType;
125 ControlPart mePart;
127 ControlTypeAndPart(ControlType eType, ControlPart ePart)
128 : meType(eType)
129 , mePart(ePart)
133 bool operator==(ControlTypeAndPart const& aOther) const
135 return meType == aOther.meType && mePart == aOther.mePart;
139 } // end vcl namespace
141 namespace std
143 template <> struct VCL_DLLPUBLIC hash<vcl::ControlTypeAndPart>
145 std::size_t operator()(vcl::ControlTypeAndPart const& rControlTypeAndPart) const noexcept
147 std::size_t seed = 0;
148 o3tl::hash_combine(seed, rControlTypeAndPart.meType);
149 o3tl::hash_combine(seed, rControlTypeAndPart.mePart);
150 return seed;
154 } // end std namespace
156 namespace vcl
158 class WidgetDefinitionState
160 public:
161 OString msEnabled;
162 OString msFocused;
163 OString msPressed;
164 OString msRollover;
165 OString msDefault;
166 OString msSelected;
167 OString msButtonValue;
168 OString msExtra;
170 WidgetDefinitionState(OString const& sEnabled, OString const& sFocused, OString const& sPressed,
171 OString const& sRollover, OString const& sDefault,
172 OString const& sSelected, OString const& sButtonValue,
173 OString const& sExtra);
175 std::vector<std::shared_ptr<WidgetDrawAction>> mpWidgetDrawActions;
177 void addDrawRectangle(Color aStrokeColor, sal_Int32 nStrokeWidth, Color aFillColor, float fX1,
178 float fY1, float fX2, float fY2, sal_Int32 nRx, sal_Int32 nRy);
180 void addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2,
181 float fY2);
183 void addDrawImage(OUString const& sSource);
184 void addDrawExternal(OUString const& sSource);
187 class VCL_DLLPUBLIC WidgetDefinitionPart
189 public:
190 sal_Int32 mnWidth;
191 sal_Int32 mnHeight;
192 sal_Int32 mnMarginWidth;
193 sal_Int32 mnMarginHeight;
194 OString msOrientation;
196 std::vector<std::shared_ptr<WidgetDefinitionState>> getStates(ControlType eType,
197 ControlPart ePart,
198 ControlState eState,
199 ImplControlValue const& rValue);
201 std::vector<std::shared_ptr<WidgetDefinitionState>> maStates;
204 class VCL_DLLPUBLIC WidgetDefinitionSettings
206 public:
207 OString msNoActiveTabTextRaise;
208 OString msCenteredTabs;
209 OString msListBoxEntryMargin;
210 OString msDefaultFontSize;
211 OString msTitleHeight;
212 OString msFloatTitleHeight;
213 OString msListBoxPreviewDefaultLogicWidth;
214 OString msListBoxPreviewDefaultLogicHeight;
217 class VCL_DLLPUBLIC WidgetDefinitionStyle
219 public:
220 Color maFaceColor;
221 Color maCheckedColor;
222 Color maLightColor;
223 Color maLightBorderColor;
224 Color maShadowColor;
225 Color maDarkShadowColor;
226 Color maDefaultButtonTextColor;
227 Color maButtonTextColor;
228 Color maDefaultActionButtonTextColor;
229 Color maActionButtonTextColor;
230 Color maFlatButtonTextColor;
231 Color maDefaultButtonRolloverTextColor;
232 Color maButtonRolloverTextColor;
233 Color maDefaultActionButtonRolloverTextColor;
234 Color maActionButtonRolloverTextColor;
235 Color maFlatButtonRolloverTextColor;
236 Color maDefaultButtonPressedRolloverTextColor;
237 Color maButtonPressedRolloverTextColor;
238 Color maDefaultActionButtonPressedRolloverTextColor;
239 Color maActionButtonPressedRolloverTextColor;
240 Color maFlatButtonPressedRolloverTextColor;
241 Color maRadioCheckTextColor;
242 Color maGroupTextColor;
243 Color maLabelTextColor;
244 Color maWindowColor;
245 Color maWindowTextColor;
246 Color maDialogColor;
247 Color maDialogTextColor;
248 Color maWorkspaceColor;
249 Color maMonoColor;
250 Color maFieldColor;
251 Color maFieldTextColor;
252 Color maFieldRolloverTextColor;
253 Color maActiveColor;
254 Color maActiveTextColor;
255 Color maActiveBorderColor;
256 Color maDeactiveColor;
257 Color maDeactiveTextColor;
258 Color maDeactiveBorderColor;
259 Color maMenuColor;
260 Color maMenuBarColor;
261 Color maMenuBarRolloverColor;
262 Color maMenuBorderColor;
263 Color maMenuTextColor;
264 Color maMenuBarTextColor;
265 Color maMenuBarRolloverTextColor;
266 Color maMenuBarHighlightTextColor;
267 Color maMenuHighlightColor;
268 Color maMenuHighlightTextColor;
269 Color maHighlightColor;
270 Color maHighlightTextColor;
271 Color maActiveTabColor;
272 Color maInactiveTabColor;
273 Color maTabTextColor;
274 Color maTabRolloverTextColor;
275 Color maTabHighlightTextColor;
276 Color maDisableColor;
277 Color maHelpColor;
278 Color maHelpTextColor;
279 Color maLinkColor;
280 Color maVisitedLinkColor;
281 Color maToolTextColor;
282 Color maFontColor;
285 class VCL_DLLPUBLIC WidgetDefinition
287 public:
288 std::shared_ptr<WidgetDefinitionStyle> mpStyle;
289 std::shared_ptr<WidgetDefinitionSettings> mpSettings;
290 std::unordered_map<ControlTypeAndPart, std::shared_ptr<WidgetDefinitionPart>> maDefinitions;
291 std::shared_ptr<WidgetDefinitionPart> getDefinition(ControlType eType, ControlPart ePart);
294 } // end vcl namespace
296 #endif // INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
298 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */