diff --git a/ImageControlLook.cpp b/ImageControlLook.cpp index 07668c2..4dff014 100644 --- a/ImageControlLook.cpp +++ b/ImageControlLook.cpp @@ -40,7 +40,7 @@ void ImageControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, const rgb_color& background, uint32 flags, uint32 borders) { - if (_Image("Button", ICL_MIDDLE, ICL_ACTIVE) == NULL) + if (_Image("Button", ICL_MIDDLE, ICL_NORMAL) == NULL) HaikuControlLook::DrawButtonFrame(view, rect, updateRect, base, background, flags, borders); } @@ -49,7 +49,7 @@ void ImageControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, float radius, const rgb_color& base, const rgb_color& background, uint32 flags, uint32 borders) { - if (_Image("Button", ICL_MIDDLE, ICL_ACTIVE) == NULL) + if (_Image("Button", ICL_MIDDLE, ICL_NORMAL) == NULL) HaikuControlLook::DrawButtonFrame(view, rect, updateRect, radius, base, background, flags, borders); } @@ -60,7 +60,7 @@ ImageControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateR float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius, const rgb_color& base, const rgb_color& background, uint32 flags, uint32 borders) { - if (_Image("Button", ICL_MIDDLE, ICL_ACTIVE) == NULL) + if (_Image("Button", ICL_MIDDLE, ICL_NORMAL) == NULL) HaikuControlLook::DrawButtonFrame(view, rect, updateRect, leftTopRadius, rightTopRadius, leftBottomRadius, rightBottomRadius, base, background, flags, borders); } @@ -70,7 +70,7 @@ void ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, uint32 borders, orientation orientation) { - if (!_DrawButtonBackground(view, rect, updateRect, false, flags, orientation)) + if (!_DrawButtonBackground(view, rect, updateRect, false, flags, borders, orientation)) HaikuControlLook::DrawButtonBackground(view, rect, updateRect, base, flags, borders, orientation); } @@ -80,7 +80,7 @@ void ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float radius, const rgb_color& base, uint32 flags, uint32 borders, orientation orientation) { - if (!_DrawButtonBackground(view, rect, updateRect, false, flags, orientation)) + if (!_DrawButtonBackground(view, rect, updateRect, false, flags, borders, orientation)) HaikuControlLook::DrawButtonBackground(view, rect, updateRect, radius, base, flags, borders, orientation); } @@ -91,23 +91,31 @@ ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& up float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius, const rgb_color& base, uint32 flags, uint32 borders, orientation orientation) { - if (!_DrawButtonBackground(view, rect, updateRect, false, flags, orientation)) + if (!_DrawButtonBackground(view, rect, updateRect, false, flags, borders, orientation)) HaikuControlLook::DrawButtonBackground(view, rect, updateRect, leftTopRadius, rightTopRadius,leftBottomRadius, rightBottomRadius, base, flags, borders, orientation); } -bool -ImageControlLook::_DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, - bool popupIndicator, uint32 flags, orientation orientation) +uint32 +ImageControlLook::_FlagsToState(uint32 flags) { - uint32 state = ICL_ACTIVE; + uint32 state = ICL_NORMAL; if (flags & B_DISABLED) state = ICL_DISABLED; - else if (flags & B_ACTIVATED) + else if (flags & (B_ACTIVATED | B_PARTIALLY_ACTIVATED | B_CLICKED)) state = ICL_ACTIVATED; - else if (flags & B_HOVER) + else if (flags & (B_HOVER | B_FOCUSED)) state = ICL_HOVER; + return state; +} + + +bool +ImageControlLook::_DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, + bool popupIndicator, uint32 flags, uint32 borders, orientation orientation) +{ + uint32 state = _FlagsToState(flags); BBitmap* tile = _Image("Button", ICL_MIDDLE, state); BBitmap* left = _Image("Button", ICL_LEFT, state); @@ -141,12 +149,12 @@ ImageControlLook::_DrawButtonBackground(BView* view, BRect& rect, const BRect& u view->DrawBitmap(tile, tileRect); BRect sideRect(0, 0, minX, rect.Height()); - if (left != NULL) + if (left != NULL && (borders & B_LEFT_BORDER)) view->DrawBitmap(left, sideRect); sideRect.left = maxX; sideRect.right = view->Bounds().right; - if (right != NULL) + if (right != NULL && (borders & B_RIGHT_BORDER)) view->DrawBitmap(right, sideRect); return true; diff --git a/ImageControlLook.h b/ImageControlLook.h index 549a18b..947918b 100644 --- a/ImageControlLook.h +++ b/ImageControlLook.h @@ -27,7 +27,7 @@ enum { }; enum { - ICL_ACTIVE, + ICL_NORMAL, ICL_INACTIVE, ICL_HOVER, ICL_DISABLED, @@ -35,7 +35,7 @@ enum { }; -const char* kStates[] = { "Active", "Inactive", "Hover", "Disabled", "Activated" }; +const char* kStates[] = { "Normal", "Inactive", "Hover", "Disabled", "Activated" }; const char* kSides[] = { "Middle", "Left", "Right" }; @@ -95,9 +95,11 @@ public: protected: bool _DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, bool popupIndicator, - uint32 flags, orientation orientation); + uint32 flags, uint32 borders, + orientation orientation); private: + uint32 _FlagsToState(uint32 flags); BBitmap* _Image(const char* type, uint32 side, uint32 state); const char* _ImagePath(const char* type, uint32 side, uint32 state); diff --git a/data/ImageThemes/OS-X-Leopard/Button/DisabledLeft b/data/ImageThemes/OS-X-Leopard/Button/DisabledLeft index 26a09db..d1efb48 100644 Binary files a/data/ImageThemes/OS-X-Leopard/Button/DisabledLeft and b/data/ImageThemes/OS-X-Leopard/Button/DisabledLeft differ diff --git a/data/ImageThemes/OS-X-Leopard/Button/DisabledMiddle b/data/ImageThemes/OS-X-Leopard/Button/DisabledMiddle index 93a5ffb..0770afb 100644 Binary files a/data/ImageThemes/OS-X-Leopard/Button/DisabledMiddle and b/data/ImageThemes/OS-X-Leopard/Button/DisabledMiddle differ diff --git a/data/ImageThemes/OS-X-Leopard/Button/DisabledRight b/data/ImageThemes/OS-X-Leopard/Button/DisabledRight index aa3f740..4d7a933 100644 Binary files a/data/ImageThemes/OS-X-Leopard/Button/DisabledRight and b/data/ImageThemes/OS-X-Leopard/Button/DisabledRight differ diff --git a/data/ImageThemes/OS-X-Leopard/Button/InactiveLeft b/data/ImageThemes/OS-X-Leopard/Button/InactiveLeft new file mode 100644 index 0000000..d504fdf Binary files /dev/null and b/data/ImageThemes/OS-X-Leopard/Button/InactiveLeft differ diff --git a/data/ImageThemes/OS-X-Leopard/Button/InactiveMiddle b/data/ImageThemes/OS-X-Leopard/Button/InactiveMiddle new file mode 100644 index 0000000..caf9e32 Binary files /dev/null and b/data/ImageThemes/OS-X-Leopard/Button/InactiveMiddle differ diff --git a/data/ImageThemes/OS-X-Leopard/Button/InactiveRight b/data/ImageThemes/OS-X-Leopard/Button/InactiveRight new file mode 100644 index 0000000..8303091 Binary files /dev/null and b/data/ImageThemes/OS-X-Leopard/Button/InactiveRight differ diff --git a/data/ImageThemes/OS-X-Leopard/Button/ActiveLeft b/data/ImageThemes/OS-X-Leopard/Button/NormalLeft similarity index 100% rename from data/ImageThemes/OS-X-Leopard/Button/ActiveLeft rename to data/ImageThemes/OS-X-Leopard/Button/NormalLeft diff --git a/data/ImageThemes/OS-X-Leopard/Button/ActiveMiddle b/data/ImageThemes/OS-X-Leopard/Button/NormalMiddle similarity index 100% rename from data/ImageThemes/OS-X-Leopard/Button/ActiveMiddle rename to data/ImageThemes/OS-X-Leopard/Button/NormalMiddle diff --git a/data/ImageThemes/OS-X-Leopard/Button/ActiveRight b/data/ImageThemes/OS-X-Leopard/Button/NormalRight similarity index 100% rename from data/ImageThemes/OS-X-Leopard/Button/ActiveRight rename to data/ImageThemes/OS-X-Leopard/Button/NormalRight diff --git a/data/ImageThemes/OS-X-Leopard/Notes.txt b/data/ImageThemes/OS-X-Leopard/Notes.txt new file mode 100644 index 0000000..1ae0ac5 --- /dev/null +++ b/data/ImageThemes/OS-X-Leopard/Notes.txt @@ -0,0 +1,5 @@ +Using GIMP… +Inactive: 15.0 force on eraser +Disabled: 30.0 force on eraser +Hover [Blue]: Light, 60.0 force on Air 2× +Actived [Blue]: Dark, 60.0 force on Air 2×