1/*
2 * Copyright 2009-2020 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Fran��ois Revol, revol@free.fr
7 *		Nahuel Tello, ntello@unarix.com.ar
8 */
9#ifndef FLAT_CONTROL_LOOK_H
10#define FLAT_CONTROL_LOOK_H
11
12
13#include <ControlLook.h>
14
15#include "HaikuControlLook.h"
16
17
18class BBitmap;
19class BControl;
20class BGradientLinear;
21class BView;
22
23namespace BPrivate {
24
25using BPrivate::HaikuControlLook;
26
27class FlatControlLook : public HaikuControlLook {
28public:
29								FlatControlLook();
30	virtual						~FlatControlLook();
31
32
33	virtual	void				DrawButtonFrame(BView* view, BRect& rect,
34									const BRect& updateRect,
35									const rgb_color& base,
36									const rgb_color& background,
37									uint32 flags = 0,
38									uint32 borders = B_ALL_BORDERS);
39	virtual	void				DrawButtonFrame(BView* view, BRect& rect,
40									const BRect& updateRect,
41									float radius,
42									const rgb_color& base,
43									const rgb_color& background,
44									uint32 flags = 0,
45									uint32 borders = B_ALL_BORDERS);
46	virtual	void				DrawButtonFrame(BView* view, BRect& rect,
47									const BRect& updateRect,
48									float leftTopRadius,
49									float rightTopRadius,
50									float leftBottomRadius,
51									float rightBottomRadius,
52									const rgb_color& base,
53									const rgb_color& background,
54									uint32 flags = 0,
55									uint32 borders = B_ALL_BORDERS);
56
57	virtual	void				DrawMenuBarBackground(BView* view, BRect& rect,
58									const BRect& updateRect,
59									const rgb_color& base,
60									uint32 flags,
61									uint32 borders = B_ALL_BORDERS);
62	virtual	void				DrawMenuItemBackground(BView* view,
63									BRect& rect, const BRect& updateRect,
64									const rgb_color& base, uint32 flags = 0,
65									uint32 borders = B_ALL_BORDERS);
66	virtual	void				DrawMenuFieldFrame(BView* view, BRect& rect,
67									const BRect& updateRect, const rgb_color& base,
68									const rgb_color& background, uint32 flags, uint32 borders);
69	virtual	void				DrawMenuFieldFrame(BView* view, BRect& rect,
70									const BRect& updateRect, float radius, const rgb_color& base,
71									const rgb_color& background, uint32 flags, uint32 borders);
72	virtual void				DrawMenuFieldFrame(BView* view, BRect& rect,
73									const BRect& updateRect, float leftTopRadius,
74									float rightTopRadius, float leftBottomRadius,
75									float rightBottomRadius, const rgb_color& base,
76									const rgb_color& background, uint32 flags, uint32 borders);
77
78	virtual	void				DrawMenuBackground(BView* view,
79									BRect& rect, const BRect& updateRect,
80									const rgb_color& base, uint32 flags = 0,
81									uint32 borders = B_ALL_BORDERS);
82
83	virtual	void				DrawScrollBarBorder(BView* view,
84									BRect rect, const BRect& updateRect,
85									const rgb_color& base, uint32 flags,
86									orientation orientation);
87	virtual	void				DrawScrollBarButton(BView* view,
88									BRect rect, const BRect& updateRect,
89									const rgb_color& base, uint32 flags,
90									int32 direction, orientation orientation,
91									bool down = false);
92	virtual	void				DrawScrollBarBackground(BView* view,
93									BRect& rect1, BRect& rect2,
94									const BRect& updateRect,
95									const rgb_color& base, uint32 flags,
96									orientation orientation);
97	virtual	void				DrawScrollBarBackground(BView* view,
98									BRect& rect, const BRect& updateRect,
99									const rgb_color& base, uint32 flags,
100									orientation orientation);
101	virtual	void				DrawScrollBarThumb(BView* view,
102									BRect& rect, const BRect& updateRect,
103									const rgb_color& base, uint32 flags,
104									orientation orientation,
105									uint32 knobStyle = B_KNOB_NONE);
106
107	virtual	void				DrawScrollViewFrame(BView* view,
108									BRect& rect, const BRect& updateRect,
109									BRect verticalScrollBarFrame,
110									BRect horizontalScrollBarFrame,
111									const rgb_color& base,
112									border_style borderStyle,
113									uint32 flags = 0,
114									uint32 borders = B_ALL_BORDERS);
115
116	virtual	rgb_color			SliderBarColor(const rgb_color& base);
117
118	virtual	void				DrawSliderBar(BView* view, BRect rect,
119									const BRect& updateRect,
120									const rgb_color& base,
121									rgb_color leftFillColor,
122									rgb_color rightFillColor,
123									float sliderScale, uint32 flags,
124									orientation orientation);
125	virtual	void				DrawSliderBar(BView* view, BRect rect,
126									const BRect& updateRect,
127									const rgb_color& base, rgb_color fillColor,
128									uint32 flags, orientation orientation);
129
130	virtual	void				DrawSliderThumb(BView* view, BRect& rect,
131									const BRect& updateRect,
132									const rgb_color& base, uint32 flags,
133									orientation orientation);
134
135	virtual	void				DrawActiveTab(BView* view, BRect& rect,
136									const BRect& updateRect,
137									const rgb_color& base, uint32 flags = 0,
138									uint32 borders = B_ALL_BORDERS,
139									uint32 side = B_TOP_BORDER,
140									int32 index = 0, int32 selected = -1,
141									int32 first = 0, int32 last = 0);
142
143	virtual	void				DrawButtonBackground(BView* view, BRect& rect,
144									const BRect& updateRect,
145									const rgb_color& base,
146									uint32 flags = 0,
147									uint32 borders = B_ALL_BORDERS,
148									orientation orientation = B_HORIZONTAL);
149	virtual	void				DrawButtonBackground(BView* view, BRect& rect,
150									const BRect& updateRect,
151									float radius,
152									const rgb_color& base,
153									uint32 flags = 0,
154									uint32 borders = B_ALL_BORDERS,
155									orientation orientation = B_HORIZONTAL);
156	virtual	void				DrawButtonBackground(BView* view, BRect& rect,
157									const BRect& updateRect,
158									float leftTopRadius,
159									float rightTopRadius,
160									float leftBottomRadius,
161									float rightBottomRadius,
162									const rgb_color& base,
163									uint32 flags = 0,
164									uint32 borders = B_ALL_BORDERS,
165									orientation orientation = B_HORIZONTAL);
166
167	virtual	void				DrawButtonWithPopUpBackground(BView* view,
168									BRect& rect, const BRect& updateRect,
169									const rgb_color& base,
170									uint32 flags = 0,
171									uint32 borders = B_ALL_BORDERS,
172									orientation orientation = B_HORIZONTAL);
173	virtual	void				DrawButtonWithPopUpBackground(BView* view,
174									BRect& rect, const BRect& updateRect,
175									float radius,
176									const rgb_color& base,
177									uint32 flags = 0,
178									uint32 borders = B_ALL_BORDERS,
179									orientation orientation = B_HORIZONTAL);
180	virtual	void				DrawButtonWithPopUpBackground(BView* view,
181									BRect& rect, const BRect& updateRect,
182									float leftTopRadius,
183									float rightTopRadius,
184									float leftBottomRadius,
185									float rightBottomRadius,
186									const rgb_color& base,
187									uint32 flags = 0,
188									uint32 borders = B_ALL_BORDERS,
189									orientation orientation = B_HORIZONTAL);
190
191	virtual	void				DrawGroupFrame(BView* view, BRect& rect,
192									const BRect& updateRect,
193									const rgb_color& base,
194									uint32 borders = B_ALL_BORDERS);
195
196	virtual	void				DrawTextControlBorder(BView* view, BRect& rect,
197									const BRect& updateRect,
198									const rgb_color& base, uint32 flags = 0,
199									uint32 borders = B_ALL_BORDERS);
200
201	virtual	void				DrawMenuFieldBackground(BView* view, BRect& rect,
202									const BRect& updateRect, const rgb_color& base,
203									bool popupIndicator, uint32 flags);
204	virtual	void				DrawMenuFieldBackground(BView* view, BRect& rect,
205									const BRect& updateRect, const rgb_color& base,
206									uint32 flags, uint32 borders);
207	virtual	void				DrawMenuFieldBackground(BView* view, BRect& rect,
208									const BRect& updateRect, float radius, const rgb_color& base,
209									bool popupIndicator, uint32 flags);
210	virtual	void				DrawMenuFieldBackground(BView* view, BRect& rect,
211									const BRect& updateRect, float leftTopRadius,
212									float rightTopRadius, float leftBottomRadius,
213									float rightBottomRadius, const rgb_color& base,
214									bool popupIndicator, uint32 flags);
215	virtual	void				DrawSplitter(BView* view, BRect& rect, const BRect& updateRect,
216									const rgb_color& base, orientation orientation, uint32 flags,
217									uint32 borders);
218	virtual void				DrawRaisedBorder(BView* view, BRect& rect,
219									const BRect& updateRect, const rgb_color& base, uint32 flags,
220									uint32 borders);
221	virtual void				DrawBorder(BView* view, BRect& rect, const BRect& updateRect,
222									const rgb_color& base, border_style borderStyle, uint32 flags,
223									uint32 borders);
224
225protected:
226	void						_DrawButtonBackground(BView* view, BRect& rect,
227									const BRect& updateRect,
228									float leftTopRadius,
229									float rightTopRadius,
230									float leftBottomRadius,
231									float rightBottomRadius,
232									const rgb_color& base,
233									bool popupIndicator = false,
234									uint32 flags = 0,
235									uint32 borders = B_ALL_BORDERS,
236									orientation orientation = B_HORIZONTAL);
237	void						_DrawNonFlatButtonBackground(BView* view, BRect& rect,
238									const BRect& updateRect,
239									BRegion& clipping,
240									float leftTopRadius,
241									float rightTopRadius,
242									float leftBottomRadius,
243									float rightBottomRadius,
244									const rgb_color& base,
245									bool popupIndicator,
246									uint32 flags,
247									uint32 borders,
248									orientation orientation);
249
250	void 						_DrawMenuFieldBackgroundInside(BView* view, BRect& rect,
251									const BRect& updateRect, float leftTopRadius,
252									float rightTopRadius, float leftBottomRadius,
253									float rightBottomRadius, const rgb_color& base,
254									uint32 flags, uint32 borders);
255	void						_DrawMenuFieldBackgroundOutside(BView* view, BRect& rect,
256									const BRect& updateRect, float leftTopRadius,
257									float rightTopRadius, float leftBottomRadius,
258									float rightBottomRadius, const rgb_color& base,
259									bool popupIndicator, uint32 flags);
260
261	void						_DrawOuterResessedFrame(BView* view, BRect& rect, const rgb_color& base, float contrast,
262									float brightness, uint32 flags = 0, uint32 borders = B_ALL_BORDERS);
263
264	void						_DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, float leftTopRadius,
265									float rightTopRadius, float leftBottomRadius, float rightBottomRadius,
266									const rgb_color& base, const rgb_color& background, float contrast,
267									float brightness = 1.0, uint32 flags = 0, uint32 borders = B_ALL_BORDERS);
268
269	void						_DrawPopUpMarker(BView* view, const BRect& rect,
270									const rgb_color& base, uint32 flags);
271
272	rgb_color					_EdgeLightColor(const rgb_color& base, float contrast,
273									float brightness, uint32 flags);
274	rgb_color					_EdgeShadowColor(const rgb_color& base, float contrast,
275									float brightness, uint32 flags);
276
277	rgb_color					_BevelLightColor(const rgb_color& base, uint32 flags);
278
279	rgb_color					_BevelShadowColor(const rgb_color& base, uint32 flags);
280
281	void						_MakeGradient(BGradientLinear& gradient,
282									const BRect& rect, const rgb_color& base,
283									float topTint, float bottomTint,
284									orientation orientation = B_HORIZONTAL) const;
285
286	void						_MakeGlossyGradient(BGradientLinear& gradient,
287									const BRect& rect, const rgb_color& base,
288									float topTint, float middle1Tint,
289									float middle2Tint, float bottomTint,
290									orientation orientation = B_HORIZONTAL) const;
291
292	void						_MakeButtonGradient(BGradientLinear& gradient,
293									BRect& rect, const rgb_color& base,
294									uint32 flags, orientation orientation = B_HORIZONTAL) const;
295};
296
297}// bprivate
298
299#endif	// FLAT_CONTROL_LOOK_H
300