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 int32 index = 0, int32 selected = -1, 227 int32 first = 0, int32 last = 0); 228 virtual void DrawInactiveTab(BView* view, BRect& rect, 229 const BRect& updateRect, 230 const rgb_color& base, uint32 flags = 0, 231 uint32 borders = B_ALL_BORDERS, 232 uint32 side = B_TOP_BORDER, 233 int32 index = 0, int32 selected = -1, 234 int32 first = 0, int32 last = 0); 235 236 virtual void DrawSplitter(BView* view, BRect& rect, 237 const BRect& updateRect, 238 const rgb_color& base, 239 orientation orientation, 240 uint32 flags = 0, 241 uint32 borders = B_ALL_BORDERS); 242 243 // various borders 244 245 virtual void DrawBorder(BView* view, BRect& rect, 246 const BRect& updateRect, 247 const rgb_color& base, 248 border_style borderStyle, uint32 flags = 0, 249 uint32 borders = B_ALL_BORDERS); 250 251 virtual void DrawRaisedBorder(BView* view, BRect& rect, 252 const BRect& updateRect, 253 const rgb_color& base, uint32 flags = 0, 254 uint32 borders = B_ALL_BORDERS); 255 256 virtual void DrawGroupFrame(BView* view, BRect& rect, 257 const BRect& updateRect, 258 const rgb_color& base, 259 uint32 borders = B_ALL_BORDERS); 260 261 virtual void DrawTextControlBorder(BView* view, BRect& rect, 262 const BRect& updateRect, 263 const rgb_color& base, uint32 flags = 0, 264 uint32 borders = B_ALL_BORDERS); 265 266 // aligned labels 267 268 virtual void DrawLabel(BView* view, const char* label, 269 BRect rect, const BRect& updateRect, 270 const rgb_color& base, uint32 flags, 271 const rgb_color* textColor = NULL); 272 virtual void DrawLabel(BView* view, const char* label, 273 BRect rect, const BRect& updateRect, 274 const rgb_color& base, uint32 flags, 275 const BAlignment& alignment, 276 const rgb_color* textColor = NULL); 277 virtual void DrawLabel(BView* view, const char* label, 278 const rgb_color& base, uint32 flags, 279 const BPoint& where, 280 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); 287 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); 295 296 virtual void DrawButtonWithPopUpBackground(BView* view, 297 BRect& rect, const BRect& updateRect, 298 const rgb_color& base, 299 uint32 flags = 0, 300 uint32 borders = B_ALL_BORDERS, 301 orientation orientation = B_HORIZONTAL); 302 virtual void DrawButtonWithPopUpBackground(BView* view, 303 BRect& rect, const BRect& updateRect, 304 float radius, 305 const rgb_color& base, 306 uint32 flags = 0, 307 uint32 borders = B_ALL_BORDERS, 308 orientation orientation = B_HORIZONTAL); 309 virtual void DrawButtonWithPopUpBackground(BView* view, 310 BRect& rect, const BRect& updateRect, 311 float leftTopRadius, 312 float rightTopRadius, 313 float leftBottomRadius, 314 float rightBottomRadius, 315 const rgb_color& base, 316 uint32 flags = 0, 317 uint32 borders = B_ALL_BORDERS, 318 orientation orientation = B_HORIZONTAL); 319 320 protected: 321 void _DrawButtonFrame(BView* view, BRect& rect, 322 const BRect& updateRect, 323 float, float, float, float, 324 const rgb_color& base, 325 const rgb_color& background, 326 float contrast, float brightness = 1.0, 327 uint32 flags = 0, 328 uint32 borders = B_ALL_BORDERS); 329 330 void _DrawButtonBackground(BView* view, BRect& rect, 331 const BRect& updateRect, 332 float, float, float, float, 333 const rgb_color& base, 334 bool popupIndicator = false, 335 uint32 flags = 0, 336 uint32 borders = B_ALL_BORDERS, 337 orientation orientation = B_HORIZONTAL); 338 339 void _DrawPopUpMarker(BView* view, const BRect& rect, 340 const rgb_color& base, uint32 flags); 341 void _DrawMenuFieldBackgroundOutside(BView* view, 342 BRect& rect, const BRect& updateRect, 343 float, float, float, float, 344 const rgb_color& base, 345 bool popupIndicator = false, 346 uint32 flags = 0); 347 void _DrawMenuFieldBackgroundInside(BView* view, 348 BRect& rect, const BRect& updateRect, 349 float, float, float, float, 350 const rgb_color& base, uint32 flags = 0, 351 uint32 borders = B_ALL_BORDERS); 352 353 void _DrawScrollBarBackgroundFirst(BView* view, 354 BRect& rect, const BRect& updateRect, 355 const rgb_color& base, uint32 flags, 356 orientation orientation); 357 void _DrawScrollBarBackgroundSecond(BView* view, 358 BRect& rect, const BRect& updateRect, 359 const rgb_color& base, uint32 flags, 360 orientation orientation); 361 void _DrawScrollBarKnobDot(BView* view, 362 float hcenter, float vmiddle, 363 rgb_color dark, rgb_color light, 364 orientation orientation); 365 void _DrawScrollBarKnobLine(BView* view, 366 float hcenter, float vmiddle, 367 rgb_color dark, rgb_color light, 368 orientation orientation); 369 370 void _DrawFrame(BView* view, BRect& rect, 371 const rgb_color& left, 372 const rgb_color& top, 373 const rgb_color& right, 374 const rgb_color& bottom, 375 uint32 borders = B_ALL_BORDERS); 376 377 private: 378 bool fCachedOutline; 379 }; 380 381 } // namespace BPrivate 382 383 384 #endif // BE_CONTROL_LOOK_H 385