summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-24 23:00:07 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-24 23:00:36 +0200
commitac7e02d9841295e45f356d209e5482e05ea9acc9 (patch)
treea36818847b07823e6b80552cc76ece6fcd03a273 /LibGUI
parentb0ccd04a9c25b650260b707ca8f23afc33c25300 (diff)
downloadserenity-ac7e02d9841295e45f356d209e5482e05ea9acc9.zip
GLabel: Paint the text with a disabled look when appropriate.
Also turn on right-side text elision in all cases by default.
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GLabel.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/LibGUI/GLabel.cpp b/LibGUI/GLabel.cpp
index 35ec7086fc..003a4d2132 100644
--- a/LibGUI/GLabel.cpp
+++ b/LibGUI/GLabel.cpp
@@ -45,14 +45,20 @@ void GLabel::paint_event(GPaintEvent& event)
painter.blit(icon_location, *m_icon, m_icon->rect());
}
}
- if (!text().is_empty()) {
- int indent = 0;
- if (frame_thickness() > 0)
- indent = font().glyph_width('x') / 2;
- auto text_rect = frame_inner_rect();
- text_rect.move_by(indent, 0);
- text_rect.set_width(text_rect.width() - indent * 2);
- painter.draw_text(text_rect, text(), m_text_alignment, foreground_color());
+ if (text().is_empty())
+ return;
+ int indent = 0;
+ if (frame_thickness() > 0)
+ indent = font().glyph_width('x') / 2;
+ auto text_rect = frame_inner_rect();
+ text_rect.move_by(indent, 0);
+ text_rect.set_width(text_rect.width() - indent * 2);
+
+ if (is_enabled()) {
+ painter.draw_text(text_rect, text(), m_text_alignment, foreground_color(), TextElision::Right);
+ } else {
+ painter.draw_text(text_rect.translated(1, 1), text(), font(), text_alignment(), Color::White, TextElision::Right);
+ painter.draw_text(text_rect, text(), font(), text_alignment(), Color::from_rgb(0x808080), TextElision::Right);
}
}