/* * Copyright 2003-2020 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef BE_CONTROL_LOOK_H #define BE_CONTROL_LOOK_H #include class BBitmap; class BControl; class BGradientLinear; class BView; namespace BPrivate { class BeControlLook : public BControlLook { public: BeControlLook(image_id id); virtual ~BeControlLook(); virtual BAlignment DefaultLabelAlignment() const; virtual float DefaultLabelSpacing() const; virtual float DefaultItemSpacing() const; static float ComposeSpacing(float spacing); virtual uint32 Flags(BControl* control) const; virtual void DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, const rgb_color& background, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, float, const rgb_color& base, const rgb_color& background, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, const rgb_color& background, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, orientation orientation = B_HORIZONTAL); virtual void DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, orientation orientation = B_HORIZONTAL); virtual void DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, orientation orientation = B_HORIZONTAL); virtual void DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0); virtual void DrawRadioButton(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0); virtual void DrawScrollBarBorder(BView* view, BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation); virtual void DrawScrollBarButton(BView* view, BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags, int32 direction, orientation orientation, bool down = false); virtual void DrawScrollBarBackground(BView* view, BRect& rect1, BRect& rect2, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation); virtual void DrawScrollBarBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation); virtual void DrawScrollBarThumb(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation, uint32 knobStyle = 0); virtual void DrawScrollViewFrame(BView* view, BRect& rect, const BRect& updateRect, BRect verticalScrollBarFrame, BRect horizontalScrollBarFrame, const rgb_color& base, border_style borderStyle, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawArrowShape(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 direction, uint32 flags = 0, float tint = B_DARKEN_MAX_TINT); virtual rgb_color SliderBarColor(const rgb_color& base); virtual void DrawMenuFieldFrame(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, const rgb_color& background, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawMenuFieldFrame(BView* view, BRect& rect, const BRect& updateRect, float, const rgb_color& base, const rgb_color& background, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawMenuFieldFrame(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, const rgb_color& background, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawMenuBarBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawMenuFieldBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, bool popupIndicator, uint32 flags = 0); virtual void DrawMenuFieldBackground(BView* view, BRect& rect, const BRect& updateRect, float, const rgb_color& base, bool popupIndicator, uint32 flags = 0); virtual void DrawMenuFieldBackground(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, bool popupIndicator, uint32 flags = 0); virtual void DrawMenuFieldBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawMenuBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawMenuItemBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawStatusBar(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, const rgb_color& barColor, float progressPosition); virtual void DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, const rgb_color& base, rgb_color leftFillColor, rgb_color rightFillColor, float sliderScale, uint32 flags, orientation orientation); virtual void DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, const rgb_color& base, rgb_color fillColor, uint32 flags, orientation orientation); virtual void DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation); virtual void DrawSliderTriangle(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation); virtual void DrawSliderTriangle(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, const rgb_color& fill, uint32 flags, orientation orientation); virtual void DrawSliderHashMarks(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, int32 count, hash_mark_location location, uint32 flags, orientation orientation); virtual void DrawTabFrame(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, border_style borderStyle = B_FANCY_BORDER, uint32 side = B_TOP_BORDER); virtual void DrawActiveTab(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, uint32 side = B_TOP_BORDER, int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); virtual void DrawInactiveTab(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, uint32 side = B_TOP_BORDER, int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); virtual void DrawSplitter(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, orientation orientation, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); // various borders virtual void DrawBorder(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, border_style borderStyle, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawRaisedBorder(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawGroupFrame(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 borders = B_ALL_BORDERS); virtual void DrawTextControlBorder(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); // aligned labels virtual void DrawLabel(BView* view, const char* label, BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags, const rgb_color* textColor = NULL); virtual void DrawLabel(BView* view, const char* label, BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags, const BAlignment& alignment, const rgb_color* textColor = NULL); virtual void DrawLabel(BView* view, const char* label, const rgb_color& base, uint32 flags, const BPoint& where, const rgb_color* textColor = NULL); virtual void DrawLabel(BView* view, const char* label, const BBitmap* icon, BRect rect, const BRect& updateRect, const rgb_color& base, uint32 flags, const BAlignment& alignment, const rgb_color* textColor = NULL); virtual void GetFrameInsets(frame_type frameType, uint32 flags, float& _left, float& _top, float& _right, float& _bottom); virtual void GetBackgroundInsets( background_type backgroundType, uint32 flags, float& _left, float& _top, float& _right, float& _bottom); virtual void DrawButtonWithPopUpBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, orientation orientation = B_HORIZONTAL); virtual void DrawButtonWithPopUpBackground(BView* view, BRect& rect, const BRect& updateRect, float radius, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, orientation orientation = B_HORIZONTAL); virtual void DrawButtonWithPopUpBackground(BView* view, BRect& rect, const BRect& updateRect, float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, orientation orientation = B_HORIZONTAL); protected: void _DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, const rgb_color& background, float contrast, float brightness = 1.0, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); void _DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, bool popupIndicator = false, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, orientation orientation = B_HORIZONTAL); void _DrawPopUpMarker(BView* view, const BRect& rect, const rgb_color& base, uint32 flags); void _DrawMenuFieldBackgroundOutside(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, bool popupIndicator = false, uint32 flags = 0); void _DrawMenuFieldBackgroundInside(BView* view, BRect& rect, const BRect& updateRect, float, float, float, float, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); void _DrawScrollBarBackgroundFirst(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation); void _DrawScrollBarBackgroundSecond(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, orientation orientation); void _DrawScrollBarKnobDot(BView* view, float hcenter, float vmiddle, rgb_color dark, rgb_color light, orientation orientation); void _DrawScrollBarKnobLine(BView* view, float hcenter, float vmiddle, rgb_color dark, rgb_color light, orientation orientation); void _DrawFrame(BView* view, BRect& rect, const rgb_color& left, const rgb_color& top, const rgb_color& right, const rgb_color& bottom, uint32 borders = B_ALL_BORDERS); private: bool fCachedOutline; }; } // namespace BPrivate #endif // BE_CONTROL_LOOK_H