diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-30 19:57:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-30 19:57:44 +0200 |
commit | b4fde7201328fb73e7789ebf8bf6ee8c47b4cb64 (patch) | |
tree | 50213d4a244b81a5a7d2327d4155d64a84fbb4a6 /Libraries/LibGUI/TableView.cpp | |
parent | add93bf593c5cb079c02f176f78d4966c0d54b0e (diff) | |
download | serenity-b4fde7201328fb73e7789ebf8bf6ee8c47b4cb64.zip |
LibGUI: Brighten icons when hovering items in item views
View classes now track their hovered item and paint them in a slightly
brighter shade to liven up the user interface. :^)
Diffstat (limited to 'Libraries/LibGUI/TableView.cpp')
-rw-r--r-- | Libraries/LibGUI/TableView.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Libraries/LibGUI/TableView.cpp b/Libraries/LibGUI/TableView.cpp index 3522f08464..30204b6087 100644 --- a/Libraries/LibGUI/TableView.cpp +++ b/Libraries/LibGUI/TableView.cpp @@ -26,7 +26,6 @@ #include <AK/StringBuilder.h> #include <Kernel/KeyCode.h> -#include <LibGfx/Palette.h> #include <LibGUI/Action.h> #include <LibGUI/Menu.h> #include <LibGUI/Model.h> @@ -35,6 +34,7 @@ #include <LibGUI/TableView.h> #include <LibGUI/TextBox.h> #include <LibGUI/Window.h> +#include <LibGfx/Palette.h> namespace GUI { @@ -119,8 +119,12 @@ void TableView::paint_event(PaintEvent& event) if (data.is_bitmap()) { painter.blit(cell_rect.location(), data.as_bitmap(), data.as_bitmap().rect()); } else if (data.is_icon()) { - if (auto bitmap = data.as_icon().bitmap_for_size(16)) - painter.blit(cell_rect.location(), *bitmap, bitmap->rect()); + if (auto bitmap = data.as_icon().bitmap_for_size(16)) { + if (m_hovered_index.is_valid() && cell_index.row() == m_hovered_index.row()) + painter.blit_brightened(cell_rect.location(), *bitmap, bitmap->rect()); + else + painter.blit(cell_rect.location(), *bitmap, bitmap->rect()); + } } else { Color text_color; if (is_selected_row) |