2 * Copyright 2009-2017, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _CONTROL_LOOK_H
6 #define _CONTROL_LOOK_H
17 class BGradientLinear
;
21 // WARNING! This is experimental API and may change! Be prepared to
22 // recompile your software in a next version of haiku.
31 virtual ~BControlLook();
33 // TODO: Probably more convenient to pull these enums into global
34 // namespace and rename them to e.g. "B_CONTROL_LOOK_FOCUSED" instead of
35 // "BControlLook::B_FOCUSED".
45 enum background_type
{
47 B_BUTTON_WITH_POP_UP_BACKGROUND
,
49 B_MENU_BAR_BACKGROUND
,
50 B_MENU_FIELD_BACKGROUND
,
51 B_MENU_ITEM_BACKGROUND
,
52 B_HORIZONTAL_SCROLL_BAR_BACKGROUND
,
53 B_VERTICAL_SCROLL_BAR_BACKGROUND
,
57 B_LEFT_BORDER
= 1 << 0,
58 B_RIGHT_BORDER
= 1 << 1,
59 B_TOP_BORDER
= 1 << 2,
60 B_BOTTOM_BORDER
= 1 << 3,
62 B_ALL_BORDERS
= B_LEFT_BORDER
| B_RIGHT_BORDER
63 | B_TOP_BORDER
| B_BOTTOM_BORDER
73 B_RIGHT_DOWN_ARROW
= 6,
79 B_CLICKED
= 1 << 1, // some controls activate on mouse up
83 B_DEFAULT_BUTTON
= 1 << 5,
84 B_IGNORE_OUTLINE
= 1 << 6,
85 B_PARTIALLY_ACTIVATED
= 1 << 7, // like B_ACTIVATED, but for tri-state
86 B_FLAT
= 1 << 8, // flat look (e.g. button background)
87 B_INVALID
= 1 << 9, // invalid value, use B_FAILURE_COLOR
88 B_IS_CONTROL
= 1 << 10, // use control colors
90 B_BLEND_FRAME
= 1 << 16,
93 virtual BAlignment
DefaultLabelAlignment() const = 0;
94 virtual float DefaultLabelSpacing() const = 0;
96 virtual float DefaultItemSpacing() const = 0;
98 static float ComposeSpacing(float spacing
);
100 virtual uint32
Flags(BControl
* control
) const = 0;
102 virtual void DrawButtonFrame(BView
* view
, BRect
& rect
,
103 const BRect
& updateRect
,
104 const rgb_color
& base
,
105 const rgb_color
& background
,
107 uint32 borders
= B_ALL_BORDERS
) = 0;
108 virtual void DrawButtonFrame(BView
* view
, BRect
& rect
,
109 const BRect
& updateRect
,
111 const rgb_color
& base
,
112 const rgb_color
& background
,
114 uint32 borders
= B_ALL_BORDERS
) = 0;
115 virtual void DrawButtonFrame(BView
* view
, BRect
& rect
,
116 const BRect
& updateRect
,
118 float rightTopRadius
,
119 float leftBottomRadius
,
120 float rightBottomRadius
,
121 const rgb_color
& base
,
122 const rgb_color
& background
,
124 uint32 borders
= B_ALL_BORDERS
) = 0;
126 virtual void DrawButtonBackground(BView
* view
, BRect
& rect
,
127 const BRect
& updateRect
,
128 const rgb_color
& base
,
130 uint32 borders
= B_ALL_BORDERS
,
131 orientation orientation
= B_HORIZONTAL
) = 0;
132 virtual void DrawButtonBackground(BView
* view
, BRect
& rect
,
133 const BRect
& updateRect
,
135 const rgb_color
& base
,
137 uint32 borders
= B_ALL_BORDERS
,
138 orientation orientation
= B_HORIZONTAL
) = 0;
139 virtual void DrawButtonBackground(BView
* view
, BRect
& rect
,
140 const BRect
& updateRect
,
142 float rightTopRadius
,
143 float leftBottomRadius
,
144 float rightBottomRadius
,
145 const rgb_color
& base
,
147 uint32 borders
= B_ALL_BORDERS
,
148 orientation orientation
= B_HORIZONTAL
) = 0;
150 virtual void DrawMenuBarBackground(BView
* view
, BRect
& rect
,
151 const BRect
& updateRect
,
152 const rgb_color
& base
,
154 uint32 borders
= B_ALL_BORDERS
) = 0;
156 virtual void DrawMenuFieldFrame(BView
* view
, BRect
& rect
,
157 const BRect
& updateRect
,
158 const rgb_color
& base
,
159 const rgb_color
& background
,
161 uint32 borders
= B_ALL_BORDERS
) = 0;
162 virtual void DrawMenuFieldFrame(BView
* view
, BRect
& rect
,
163 const BRect
& updateRect
,
165 const rgb_color
& base
,
166 const rgb_color
& background
,
168 uint32 borders
= B_ALL_BORDERS
) = 0;
169 virtual void DrawMenuFieldFrame(BView
* view
, BRect
& rect
,
170 const BRect
& updateRect
,
172 float rightTopRadius
,
173 float leftBottomRadius
,
174 float rightBottomRadius
,
175 const rgb_color
& base
,
176 const rgb_color
& background
,
178 uint32 borders
= B_ALL_BORDERS
) = 0;
180 virtual void DrawMenuFieldBackground(BView
* view
,
181 BRect
& rect
, const BRect
& updateRect
,
182 const rgb_color
& base
, bool popupIndicator
,
183 uint32 flags
= 0) = 0;
184 virtual void DrawMenuFieldBackground(BView
* view
,
185 BRect
& rect
, const BRect
& updateRect
,
186 float radius
, const rgb_color
& base
,
187 bool popupIndicator
, uint32 flags
= 0) = 0;
188 virtual void DrawMenuFieldBackground(BView
* view
,
189 BRect
& rect
, const BRect
& updateRect
,
191 float rightTopRadius
,
192 float leftBottomRadius
,
193 float rightBottomRadius
,
194 const rgb_color
& base
,
195 bool popupIndicator
, uint32 flags
= 0) = 0;
196 virtual void DrawMenuFieldBackground(BView
* view
,
197 BRect
& rect
, const BRect
& updateRect
,
198 const rgb_color
& base
, uint32 flags
= 0,
199 uint32 borders
= B_ALL_BORDERS
) = 0;
201 virtual void DrawMenuBackground(BView
* view
,
202 BRect
& rect
, const BRect
& updateRect
,
203 const rgb_color
& base
, uint32 flags
= 0,
204 uint32 borders
= B_ALL_BORDERS
) = 0;
206 virtual void DrawMenuItemBackground(BView
* view
,
207 BRect
& rect
, const BRect
& updateRect
,
208 const rgb_color
& base
, uint32 flags
= 0,
209 uint32 borders
= B_ALL_BORDERS
) = 0;
211 virtual void DrawStatusBar(BView
* view
, BRect
& rect
,
212 const BRect
& updateRect
,
213 const rgb_color
& base
,
214 const rgb_color
& barColor
,
215 float progressPosition
) = 0;
217 virtual void DrawCheckBox(BView
* view
, BRect
& rect
,
218 const BRect
& updateRect
,
219 const rgb_color
& base
,
220 uint32 flags
= 0) = 0;
222 virtual void DrawRadioButton(BView
* view
, BRect
& rect
,
223 const BRect
& updateRect
,
224 const rgb_color
& base
,
225 uint32 flags
= 0) = 0;
227 virtual void DrawScrollBarBackground(BView
* view
,
228 BRect
& rect1
, BRect
& rect2
,
229 const BRect
& updateRect
,
230 const rgb_color
& base
, uint32 flags
,
231 orientation orientation
) = 0;
232 virtual void DrawScrollBarBackground(BView
* view
,
233 BRect
& rect
, const BRect
& updateRect
,
234 const rgb_color
& base
, uint32 flags
,
235 orientation orientation
) = 0;
237 virtual void DrawScrollViewFrame(BView
* view
,
238 BRect
& rect
, const BRect
& updateRect
,
239 BRect verticalScrollBarFrame
,
240 BRect horizontalScrollBarFrame
,
241 const rgb_color
& base
,
242 border_style borderStyle
,
244 uint32 borders
= B_ALL_BORDERS
) = 0;
246 virtual void DrawArrowShape(BView
* view
,
247 BRect
& rect
, const BRect
& updateRect
,
248 const rgb_color
& base
, uint32 direction
,
250 float tint
= B_DARKEN_MAX_TINT
) = 0;
252 virtual rgb_color
SliderBarColor(const rgb_color
& base
) = 0;
254 virtual void DrawSliderBar(BView
* view
, BRect rect
,
255 const BRect
& updateRect
,
256 const rgb_color
& base
,
257 rgb_color leftFillColor
,
258 rgb_color rightFillColor
,
259 float sliderScale
, uint32 flags
,
260 orientation orientation
) = 0;
261 virtual void DrawSliderBar(BView
* view
, BRect rect
,
262 const BRect
& updateRect
,
263 const rgb_color
& base
, rgb_color fillColor
,
264 uint32 flags
, orientation orientation
) = 0;
266 virtual void DrawSliderThumb(BView
* view
, BRect
& rect
,
267 const BRect
& updateRect
,
268 const rgb_color
& base
, uint32 flags
,
269 orientation orientation
) = 0;
271 virtual void DrawSliderTriangle(BView
* view
, BRect
& rect
,
272 const BRect
& updateRect
,
273 const rgb_color
& base
, uint32 flags
,
274 orientation orientation
) = 0;
275 virtual void DrawSliderTriangle(BView
* view
, BRect
& rect
,
276 const BRect
& updateRect
,
277 const rgb_color
& base
,
278 const rgb_color
& fill
, uint32 flags
,
279 orientation orientation
) = 0;
281 virtual void DrawSliderHashMarks(BView
* view
, BRect
& rect
,
282 const BRect
& updateRect
,
283 const rgb_color
& base
, int32 count
,
284 hash_mark_location location
,
285 uint32 flags
, orientation orientation
) = 0;
287 virtual void DrawActiveTab(BView
* view
, BRect
& rect
,
288 const BRect
& updateRect
,
289 const rgb_color
& base
, uint32 flags
= 0,
290 uint32 borders
= B_ALL_BORDERS
,
291 uint32 side
= B_TOP_BORDER
) = 0;
293 virtual void DrawInactiveTab(BView
* view
, BRect
& rect
,
294 const BRect
& updateRect
,
295 const rgb_color
& base
, uint32 flags
= 0,
296 uint32 borders
= B_ALL_BORDERS
,
297 uint32 side
= B_TOP_BORDER
) = 0;
299 virtual void DrawSplitter(BView
* view
, BRect
& rect
,
300 const BRect
& updateRect
,
301 const rgb_color
& base
,
302 orientation orientation
,
304 uint32 borders
= B_ALL_BORDERS
) = 0;
308 virtual void DrawBorder(BView
* view
, BRect
& rect
,
309 const BRect
& updateRect
,
310 const rgb_color
& base
,
311 border_style borderStyle
, uint32 flags
= 0,
312 uint32 borders
= B_ALL_BORDERS
) = 0;
314 virtual void DrawRaisedBorder(BView
* view
, BRect
& rect
,
315 const BRect
& updateRect
,
316 const rgb_color
& base
, uint32 flags
= 0,
317 uint32 borders
= B_ALL_BORDERS
) = 0;
319 virtual void DrawGroupFrame(BView
* view
, BRect
& rect
,
320 const BRect
& updateRect
,
321 const rgb_color
& base
,
322 uint32 borders
= B_ALL_BORDERS
) = 0;
324 virtual void DrawTextControlBorder(BView
* view
, BRect
& rect
,
325 const BRect
& updateRect
,
326 const rgb_color
& base
, uint32 flags
= 0,
327 uint32 borders
= B_ALL_BORDERS
) = 0;
331 virtual void DrawLabel(BView
* view
, const char* label
,
332 BRect rect
, const BRect
& updateRect
,
333 const rgb_color
& base
, uint32 flags
,
334 const rgb_color
* textColor
= NULL
) = 0;
335 virtual void DrawLabel(BView
* view
, const char* label
,
336 BRect rect
, const BRect
& updateRect
,
337 const rgb_color
& base
, uint32 flags
,
338 const BAlignment
& alignment
,
339 const rgb_color
* textColor
= NULL
) = 0;
340 // TODO: Would be nice to have a (non-virtual) version of this method
341 // which takes an array of labels and locations. That would save some
342 // setup with the view graphics state.
343 virtual void DrawLabel(BView
* view
, const char* label
,
344 const rgb_color
& base
, uint32 flags
,
346 const rgb_color
* textColor
= NULL
) = 0;
348 void DrawLabel(BView
* view
, const char* label
,
349 const BBitmap
* icon
, BRect rect
,
350 const BRect
& updateRect
,
351 const rgb_color
& base
, uint32 flags
,
352 const rgb_color
* textColor
= NULL
);
353 virtual void DrawLabel(BView
* view
, const char* label
,
354 const BBitmap
* icon
, BRect rect
,
355 const BRect
& updateRect
,
356 const rgb_color
& base
, uint32 flags
,
357 const BAlignment
& alignment
,
358 const rgb_color
* textColor
= NULL
) = 0;
360 virtual void GetFrameInsets(frame_type frameType
,
361 uint32 flags
, float& _left
, float& _top
,
362 float& _right
, float& _bottom
) = 0;
363 virtual void GetBackgroundInsets(
364 background_type backgroundType
,
365 uint32 flags
, float& _left
, float& _top
,
366 float& _right
, float& _bottom
) = 0;
367 void GetInsets(frame_type frameType
,
368 background_type backgroundType
,
369 uint32 flags
, float& _left
, float& _top
,
370 float& _right
, float& _bottom
);
372 virtual void DrawButtonWithPopUpBackground(BView
* view
,
373 BRect
& rect
, const BRect
& updateRect
,
374 const rgb_color
& base
,
376 uint32 borders
= B_ALL_BORDERS
,
377 orientation orientation
= B_HORIZONTAL
) = 0;
378 virtual void DrawButtonWithPopUpBackground(BView
* view
,
379 BRect
& rect
, const BRect
& updateRect
,
381 const rgb_color
& base
,
383 uint32 borders
= B_ALL_BORDERS
,
384 orientation orientation
= B_HORIZONTAL
) = 0;
385 virtual void DrawButtonWithPopUpBackground(BView
* view
,
386 BRect
& rect
, const BRect
& updateRect
,
388 float rightTopRadius
,
389 float leftBottomRadius
,
390 float rightBottomRadius
,
391 const rgb_color
& base
,
393 uint32 borders
= B_ALL_BORDERS
,
394 orientation orientation
= B_HORIZONTAL
) = 0;
396 void SetBackgroundInfo(
397 const BMessage
& backgroundInfo
);
400 int32 fCachedWorkspace
;
401 BMessage fBackgroundInfo
;
403 uint32 _reserved
[20];
406 extern BControlLook
* be_control_look
;
409 } // namespace BPrivate
411 using BPrivate::BControlLook
;
412 using BPrivate::be_control_look
;
415 #endif // _CONTROL_LOOK_H