summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/IconView.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-10-27 16:12:54 +0100
committerAndreas Kling <kling@serenityos.org>2020-10-27 16:12:54 +0100
commit5030f1ed4bb3c999ebbf5cdcf99df4aabe73881f (patch)
tree2d49e647dbe46b4c29fd80db37095540c96ed208 /Libraries/LibGUI/IconView.cpp
parent272af7685bd20ebab35af9bf4024b48ff80da011 (diff)
downloadserenity-5030f1ed4bb3c999ebbf5cdcf99df4aabe73881f.zip
LibGUI: Paint a focus rect around the cursor index in IconView
This makes the cursor actually visible to the user, and looks rather neat if I may say so. :^)
Diffstat (limited to 'Libraries/LibGUI/IconView.cpp')
-rw-r--r--Libraries/LibGUI/IconView.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Libraries/LibGUI/IconView.cpp b/Libraries/LibGUI/IconView.cpp
index b57bd40db1..41f7803536 100644
--- a/Libraries/LibGUI/IconView.cpp
+++ b/Libraries/LibGUI/IconView.cpp
@@ -523,6 +523,10 @@ void IconView::paint_event(PaintEvent& event)
auto font = font_for_index(item_data.index);
painter.fill_rect(item_data.text_rect, background_color);
+ if (is_focused() && item_data.index == cursor_index()) {
+ painter.draw_rect(item_data.text_rect, widget_background_color);
+ painter.draw_focus_rect(item_data.text_rect, palette().focus_outline());
+ }
if (!item_data.wrapped_text_lines.is_empty()) {
// Item text would not fit in the item text rect, let's break it up into lines..