mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 03:35:07 +00:00
LibGUI: Support cycling through focusable widgets with Tab and Shift-Tab.
This commit is contained in:
parent
01ffcdfa31
commit
ad731cc08f
10 changed files with 82 additions and 8 deletions
|
@ -60,9 +60,15 @@ void GButton::paint_event(GPaintEvent& event)
|
|||
content_rect.move_by(m_icon->width() + 4, 0);
|
||||
content_rect.set_width(content_rect.width() - m_icon->width() - 4);
|
||||
}
|
||||
if (is_enabled())
|
||||
if (is_enabled()) {
|
||||
painter.draw_text(content_rect, m_caption, font, text_alignment(), foreground_color(), TextElision::Right);
|
||||
else {
|
||||
if (is_focused()) {
|
||||
Rect focus_rect = { 0, 0, font.width(m_caption), font.glyph_height() };
|
||||
focus_rect.inflate(6, 4);
|
||||
focus_rect.center_within(content_rect);
|
||||
painter.draw_rect(focus_rect, Color(140, 140, 140));
|
||||
}
|
||||
} else {
|
||||
painter.draw_text(content_rect.translated(1, 1), m_caption, font, text_alignment(), Color::White, TextElision::Right);
|
||||
painter.draw_text(content_rect, m_caption, font, text_alignment(), Color::from_rgb(0x808080), TextElision::Right);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue