1
0
Disbranĉigi 0

Add DrawRadioButton()

This commit is contained in:
Jaidyn Ann 2022-06-12 19:42:01 -05:00
parent d0a47a5bec
commit 1b491b0a35
2 changed files with 29 additions and 0 deletions

View File

@ -16,8 +16,11 @@ ImageControlLook::ImageControlLook(image_id id)
{
for (int i = 0; i < 3; i++)
fButton[i].fill(NULL);
fCheckBox_Checked.fill(NULL);
fCheckBox_Unchecked.fill(NULL);
fRadioButton_Checked.fill(NULL);
fRadioButton_Unchecked.fill(NULL);
fSliderThumb.fill(NULL);
fSliderTriangle.fill(NULL);
@ -111,6 +114,21 @@ ImageControlLook::DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect
}
void
ImageControlLook::DrawRadioButton(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, uint32 flags)
{
bool drawn = false;
if (((BControl*)view)->Value() == B_CONTROL_ON)
drawn = _DrawImage("RadioButton-Checked", _FlagsToState(flags & ~B_ACTIVATED), view, rect);
else
drawn = _DrawImage("RadioButton-Unchecked", _FlagsToState(flags), view, rect);
if (!drawn)
HaikuControlLook::DrawRadioButton(view, rect, updateRect, base, flags);
}
void
ImageControlLook::DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect,
const rgb_color& base, uint32 flags, orientation orientation)
@ -216,6 +234,10 @@ ImageControlLook::_Image(const char* type, uint32 state, uint32 side)
nosideList = &fCheckBox_Unchecked;
else if (strcmp(type, "CheckBox-Checked") == 0)
nosideList = &fCheckBox_Checked;
else if (strcmp(type, "RadioButton-Unchecked") == 0)
nosideList = &fRadioButton_Unchecked;
else if (strcmp(type, "RadioButton-Checked") == 0)
nosideList = &fRadioButton_Checked;
else if (strcmp(type, "SliderThumb") == 0)
nosideList = &fSliderThumb;
else if (strcmp(type, "SliderTriangle") == 0)

View File

@ -102,6 +102,11 @@ public:
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 DrawSliderThumb(BView* view, BRect& rect,
const BRect& updateRect,
const rgb_color& base, uint32 flags,
@ -135,6 +140,8 @@ private:
SidedImages fButton;
UnsidedImages fCheckBox_Checked;
UnsidedImages fCheckBox_Unchecked;
UnsidedImages fRadioButton_Checked;
UnsidedImages fRadioButton_Unchecked;
UnsidedImages fSliderThumb;
UnsidedImages fSliderTriangle;
};