mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
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. :^)
This commit is contained in:
parent
add93bf593
commit
b4fde72013
Notes:
sideshowbarker
2024-07-19 08:02:45 +09:00
Author: https://github.com/awesomekling
Commit: b4fde72013
6 changed files with 40 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue