1
0
Disbranĉigi 0

Swap ICL_ACTIVE with ICL_NORMAL; new button images

This commit is contained in:
Jaidyn Ann 2022-06-12 10:15:17 -05:00
parent c19e142515
commit 0e8dc4a4d6
12 changed files with 32 additions and 17 deletions

View File

@ -40,7 +40,7 @@ void
ImageControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, ImageControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, const rgb_color& background, uint32 flags, uint32 borders) 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); 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, ImageControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, float radius,
const rgb_color& base, const rgb_color& background, uint32 flags, uint32 borders) 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, HaikuControlLook::DrawButtonFrame(view, rect, updateRect, radius, base, background, flags,
borders); borders);
} }
@ -60,7 +60,7 @@ ImageControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateR
float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius, float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius,
const rgb_color& base, const rgb_color& background, uint32 flags, uint32 borders) 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, HaikuControlLook::DrawButtonFrame(view, rect, updateRect, leftTopRadius, rightTopRadius,
leftBottomRadius, rightBottomRadius, base, background, flags, borders); leftBottomRadius, rightBottomRadius, base, background, flags, borders);
} }
@ -70,7 +70,7 @@ void
ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, uint32 flags, uint32 borders, orientation orientation) 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, HaikuControlLook::DrawButtonBackground(view, rect, updateRect, base, flags, borders,
orientation); orientation);
} }
@ -80,7 +80,7 @@ void
ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect,
float radius, const rgb_color& base, uint32 flags, uint32 borders, orientation orientation) 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, HaikuControlLook::DrawButtonBackground(view, rect, updateRect, radius, base, flags, borders,
orientation); orientation);
} }
@ -91,23 +91,31 @@ ImageControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& up
float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius, float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius,
const rgb_color& base, uint32 flags, uint32 borders, orientation orientation) 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, HaikuControlLook::DrawButtonBackground(view, rect, updateRect, leftTopRadius,
rightTopRadius,leftBottomRadius, rightBottomRadius, base, flags, borders, orientation); rightTopRadius,leftBottomRadius, rightBottomRadius, base, flags, borders, orientation);
} }
bool uint32
ImageControlLook::_DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, ImageControlLook::_FlagsToState(uint32 flags)
bool popupIndicator, uint32 flags, orientation orientation)
{ {
uint32 state = ICL_ACTIVE; uint32 state = ICL_NORMAL;
if (flags & B_DISABLED) if (flags & B_DISABLED)
state = ICL_DISABLED; state = ICL_DISABLED;
else if (flags & B_ACTIVATED) else if (flags & (B_ACTIVATED | B_PARTIALLY_ACTIVATED | B_CLICKED))
state = ICL_ACTIVATED; state = ICL_ACTIVATED;
else if (flags & B_HOVER) else if (flags & (B_HOVER | B_FOCUSED))
state = ICL_HOVER; 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* tile = _Image("Button", ICL_MIDDLE, state);
BBitmap* left = _Image("Button", ICL_LEFT, 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); view->DrawBitmap(tile, tileRect);
BRect sideRect(0, 0, minX, rect.Height()); BRect sideRect(0, 0, minX, rect.Height());
if (left != NULL) if (left != NULL && (borders & B_LEFT_BORDER))
view->DrawBitmap(left, sideRect); view->DrawBitmap(left, sideRect);
sideRect.left = maxX; sideRect.left = maxX;
sideRect.right = view->Bounds().right; sideRect.right = view->Bounds().right;
if (right != NULL) if (right != NULL && (borders & B_RIGHT_BORDER))
view->DrawBitmap(right, sideRect); view->DrawBitmap(right, sideRect);
return true; return true;

View File

@ -27,7 +27,7 @@ enum {
}; };
enum { enum {
ICL_ACTIVE, ICL_NORMAL,
ICL_INACTIVE, ICL_INACTIVE,
ICL_HOVER, ICL_HOVER,
ICL_DISABLED, 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" }; const char* kSides[] = { "Middle", "Left", "Right" };
@ -95,9 +95,11 @@ public:
protected: protected:
bool _DrawButtonBackground(BView* view, BRect& rect, bool _DrawButtonBackground(BView* view, BRect& rect,
const BRect& updateRect, bool popupIndicator, const BRect& updateRect, bool popupIndicator,
uint32 flags, orientation orientation); uint32 flags, uint32 borders,
orientation orientation);
private: private:
uint32 _FlagsToState(uint32 flags);
BBitmap* _Image(const char* type, uint32 side, uint32 state); BBitmap* _Image(const char* type, uint32 side, uint32 state);
const char* _ImagePath(const char* type, uint32 side, uint32 state); const char* _ImagePath(const char* type, uint32 side, uint32 state);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 184 B

View File

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 644 B

View File

@ -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×