xref: /haiku/src/add-ons/control_look/BeControlLook/BeControlLook.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2003-2020 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef BE_CONTROL_LOOK_H
6 #define BE_CONTROL_LOOK_H
7 
8 
9 #include <ControlLook.h>
10 
11 
12 class BBitmap;
13 class BControl;
14 class BGradientLinear;
15 class BView;
16 
17 namespace BPrivate {
18 
19 class BeControlLook : public BControlLook {
20 public:
21 								BeControlLook(image_id id);
22 	virtual						~BeControlLook();
23 
24 	virtual BAlignment			DefaultLabelAlignment() const;
25 	virtual float				DefaultLabelSpacing() const;
26 
27 	virtual	float				DefaultItemSpacing() const;
28 
29 	static	float				ComposeSpacing(float spacing);
30 
31 	virtual uint32				Flags(BControl* control) const;
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, const rgb_color& base,
42 									const rgb_color& background,
43 									uint32 flags = 0,
44 									uint32 borders = B_ALL_BORDERS);
45 	virtual	void				DrawButtonFrame(BView* view, BRect& rect,
46 									const BRect& updateRect,
47 									float, float, float, float,
48 									const rgb_color& base,
49 									const rgb_color& background,
50 									uint32 flags = 0,
51 									uint32 borders = B_ALL_BORDERS);
52 
53 	virtual	void				DrawButtonBackground(BView* view, BRect& rect,
54 									const BRect& updateRect,
55 									const rgb_color& base,
56 									uint32 flags = 0,
57 									uint32 borders = B_ALL_BORDERS,
58 									orientation orientation = B_HORIZONTAL);
59 	virtual	void				DrawButtonBackground(BView* view, BRect& rect,
60 									const BRect& updateRect, float,
61 									const rgb_color& base, uint32 flags = 0,
62 									uint32 borders = B_ALL_BORDERS,
63 									orientation orientation = B_HORIZONTAL);
64 	virtual	void				DrawButtonBackground(BView* view, BRect& rect,
65 									const BRect& updateRect, float, float,
66 									float, float, const rgb_color& base,
67 									uint32 flags = 0,
68 									uint32 borders = B_ALL_BORDERS,
69 									orientation orientation = B_HORIZONTAL);
70 
71 	virtual	void				DrawCheckBox(BView* view, BRect& rect,
72 									const BRect& updateRect,
73 									const rgb_color& base,
74 									uint32 flags = 0);
75 
76 	virtual	void				DrawRadioButton(BView* view, BRect& rect,
77 									const BRect& updateRect,
78 									const rgb_color& base,
79 									uint32 flags = 0);
80 
81 	virtual	void				DrawScrollBarBorder(BView* view,
82 									BRect rect, const BRect& updateRect,
83 									const rgb_color& base, uint32 flags,
84 									orientation orientation);
85 	virtual	void				DrawScrollBarButton(BView* view,
86 									BRect rect, const BRect& updateRect,
87 									const rgb_color& base, uint32 flags,
88 									int32 direction, orientation orientation,
89 									bool down = false);
90 	virtual	void				DrawScrollBarBackground(BView* view,
91 									BRect& rect1, BRect& rect2,
92 									const BRect& updateRect,
93 									const rgb_color& base, uint32 flags,
94 									orientation orientation);
95 	virtual	void				DrawScrollBarBackground(BView* view,
96 									BRect& rect, const BRect& updateRect,
97 									const rgb_color& base, uint32 flags,
98 									orientation orientation);
99 	virtual	void				DrawScrollBarThumb(BView* view, BRect& rect,
100 									const BRect& updateRect,
101 									const rgb_color& base, uint32 flags,
102 									orientation orientation,
103 									uint32 knobStyle = 0);
104 
105 	virtual	void				DrawScrollViewFrame(BView* view,
106 									BRect& rect, const BRect& updateRect,
107 									BRect verticalScrollBarFrame,
108 									BRect horizontalScrollBarFrame,
109 									const rgb_color& base,
110 									border_style borderStyle,
111 									uint32 flags = 0,
112 									uint32 borders = B_ALL_BORDERS);
113 
114 	virtual	void				DrawArrowShape(BView* view,
115 									BRect& rect, const BRect& updateRect,
116 									const rgb_color& base, uint32 direction,
117 									uint32 flags = 0,
118 									float tint = B_DARKEN_MAX_TINT);
119 
120 	virtual	rgb_color			SliderBarColor(const rgb_color& base);
121 
122 	virtual	void				DrawMenuFieldFrame(BView* view, BRect& rect,
123 									const BRect& updateRect,
124 									const rgb_color& base,
125 									const rgb_color& background,
126 									uint32 flags = 0,
127 									uint32 borders = B_ALL_BORDERS);
128 	virtual	void				DrawMenuFieldFrame(BView* view, BRect& rect,
129 									const BRect& updateRect, float,
130 									const rgb_color& base,
131 									const rgb_color& background,
132 									uint32 flags = 0,
133 									uint32 borders = B_ALL_BORDERS);
134 	virtual	void				DrawMenuFieldFrame(BView* view, BRect& rect,
135 									const BRect& updateRect,
136 									float, float, float, float,
137 									const rgb_color& base,
138 									const rgb_color& background,
139 									uint32 flags = 0,
140 									uint32 borders = B_ALL_BORDERS);
141 
142 	virtual	void				DrawMenuBarBackground(BView* view, BRect& rect,
143 									const BRect& updateRect,
144 									const rgb_color& base,
145 									uint32 flags = 0,
146 									uint32 borders = B_ALL_BORDERS);
147 
148 	virtual	void				DrawMenuFieldBackground(BView* view,
149 									BRect& rect, const BRect& updateRect,
150 									const rgb_color& base, bool popupIndicator,
151 									uint32 flags = 0);
152 	virtual	void				DrawMenuFieldBackground(BView* view,
153 									BRect& rect, const BRect& updateRect,
154 									float, const rgb_color& base,
155 									bool popupIndicator, uint32 flags = 0);
156 	virtual	void				DrawMenuFieldBackground(BView* view,
157 									BRect& rect, const BRect& updateRect,
158 									float, float, float, float,
159 									const rgb_color& base,
160 									bool popupIndicator, uint32 flags = 0);
161 	virtual	void				DrawMenuFieldBackground(BView* view,
162 									BRect& rect, const BRect& updateRect,
163 									const rgb_color& base, uint32 flags = 0,
164 									uint32 borders = B_ALL_BORDERS);
165 
166 	virtual	void				DrawMenuBackground(BView* view,
167 									BRect& rect, const BRect& updateRect,
168 									const rgb_color& base, uint32 flags = 0,
169 									uint32 borders = B_ALL_BORDERS);
170 
171 	virtual	void				DrawMenuItemBackground(BView* view,
172 									BRect& rect, const BRect& updateRect,
173 									const rgb_color& base, uint32 flags = 0,
174 									uint32 borders = B_ALL_BORDERS);
175 
176 	virtual	void				DrawStatusBar(BView* view, BRect& rect,
177 									const BRect& updateRect,
178 									const rgb_color& base,
179 									const rgb_color& barColor,
180 									float progressPosition);
181 
182 	virtual	void				DrawSliderBar(BView* view, BRect rect,
183 									const BRect& updateRect,
184 									const rgb_color& base,
185 									rgb_color leftFillColor,
186 									rgb_color rightFillColor,
187 									float sliderScale, uint32 flags,
188 									orientation orientation);
189 	virtual	void				DrawSliderBar(BView* view, BRect rect,
190 									const BRect& updateRect,
191 									const rgb_color& base, rgb_color fillColor,
192 									uint32 flags, orientation orientation);
193 
194 	virtual	void				DrawSliderThumb(BView* view, BRect& rect,
195 									const BRect& updateRect,
196 									const rgb_color& base, uint32 flags,
197 									orientation orientation);
198 
199 	virtual	void				DrawSliderTriangle(BView* view, BRect& rect,
200 									const BRect& updateRect,
201 									const rgb_color& base, uint32 flags,
202 									orientation orientation);
203 	virtual	void				DrawSliderTriangle(BView* view, BRect& rect,
204 									const BRect& updateRect,
205 									const rgb_color& base,
206 									const rgb_color& fill, uint32 flags,
207 									orientation orientation);
208 
209 	virtual	void				DrawSliderHashMarks(BView* view, BRect& rect,
210 									const BRect& updateRect,
211 									const rgb_color& base, int32 count,
212 									hash_mark_location location,
213 									uint32 flags, orientation orientation);
214 
215 	virtual	void				DrawTabFrame(BView* view, BRect& rect,
216 									const BRect& updateRect,
217 									const rgb_color& base, uint32 flags = 0,
218 									uint32 borders = B_ALL_BORDERS,
219 									border_style borderStyle = B_FANCY_BORDER,
220 									uint32 side = B_TOP_BORDER);
221 	virtual	void				DrawActiveTab(BView* view, BRect& rect,
222 									const BRect& updateRect,
223 									const rgb_color& base, uint32 flags = 0,
224 									uint32 borders = B_ALL_BORDERS,
225 									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);
231 
232 	virtual	void				DrawSplitter(BView* view, BRect& rect,
233 									const BRect& updateRect,
234 									const rgb_color& base,
235 									orientation orientation,
236 									uint32 flags = 0,
237 									uint32 borders = B_ALL_BORDERS);
238 
239 	// various borders
240 
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);
246 
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);
251 
252 	virtual	void				DrawGroupFrame(BView* view, BRect& rect,
253 									const BRect& updateRect,
254 									const rgb_color& base,
255 									uint32 borders = B_ALL_BORDERS);
256 
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);
261 
262 	// aligned labels
263 
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 	virtual	void				DrawLabel(BView* view, const char* label,
274 									const rgb_color& base, uint32 flags,
275 									const BPoint& where,
276 									const rgb_color* textColor = NULL);
277 	virtual	void				DrawLabel(BView* view, const char* label,
278 									const BBitmap* icon, BRect rect,
279 									const BRect& updateRect,
280 									const rgb_color& base, uint32 flags,
281 									const BAlignment& alignment,
282 									const rgb_color* textColor = NULL);
283 
284 	virtual	void				GetFrameInsets(frame_type frameType,
285 									uint32 flags, float& _left, float& _top,
286 									float& _right, float& _bottom);
287 	virtual	void				GetBackgroundInsets(
288 									background_type backgroundType,
289 									uint32 flags, float& _left, float& _top,
290 									float& _right, float& _bottom);
291 
292 	virtual	void				DrawButtonWithPopUpBackground(BView* view,
293 									BRect& rect, const BRect& updateRect,
294 									const rgb_color& base,
295 									uint32 flags = 0,
296 									uint32 borders = B_ALL_BORDERS,
297 									orientation orientation = B_HORIZONTAL);
298 	virtual	void				DrawButtonWithPopUpBackground(BView* view,
299 									BRect& rect, const BRect& updateRect,
300 									float radius,
301 									const rgb_color& base,
302 									uint32 flags = 0,
303 									uint32 borders = B_ALL_BORDERS,
304 									orientation orientation = B_HORIZONTAL);
305 	virtual	void				DrawButtonWithPopUpBackground(BView* view,
306 									BRect& rect, const BRect& updateRect,
307 									float leftTopRadius,
308 									float rightTopRadius,
309 									float leftBottomRadius,
310 									float rightBottomRadius,
311 									const rgb_color& base,
312 									uint32 flags = 0,
313 									uint32 borders = B_ALL_BORDERS,
314 									orientation orientation = B_HORIZONTAL);
315 
316 protected:
317 			void				_DrawButtonFrame(BView* view, BRect& rect,
318 									const BRect& updateRect,
319 									float, float, float, float,
320 									const rgb_color& base,
321 									const rgb_color& background,
322 									float contrast, float brightness = 1.0,
323 									uint32 flags = 0,
324 									uint32 borders = B_ALL_BORDERS);
325 
326 			void				_DrawButtonBackground(BView* view, BRect& rect,
327 									const BRect& updateRect,
328 									float, float, float, float,
329 									const rgb_color& base,
330 									bool popupIndicator = false,
331 									uint32 flags = 0,
332 									uint32 borders = B_ALL_BORDERS,
333 									orientation orientation = B_HORIZONTAL);
334 
335 			void				_DrawPopUpMarker(BView* view, const BRect& rect,
336 									const rgb_color& base, uint32 flags);
337 			void				_DrawMenuFieldBackgroundOutside(BView* view,
338 									BRect& rect, const BRect& updateRect,
339 									float, float, float, float,
340 									const rgb_color& base,
341 									bool popupIndicator = false,
342 									uint32 flags = 0);
343 			void				_DrawMenuFieldBackgroundInside(BView* view,
344 									BRect& rect, const BRect& updateRect,
345 									float, float, float, float,
346 									const rgb_color& base, uint32 flags = 0,
347 									uint32 borders = B_ALL_BORDERS);
348 
349 			void				_DrawScrollBarBackgroundFirst(BView* view,
350 									BRect& rect, const BRect& updateRect,
351 									const rgb_color& base, uint32 flags,
352 									orientation orientation);
353 			void				_DrawScrollBarBackgroundSecond(BView* view,
354 									BRect& rect, const BRect& updateRect,
355 									const rgb_color& base, uint32 flags,
356 									orientation orientation);
357 			void				_DrawScrollBarKnobDot(BView* view,
358 									float hcenter, float vmiddle,
359 									rgb_color dark, rgb_color light,
360 									orientation orientation);
361 			void				_DrawScrollBarKnobLine(BView* view,
362 									float hcenter, float vmiddle,
363 									rgb_color dark, rgb_color light,
364 									orientation orientation);
365 
366 private:
367 			bool				fCachedOutline;
368 };
369 
370 } // namespace BPrivate
371 
372 
373 #endif // BE_CONTROL_LOOK_H
374