LOK: custom widgets: simplify and correct colors
[LibreOffice.git] / vcl / inc / WidgetThemeLibraryTypes.hxx
blob9b069d3dc066f3df344d29cbec106ac653c2cc27
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_WIDGETTHEMETYPES_HXX
12 #define INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX
14 #include <cstdint>
15 #include <type_traits> // Used for enum operator
17 /**
18 * These types are all based on the supported variants
19 * vcl/salnativewidgets.hxx and must be kept in-sync.
20 **/
22 /* Control Types:
24 * Specify the overall, whole control
25 * type (as opposed to parts of the
26 * control if it were composite).
29 enum class ControlType {
30 // for use in general purpose ImplControlValue
31 Generic = 0,
32 // Normal PushButton/Command Button
33 Pushbutton = 1,
34 // Normal single radio button
35 Radiobutton = 2,
36 // Normal single checkbox
37 Checkbox = 10,
38 // Combobox, i.e. a ListBox
39 // that allows data entry by user
40 Combobox = 20,
41 // Control that allows text entry
42 Editbox = 30,
43 // Control that allows text entry, but without the usual border
44 // Has to be handled separately, because this one cannot handle
45 // ControlPart::HasBackgroundTexture, which is drawn in the edit box'es
46 // border window.
47 EditboxNoBorder = 31,
48 // Control that allows text entry
49 // ( some systems distinguish between single and multi line edit boxes )
50 MultilineEditbox = 32,
51 // Control that pops up a menu,
52 // but does NOT allow data entry
53 Listbox = 35,
54 // An edit field together with two little
55 // buttons on the side (aka spin field)
56 Spinbox = 40,
57 // Two standalone spin buttons
58 // without an edit field
59 SpinButtons = 45,
60 // A single tab
61 TabItem = 50,
62 // The border around a tab area,
63 // but without the tabs themselves.
64 // May have a gap at the top for
65 // the active tab
66 TabPane = 55,
67 // The background to the tab area
68 TabHeader = 56,
69 // Background of a Tab Pane
70 TabBody = 57,
71 // Normal scrollbar, including
72 // all parts like slider, buttons
73 Scrollbar = 60,
74 Slider = 65,
75 // A separator line
76 Fixedline = 80,
77 // A toolbar control with buttons and a grip
78 Toolbar = 100,
79 // The menubar
80 Menubar = 120,
81 // popup menu
82 MenuPopup = 121,
83 Progress = 131,
84 // Progress bar for the intro window
85 // (aka splash screen), in case some
86 // wants native progress bar in the
87 // application but not for the splash
88 // screen (used in desktop/)
89 IntroProgress = 132,
90 // tool tips
91 Tooltip = 140,
92 // to draw the implemented theme
93 WindowBackground = 150,
94 //to draw border of frames natively
95 Frame = 160,
96 // for nodes in listviews
97 // used in svtools/source/contnr/svtreebx.cxx
98 ListNode = 170,
99 // nets between elements of listviews
100 // with nodes
101 ListNet = 171,
102 // for list headers
103 ListHeader = 172,
107 /* Control Parts:
109 * Uniquely identify a part of a control,
110 * for example the slider of a scroll bar.
113 enum class ControlPart
115 NONE = 0,
116 Entire = 1,
117 ListboxWindow = 5, // the static listbox window containing the list
118 Button = 100,
119 ButtonUp = 101,
120 ButtonDown = 102, // Also for ComboBoxes/ListBoxes
121 ButtonLeft = 103,
122 ButtonRight = 104,
123 AllButtons = 105,
124 SeparatorHorz = 106,
125 SeparatorVert = 107,
126 TrackHorzLeft = 200,
127 TrackVertUpper = 201,
128 TrackHorzRight = 202,
129 TrackVertLower = 203,
130 TrackHorzArea = 204,
131 TrackVertArea = 205,
132 Arrow = 220,
133 ThumbHorz = 210, // Also used as toolbar grip
134 ThumbVert = 211, // Also used as toolbar grip
135 MenuItem = 250,
136 MenuItemCheckMark = 251,
137 MenuItemRadioMark = 252,
138 Separator = 253,
139 SubmenuArrow = 254,
141 /* #i77549#
142 HACK: for scrollbars in case of thumb rect, page up and page down rect we
143 abuse the HitTestNativeScrollbar interface. All theming engines but aqua
144 are actually able to draw the thumb according to our internal representation.
145 However aqua draws a little outside. The canonical way would be to enhance the
146 HitTestNativeScrollbar passing a ScrollbarValue additionally so all necessary
147 information is available in the call.
149 However since there is only this one small exception we will deviate a little and
150 instead pass the respective rect as control region to allow for a small correction.
152 So all places using HitTestNativeScrollbar on ControlPart::ThumbHorz, ControlPart::ThumbVert,
153 ControlPart::TrackHorzLeft, ControlPart::TrackHorzRight, ControlPart::TrackVertUpper, ControlPart::TrackVertLower
154 do not use the control rectangle as region but the actuall part rectangle, making
155 only small deviations feasible.
158 /** The edit field part of a control, e.g. of the combo box.
160 Currently used just for combo boxes and just for GetNativeControlRegion().
161 It is valid only if GetNativeControlRegion() supports ControlPart::ButtonDown as
162 well.
164 SubEdit = 300,
166 // For controls that require the entire background
167 // to be drawn first, and then other pieces over top.
168 // (GTK+ scrollbars for example). Control region passed
169 // in to draw this part is expected to be the entire
170 // area of the control.
171 // A control may respond to one or both.
172 DrawBackgroundHorz = 1000,
173 DrawBackgroundVert = 1001,
175 // GTK+ also draws tabs right->left since there is a
176 // hardcoded 2 pixel overlap between adjacent tabs
177 TabsDrawRtl = 3000,
179 // For themes that do not want to have the focus
180 // rectangle part drawn by VCL but take care of the
181 // whole inner control part by themselves
182 // eg, listboxes or comboboxes or spinbuttons
183 HasBackgroundTexture = 4000,
185 // For scrollbars that have 3 buttons (most KDE themes)
186 HasThreeButtons = 5000,
188 BackgroundWindow = 6000,
189 BackgroundDialog = 6001,
191 //to draw natively the border of frames
192 Border = 7000,
194 //to draw natively the focus rects
195 Focus = 8000
198 /* Control State:
200 * Specify how a particular part of the control
201 * is to be drawn. Constants are bitwise OR-ed
202 * together to compose a final drawing state.
203 * A _disabled_ state is assumed by the drawing
204 * functions until an ENABLED or HIDDEN is passed
205 * in the ControlState.
207 enum class ControlState {
208 NONE = 0,
209 ENABLED = 0x0001,
210 FOCUSED = 0x0002,
211 PRESSED = 0x0004,
212 ROLLOVER = 0x0008,
213 DEFAULT = 0x0020,
214 SELECTED = 0x0040,
215 DOUBLEBUFFERING = 0x4000, ///< Set when the control is painted using double-buffering via VirtualDevice.
216 CACHING_ALLOWED = 0x8000, ///< Set when the control is completely visible (i.e. not clipped).
219 inline bool operator& (const ControlState& lhs, const ControlState& rhs)
221 return static_cast<std::underlying_type<ControlState>::type>(lhs)
222 & static_cast<std::underlying_type<ControlState>::type>(rhs);
225 /* ButtonValue:
227 * Identifies the tri-state value options
228 * that buttons allow
231 enum class ButtonValue {
232 DontKnow,
234 Off,
235 Mixed
238 #endif
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */