2 * Copyright 2009-2017, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _HAIKU_CONTROL_LOOK_H
6 #define _HAIKU_CONTROL_LOOK_H
9 #include <ControlLook.h>
14 class BGradientLinear
;
21 class HaikuControlLook
: public BControlLook
{
24 virtual ~HaikuControlLook();
26 virtual BAlignment
DefaultLabelAlignment() const;
27 virtual float DefaultLabelSpacing() const;
29 virtual float DefaultItemSpacing() const;
31 static float ComposeSpacing(float spacing
);
33 virtual uint32
Flags(BControl
* control
) const;
35 virtual void DrawButtonFrame(BView
* view
, BRect
& rect
,
36 const BRect
& updateRect
,
37 const rgb_color
& base
,
38 const rgb_color
& background
,
40 uint32 borders
= B_ALL_BORDERS
);
41 virtual void DrawButtonFrame(BView
* view
, BRect
& rect
,
42 const BRect
& updateRect
,
44 const rgb_color
& base
,
45 const rgb_color
& background
,
47 uint32 borders
= B_ALL_BORDERS
);
48 virtual void DrawButtonFrame(BView
* view
, BRect
& rect
,
49 const BRect
& updateRect
,
52 float leftBottomRadius
,
53 float rightBottomRadius
,
54 const rgb_color
& base
,
55 const rgb_color
& background
,
57 uint32 borders
= B_ALL_BORDERS
);
59 virtual void DrawButtonBackground(BView
* view
, BRect
& rect
,
60 const BRect
& updateRect
,
61 const rgb_color
& base
,
63 uint32 borders
= B_ALL_BORDERS
,
64 orientation orientation
= B_HORIZONTAL
);
65 virtual void DrawButtonBackground(BView
* view
, BRect
& rect
,
66 const BRect
& updateRect
,
68 const rgb_color
& base
,
70 uint32 borders
= B_ALL_BORDERS
,
71 orientation orientation
= B_HORIZONTAL
);
72 virtual void DrawButtonBackground(BView
* view
, BRect
& rect
,
73 const BRect
& updateRect
,
76 float leftBottomRadius
,
77 float rightBottomRadius
,
78 const rgb_color
& base
,
80 uint32 borders
= B_ALL_BORDERS
,
81 orientation orientation
= B_HORIZONTAL
);
83 virtual void DrawMenuBarBackground(BView
* view
, BRect
& rect
,
84 const BRect
& updateRect
,
85 const rgb_color
& base
,
87 uint32 borders
= B_ALL_BORDERS
);
89 virtual void DrawMenuFieldFrame(BView
* view
, BRect
& rect
,
90 const BRect
& updateRect
,
91 const rgb_color
& base
,
92 const rgb_color
& background
,
94 uint32 borders
= B_ALL_BORDERS
);
95 virtual void DrawMenuFieldFrame(BView
* view
, BRect
& rect
,
96 const BRect
& updateRect
,
98 const rgb_color
& base
,
99 const rgb_color
& background
,
101 uint32 borders
= B_ALL_BORDERS
);
102 virtual void DrawMenuFieldFrame(BView
* view
, BRect
& rect
,
103 const BRect
& updateRect
,
105 float rightTopRadius
,
106 float leftBottomRadius
,
107 float rightBottomRadius
,
108 const rgb_color
& base
,
109 const rgb_color
& background
,
111 uint32 borders
= B_ALL_BORDERS
);
113 virtual void DrawMenuFieldBackground(BView
* view
,
114 BRect
& rect
, const BRect
& updateRect
,
115 const rgb_color
& base
, bool popupIndicator
,
117 virtual void DrawMenuFieldBackground(BView
* view
,
118 BRect
& rect
, const BRect
& updateRect
,
119 float radius
, const rgb_color
& base
,
120 bool popupIndicator
, uint32 flags
= 0);
121 virtual void DrawMenuFieldBackground(BView
* view
,
122 BRect
& rect
, const BRect
& updateRect
,
124 float rightTopRadius
,
125 float leftBottomRadius
,
126 float rightBottomRadius
,
127 const rgb_color
& base
,
128 bool popupIndicator
, uint32 flags
= 0);
129 virtual void DrawMenuFieldBackground(BView
* view
,
130 BRect
& rect
, const BRect
& updateRect
,
131 const rgb_color
& base
, uint32 flags
= 0,
132 uint32 borders
= B_ALL_BORDERS
);
134 virtual void DrawMenuBackground(BView
* view
,
135 BRect
& rect
, const BRect
& updateRect
,
136 const rgb_color
& base
, uint32 flags
= 0,
137 uint32 borders
= B_ALL_BORDERS
);
139 virtual void DrawMenuItemBackground(BView
* view
,
140 BRect
& rect
, const BRect
& updateRect
,
141 const rgb_color
& base
, uint32 flags
= 0,
142 uint32 borders
= B_ALL_BORDERS
);
144 virtual void DrawStatusBar(BView
* view
, BRect
& rect
,
145 const BRect
& updateRect
,
146 const rgb_color
& base
,
147 const rgb_color
& barColor
,
148 float progressPosition
);
150 virtual void DrawCheckBox(BView
* view
, BRect
& rect
,
151 const BRect
& updateRect
,
152 const rgb_color
& base
,
155 virtual void DrawRadioButton(BView
* view
, BRect
& rect
,
156 const BRect
& updateRect
,
157 const rgb_color
& base
,
160 virtual void DrawScrollBarBackground(BView
* view
,
161 BRect
& rect1
, BRect
& rect2
,
162 const BRect
& updateRect
,
163 const rgb_color
& base
, uint32 flags
,
164 orientation orientation
);
165 virtual void DrawScrollBarBackground(BView
* view
,
166 BRect
& rect
, const BRect
& updateRect
,
167 const rgb_color
& base
, uint32 flags
,
168 orientation orientation
);
170 virtual void DrawScrollViewFrame(BView
* view
,
171 BRect
& rect
, const BRect
& updateRect
,
172 BRect verticalScrollBarFrame
,
173 BRect horizontalScrollBarFrame
,
174 const rgb_color
& base
,
175 border_style borderStyle
,
177 uint32 borders
= B_ALL_BORDERS
);
179 virtual void DrawArrowShape(BView
* view
,
180 BRect
& rect
, const BRect
& updateRect
,
181 const rgb_color
& base
, uint32 direction
,
183 float tint
= B_DARKEN_MAX_TINT
);
185 virtual rgb_color
SliderBarColor(const rgb_color
& base
);
187 virtual void DrawSliderBar(BView
* view
, BRect rect
,
188 const BRect
& updateRect
,
189 const rgb_color
& base
,
190 rgb_color leftFillColor
,
191 rgb_color rightFillColor
,
192 float sliderScale
, uint32 flags
,
193 orientation orientation
);
194 virtual void DrawSliderBar(BView
* view
, BRect rect
,
195 const BRect
& updateRect
,
196 const rgb_color
& base
, rgb_color fillColor
,
197 uint32 flags
, orientation orientation
);
199 virtual void DrawSliderThumb(BView
* view
, BRect
& rect
,
200 const BRect
& updateRect
,
201 const rgb_color
& base
, uint32 flags
,
202 orientation orientation
);
204 virtual void DrawSliderTriangle(BView
* view
, BRect
& rect
,
205 const BRect
& updateRect
,
206 const rgb_color
& base
, uint32 flags
,
207 orientation orientation
);
208 virtual void DrawSliderTriangle(BView
* view
, BRect
& rect
,
209 const BRect
& updateRect
,
210 const rgb_color
& base
,
211 const rgb_color
& fill
, uint32 flags
,
212 orientation orientation
);
214 virtual void DrawSliderHashMarks(BView
* view
, BRect
& rect
,
215 const BRect
& updateRect
,
216 const rgb_color
& base
, int32 count
,
217 hash_mark_location location
,
218 uint32 flags
, orientation orientation
);
220 virtual void DrawActiveTab(BView
* view
, BRect
& rect
,
221 const BRect
& updateRect
,
222 const rgb_color
& base
, uint32 flags
= 0,
223 uint32 borders
= B_ALL_BORDERS
,
224 uint32 side
= B_TOP_BORDER
);
226 virtual void DrawInactiveTab(BView
* view
, BRect
& rect
,
227 const BRect
& updateRect
,
228 const rgb_color
& base
, uint32 flags
= 0,
229 uint32 borders
= B_ALL_BORDERS
,
230 uint32 side
= B_TOP_BORDER
);
232 virtual void DrawSplitter(BView
* view
, BRect
& rect
,
233 const BRect
& updateRect
,
234 const rgb_color
& base
,
235 orientation orientation
,
237 uint32 borders
= B_ALL_BORDERS
);
241 virtual void DrawBorder(BView
* view
, BRect
& rect
,
242 const BRect
& updateRect
,
243 const rgb_color
& base
,
244 border_style borderStyle
, uint32 flags
= 0,
245 uint32 borders
= B_ALL_BORDERS
);
247 virtual void DrawRaisedBorder(BView
* view
, BRect
& rect
,
248 const BRect
& updateRect
,
249 const rgb_color
& base
, uint32 flags
= 0,
250 uint32 borders
= B_ALL_BORDERS
);
252 virtual void DrawGroupFrame(BView
* view
, BRect
& rect
,
253 const BRect
& updateRect
,
254 const rgb_color
& base
,
255 uint32 borders
= B_ALL_BORDERS
);
257 virtual void DrawTextControlBorder(BView
* view
, BRect
& rect
,
258 const BRect
& updateRect
,
259 const rgb_color
& base
, uint32 flags
= 0,
260 uint32 borders
= B_ALL_BORDERS
);
264 virtual void DrawLabel(BView
* view
, const char* label
,
265 BRect rect
, const BRect
& updateRect
,
266 const rgb_color
& base
, uint32 flags
,
267 const rgb_color
* textColor
= NULL
);
268 virtual void DrawLabel(BView
* view
, const char* label
,
269 BRect rect
, const BRect
& updateRect
,
270 const rgb_color
& base
, uint32 flags
,
271 const BAlignment
& alignment
,
272 const rgb_color
* textColor
= NULL
);
273 // TODO: Would be nice to have a (non-virtual) version of this method
274 // which takes an array of labels and locations. That would save some
275 // setup with the view graphics state.
276 virtual void DrawLabel(BView
* view
, const char* label
,
277 const rgb_color
& base
, uint32 flags
,
279 const rgb_color
* textColor
= NULL
);
281 virtual void DrawLabel(BView
* view
, const char* label
,
282 const BBitmap
* icon
, BRect rect
,
283 const BRect
& updateRect
,
284 const rgb_color
& base
, uint32 flags
,
285 const BAlignment
& alignment
,
286 const rgb_color
* textColor
= NULL
);
288 virtual void GetFrameInsets(frame_type frameType
,
289 uint32 flags
, float& _left
, float& _top
,
290 float& _right
, float& _bottom
);
291 virtual void GetBackgroundInsets(
292 background_type backgroundType
,
293 uint32 flags
, float& _left
, float& _top
,
294 float& _right
, float& _bottom
);
296 virtual void DrawButtonWithPopUpBackground(BView
* view
,
297 BRect
& rect
, const BRect
& updateRect
,
298 const rgb_color
& base
,
300 uint32 borders
= B_ALL_BORDERS
,
301 orientation orientation
= B_HORIZONTAL
);
302 virtual void DrawButtonWithPopUpBackground(BView
* view
,
303 BRect
& rect
, const BRect
& updateRect
,
305 const rgb_color
& base
,
307 uint32 borders
= B_ALL_BORDERS
,
308 orientation orientation
= B_HORIZONTAL
);
309 virtual void DrawButtonWithPopUpBackground(BView
* view
,
310 BRect
& rect
, const BRect
& updateRect
,
312 float rightTopRadius
,
313 float leftBottomRadius
,
314 float rightBottomRadius
,
315 const rgb_color
& base
,
317 uint32 borders
= B_ALL_BORDERS
,
318 orientation orientation
= B_HORIZONTAL
);
321 void _DrawButtonFrame(BView
* view
, BRect
& rect
,
322 const BRect
& updateRect
,
324 float rightTopRadius
,
325 float leftBottomRadius
,
326 float rightBottomRadius
,
327 const rgb_color
& base
,
328 const rgb_color
& background
,
329 float contrast
, float brightness
= 1.0,
331 uint32 borders
= B_ALL_BORDERS
);
333 void _DrawOuterResessedFrame(BView
* view
,
334 BRect
& rect
, const rgb_color
& base
,
335 float contrast
= 1.0f
,
336 float brightness
= 1.0f
,
338 uint32 borders
= B_ALL_BORDERS
);
340 void _DrawFrame(BView
* view
, BRect
& rect
,
341 const rgb_color
& left
,
342 const rgb_color
& top
,
343 const rgb_color
& right
,
344 const rgb_color
& bottom
,
345 uint32 borders
= B_ALL_BORDERS
);
346 void _DrawFrame(BView
* view
, BRect
& rect
,
347 const rgb_color
& left
,
348 const rgb_color
& top
,
349 const rgb_color
& right
,
350 const rgb_color
& bottom
,
351 const rgb_color
& rightTop
,
352 const rgb_color
& leftBottom
,
353 uint32 borders
= B_ALL_BORDERS
);
355 void _DrawButtonBackground(BView
* view
, BRect
& rect
,
356 const BRect
& updateRect
,
358 float rightTopRadius
,
359 float leftBottomRadius
,
360 float rightBottomRadius
,
361 const rgb_color
& base
,
362 bool popupIndicator
= false,
364 uint32 borders
= B_ALL_BORDERS
,
365 orientation orientation
= B_HORIZONTAL
);
366 void _DrawFlatButtonBackground(BView
* view
,
367 BRect
& rect
, const BRect
& updateRect
,
368 const rgb_color
& base
,
369 bool popupIndicator
= false,
371 uint32 borders
= B_ALL_BORDERS
,
372 orientation orientation
= B_HORIZONTAL
);
373 void _DrawNonFlatButtonBackground(BView
* view
,
374 BRect
& rect
, const BRect
& updateRect
,
377 float rightTopRadius
,
378 float leftBottomRadius
,
379 float rightBottomRadius
,
380 const rgb_color
& base
,
381 bool popupIndicator
= false,
383 uint32 borders
= B_ALL_BORDERS
,
384 orientation orientation
= B_HORIZONTAL
);
386 void _DrawPopUpMarker(BView
* view
, const BRect
& rect
,
387 const rgb_color
& base
, uint32 flags
);
389 void _DrawMenuFieldBackgroundOutside(BView
* view
,
390 BRect
& rect
, const BRect
& updateRect
,
392 float rightTopRadius
,
393 float leftBottomRadius
,
394 float rightBottomRadius
,
395 const rgb_color
& base
,
396 bool popupIndicator
= false,
399 void _DrawMenuFieldBackgroundInside(BView
* view
,
400 BRect
& rect
, const BRect
& updateRect
,
402 float rightTopRadius
,
403 float leftBottomRadius
,
404 float rightBottomRadius
,
405 const rgb_color
& base
, uint32 flags
= 0,
406 uint32 borders
= B_ALL_BORDERS
);
408 // Rounded corner methods
409 void _DrawRoundCornerLeftTop(BView
* view
,
410 BRect
& cornerRect
, const BRect
& updateRect
,
411 const rgb_color
& background
,
412 const rgb_color
& edgeColor
,
413 const rgb_color
& frameColor
,
414 const rgb_color
& bevelColor
,
415 const BGradientLinear
& fillGradient
);
417 void _DrawRoundCornerFrameLeftTop(BView
* view
,
418 BRect
& cornerRect
, const BRect
& updateRect
,
419 const rgb_color
& background
,
420 const rgb_color
& edgeColor
,
421 const rgb_color
& frameColor
);
423 void _DrawRoundCornerBackgroundLeftTop(BView
* view
,
424 BRect
& cornerRect
, const BRect
& updateRect
,
425 const rgb_color
& bevelColor
,
426 const BGradientLinear
& fillGradient
);
428 void _DrawRoundCornerRightTop(BView
* view
,
429 BRect
& cornerRect
, const BRect
& updateRect
,
430 const rgb_color
& background
,
431 const rgb_color
& edgeTopColor
,
432 const rgb_color
& edgeRightColor
,
433 const rgb_color
& frameTopColor
,
434 const rgb_color
& frameRightColor
,
435 const rgb_color
& bevelTopColor
,
436 const rgb_color
& bevelRightColor
,
437 const BGradientLinear
& fillGradient
);
439 void _DrawRoundCornerFrameRightTop(BView
* view
,
440 BRect
& cornerRect
, const BRect
& updateRect
,
441 const rgb_color
& background
,
442 const rgb_color
& edgeTopColor
,
443 const rgb_color
& edgeRightColor
,
444 const rgb_color
& frameTopColor
,
445 const rgb_color
& frameRightColor
);
447 void _DrawRoundCornerBackgroundRightTop(BView
* view
,
448 BRect
& cornerRect
, const BRect
& updateRect
,
449 const rgb_color
& bevelTopColor
,
450 const rgb_color
& bevelRightColor
,
451 const BGradientLinear
& fillGradient
);
453 void _DrawRoundCornerLeftBottom(BView
* view
,
454 BRect
& cornerRect
, const BRect
& updateRect
,
455 const rgb_color
& background
,
456 const rgb_color
& edgeLeftColor
,
457 const rgb_color
& edgeBottomColor
,
458 const rgb_color
& frameLeftColor
,
459 const rgb_color
& frameBottomColor
,
460 const rgb_color
& bevelLeftColor
,
461 const rgb_color
& bevelBottomColor
,
462 const BGradientLinear
& fillGradient
);
464 void _DrawRoundCornerFrameLeftBottom(BView
* view
,
465 BRect
& cornerRect
, const BRect
& updateRect
,
466 const rgb_color
& background
,
467 const rgb_color
& edgeLeftColor
,
468 const rgb_color
& edgeBottomColor
,
469 const rgb_color
& frameLeftColor
,
470 const rgb_color
& frameBottomColor
);
472 void _DrawRoundCornerBackgroundLeftBottom(BView
* view
,
473 BRect
& cornerRect
, const BRect
& updateRect
,
474 const rgb_color
& bevelLeftColor
,
475 const rgb_color
& bevelBottomColor
,
476 const BGradientLinear
& fillGradient
);
478 void _DrawRoundCornerRightBottom(BView
* view
,
479 BRect
& cornerRect
, const BRect
& updateRect
,
480 const rgb_color
& background
,
481 const rgb_color
& edgeColor
,
482 const rgb_color
& frameColor
,
483 const rgb_color
& bevelColor
,
484 const BGradientLinear
& fillGradient
);
486 void _DrawRoundCornerFrameRightBottom(BView
* view
,
487 BRect
& cornerRect
, const BRect
& updateRect
,
488 const rgb_color
& background
,
489 const rgb_color
& edgeColor
,
490 const rgb_color
& frameColor
);
492 void _DrawRoundCornerBackgroundRightBottom(
494 BRect
& cornerRect
, const BRect
& updateRect
,
495 const rgb_color
& bevelColor
,
496 const BGradientLinear
& fillGradient
);
498 void _DrawRoundBarCorner(BView
* view
, BRect
& rect
,
499 const BRect
& updateRect
,
500 const rgb_color
& edgeLightColor
,
501 const rgb_color
& edgeShadowColor
,
502 const rgb_color
& frameLightColor
,
503 const rgb_color
& frameShadowColor
,
504 const rgb_color
& fillLightColor
,
505 const rgb_color
& fillShadowColor
,
506 float leftInset
, float topInset
,
507 float rightInset
, float bottomInset
,
508 orientation orientation
);
510 // Border color methods
511 rgb_color
_EdgeLightColor(const rgb_color
& base
,
512 float contrast
, float brightness
,
515 rgb_color
_EdgeShadowColor(const rgb_color
& base
,
516 float contrast
, float brightness
,
519 rgb_color
_FrameLightColor(const rgb_color
& base
,
522 rgb_color
_FrameShadowColor(const rgb_color
& base
,
525 rgb_color
_BevelLightColor(const rgb_color
& base
,
528 rgb_color
_BevelShadowColor(const rgb_color
& base
,
531 // Background gradient methods
532 void _FillGradient(BView
* view
, const BRect
& rect
,
533 const rgb_color
& base
, float topTint
,
535 orientation orientation
= B_HORIZONTAL
);
537 void _FillGlossyGradient(BView
* view
,
538 const BRect
& rect
, const rgb_color
& base
,
539 float topTint
, float middle1Tint
,
540 float middle2Tint
, float bottomTint
,
541 orientation orientation
= B_HORIZONTAL
);
543 void _MakeGradient(BGradientLinear
& gradient
,
544 const BRect
& rect
, const rgb_color
& base
,
545 float topTint
, float bottomTint
,
546 orientation orientation
= B_HORIZONTAL
) const;
548 void _MakeGlossyGradient(BGradientLinear
& gradient
,
549 const BRect
& rect
, const rgb_color
& base
,
550 float topTint
, float middle1Tint
,
551 float middle2Tint
, float bottomTint
,
552 orientation orientation
= B_HORIZONTAL
) const;
554 void _MakeButtonGradient(BGradientLinear
& gradient
,
555 BRect
& rect
, const rgb_color
& base
,
556 uint32 flags
, orientation orientation
= B_HORIZONTAL
) const;
558 bool _RadioButtonAndCheckBoxMarkColor(
559 const rgb_color
& base
, rgb_color
& color
,
567 } // namespace BPrivate
569 #endif // _HAIKU_CONTROL_LOOK_H