mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 11:35:07 +00:00
Demos: Start working on a simple WidgetGallery app.
It's good to have a place where we can try out all the different widgets. This needs some more work on a nice layout, and should also include more of the widgets. :^)
This commit is contained in:
parent
d0bc21b96f
commit
149b7f92a7
9 changed files with 126 additions and 3 deletions
|
@ -25,8 +25,11 @@ static const int s_box_height = 13;
|
|||
GCheckBox::GCheckBox(GWidget* parent)
|
||||
: GAbstractButton(parent)
|
||||
{
|
||||
if (!s_checked_bitmap)
|
||||
s_checked_bitmap = &CharacterBitmap::create_from_ascii(s_checked_bitmap_data, s_checked_bitmap_width, s_checked_bitmap_height).leak_ref();
|
||||
}
|
||||
|
||||
GCheckBox::GCheckBox(const String& text, GWidget* parent)
|
||||
: GAbstractButton(text, parent)
|
||||
{
|
||||
}
|
||||
|
||||
GCheckBox::~GCheckBox()
|
||||
|
@ -57,8 +60,11 @@ void GCheckBox::paint_event(GPaintEvent& event)
|
|||
if (is_being_pressed())
|
||||
painter.draw_rect(box_rect.shrunken(4, 4), Color::MidGray);
|
||||
|
||||
if (is_checked())
|
||||
if (is_checked()) {
|
||||
if (!s_checked_bitmap)
|
||||
s_checked_bitmap = &CharacterBitmap::create_from_ascii(s_checked_bitmap_data, s_checked_bitmap_width, s_checked_bitmap_height).leak_ref();
|
||||
painter.draw_bitmap(box_rect.shrunken(4, 4).location(), *s_checked_bitmap, foreground_color());
|
||||
}
|
||||
|
||||
if (!text().is_empty()) {
|
||||
painter.draw_text(text_rect, text(), TextAlignment::TopLeft, foreground_color());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue