LibGUI+FileManager: Add a GIcon class to support multi-size icons.

A GIcon can contain any number of bitmaps internally, and will give you
the best fitting icon when you call bitmap_for_size().
This commit is contained in:
Andreas Kling 2019-03-24 04:28:36 +01:00
parent 7e54fdce99
commit 86413a6f5a
Notes: sideshowbarker 2024-07-19 14:57:23 +09:00
12 changed files with 165 additions and 23 deletions

View file

@ -141,6 +141,9 @@ void GTableView::paint_event(GPaintEvent& event)
auto data = model()->data(cell_index);
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());
} else {
Color text_color;
if (is_selected_row)