mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-24 19:21:52 +00:00
LibGUI: Set initial AbstractButton background/foreground color roles
Widgets should respect the background/foreground roles in a way that makes sense for the widget.
This commit is contained in:
parent
48647cc3ed
commit
18b6c47178
Notes:
sideshowbarker
2024-07-19 01:57:40 +09:00
Author: https://github.com/awesomekling
Commit: 18b6c47178
1 changed files with 4 additions and 1 deletions
|
@ -35,6 +35,9 @@ namespace GUI {
|
|||
AbstractButton::AbstractButton(const StringView& text)
|
||||
: m_text(text)
|
||||
{
|
||||
set_background_role(Gfx::ColorRole::Button);
|
||||
set_foreground_role(Gfx::ColorRole::ButtonText);
|
||||
|
||||
m_auto_repeat_timer = add<Core::Timer>();
|
||||
m_auto_repeat_timer->on_timeout = [this] {
|
||||
click();
|
||||
|
@ -172,7 +175,7 @@ void AbstractButton::paint_text(Painter& painter, const Gfx::IntRect& rect, cons
|
|||
|
||||
if (text().is_empty())
|
||||
return;
|
||||
painter.draw_text(clipped_rect, text(), font, text_alignment, palette().button_text(), Gfx::TextElision::Right);
|
||||
painter.draw_text(clipped_rect, text(), font, text_alignment, palette().color(foreground_role()), Gfx::TextElision::Right);
|
||||
if (is_focused())
|
||||
painter.draw_rect(clipped_rect.inflated(6, 4), palette().focus_outline());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue