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/.
11 #ifndef INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
12 #define INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
14 #include <vcl/dllapi.h>
16 #include <rtl/ustring.hxx>
17 #include <tools/color.hxx>
18 #include <unordered_map>
21 #include <o3tl/hash_combine.hxx>
22 #include <vcl/salnativewidgets.hxx>
26 enum class WidgetDrawActionType
34 class VCL_DLLPUBLIC WidgetDrawAction
37 WidgetDrawAction(WidgetDrawActionType aType
)
42 WidgetDrawActionType maType
;
45 class VCL_DLLPUBLIC WidgetDrawActionShape
: public WidgetDrawAction
48 WidgetDrawActionShape(WidgetDrawActionType aType
)
49 : WidgetDrawAction(aType
)
56 sal_Int32 mnStrokeWidth
;
59 class VCL_DLLPUBLIC WidgetDrawActionRectangle
: public WidgetDrawActionShape
70 WidgetDrawActionRectangle()
71 : WidgetDrawActionShape(WidgetDrawActionType::RECTANGLE
)
82 class VCL_DLLPUBLIC WidgetDrawActionLine
: public WidgetDrawActionShape
90 WidgetDrawActionLine()
91 : WidgetDrawActionShape(WidgetDrawActionType::LINE
)
100 class VCL_DLLPUBLIC WidgetDrawActionImage
: public WidgetDrawAction
105 WidgetDrawActionImage()
106 : WidgetDrawAction(WidgetDrawActionType::IMAGE
)
111 class VCL_DLLPUBLIC WidgetDrawActionExternal
: public WidgetDrawAction
116 WidgetDrawActionExternal()
117 : WidgetDrawAction(WidgetDrawActionType::EXTERNAL
)
122 struct VCL_DLLPUBLIC ControlTypeAndPart
127 ControlTypeAndPart(ControlType eType
, ControlPart ePart
)
133 bool operator==(ControlTypeAndPart
const& aOther
) const
135 return meType
== aOther
.meType
&& mePart
== aOther
.mePart
;
139 } // end vcl namespace
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
);
154 } // end std namespace
158 class WidgetDefinitionState
167 OString msButtonValue
;
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
,
183 void addDrawImage(OUString
const& sSource
);
184 void addDrawExternal(OUString
const& sSource
);
187 class VCL_DLLPUBLIC WidgetDefinitionPart
192 sal_Int32 mnMarginWidth
;
193 sal_Int32 mnMarginHeight
;
194 OString msOrientation
;
196 std::vector
<std::shared_ptr
<WidgetDefinitionState
>> getStates(ControlType eType
,
199 ImplControlValue
const& rValue
);
201 std::vector
<std::shared_ptr
<WidgetDefinitionState
>> maStates
;
204 class VCL_DLLPUBLIC WidgetDefinitionSettings
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
221 Color maCheckedColor
;
223 Color maLightBorderColor
;
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
;
245 Color maWindowTextColor
;
247 Color maDialogTextColor
;
248 Color maWorkspaceColor
;
251 Color maFieldTextColor
;
252 Color maFieldRolloverTextColor
;
254 Color maActiveTextColor
;
255 Color maActiveBorderColor
;
256 Color maDeactiveColor
;
257 Color maDeactiveTextColor
;
258 Color maDeactiveBorderColor
;
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
;
278 Color maHelpTextColor
;
280 Color maVisitedLinkColor
;
281 Color maToolTextColor
;
285 class VCL_DLLPUBLIC WidgetDefinition
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: */