1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:47:44 +00:00

WindowServer+LibGUI: Add ability to set per-window icons.

The icons are passed around as filesystem paths for now, since the shared
memory bitmaps only support 2 sides.
This commit is contained in:
Andreas Kling 2019-04-13 16:59:55 +02:00
parent 7a74b76769
commit c09c114d77
19 changed files with 151 additions and 16 deletions

View file

@ -63,11 +63,27 @@ public:
void set_minimized(bool minimized) { m_minimized = minimized; }
bool is_minimized() const { return m_minimized; }
String icon_path() const { return m_icon_path; }
void set_icon_path(const String& icon_path)
{
if (m_icon_path == icon_path)
return;
auto icon = GraphicsBitmap::load_from_file(icon_path);
if (!icon)
return;
m_icon_path = icon_path;
m_icon = move(icon);
}
const GraphicsBitmap* icon() const { return m_icon.ptr(); }
private:
WindowIdentifier m_identifier;
String m_title;
Rect m_rect;
GButton* m_button { nullptr };
String m_icon_path;
RetainPtr<GraphicsBitmap> m_icon;
bool m_active { false };
bool m_minimized { false };
};