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

WindowServer: Support hover icons for title buttons

This allows adding "-hover.png" variants of the title button icons.
This can be useful for themes which use the TitleButtonsIconOnly
flag, which otherwise don't have a way of showing the hover state.
This commit is contained in:
MacDue 2022-05-02 21:34:33 +01:00 committed by Linus Groh
parent 2cf36a1ca2
commit 44c0672d59
3 changed files with 43 additions and 22 deletions

View file

@ -40,7 +40,12 @@ public:
bool is_visible() const { return m_visible; }
void set_icon(RefPtr<MultiScaleBitmaps> const& icon) { m_icon = icon; }
struct Icon {
RefPtr<MultiScaleBitmaps> bitmap { nullptr };
RefPtr<MultiScaleBitmaps> hover_bitmap { nullptr };
};
void set_icon(Icon const& icon) { m_icon = icon; }
enum class Style {
Normal,
@ -52,7 +57,7 @@ public:
private:
WindowFrame& m_frame;
Gfx::IntRect m_relative_rect;
RefPtr<MultiScaleBitmaps> m_icon;
Icon m_icon;
bool m_pressed { false };
bool m_visible { true };
bool m_hovered { false };