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

Services: Convert WindowFrame button bitmaps to themable PNGs

Custom buttons can now be set using TitleButtonIcons under the
Paths group in themes. WindowFrame recognizes window-close.png,
window-minimize.png, window-maximize.png and window-restore.png
filenames.
This commit is contained in:
thankyouverycool 2020-07-29 16:22:05 -04:00 committed by Andreas Kling
parent 41aacdf815
commit c815fa7f47
5 changed files with 75 additions and 92 deletions

View file

@ -27,10 +27,9 @@
#pragma once
#include <AK/Function.h>
#include <AK/NonnullRefPtr.h>
#include <AK/Weakable.h>
#include <LibGfx/Rect.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
namespace WindowServer {
@ -39,7 +38,7 @@ class WindowFrame;
class Button : public Weakable<Button> {
public:
Button(WindowFrame&, NonnullRefPtr<Gfx::CharacterBitmap>&&, Function<void(Button&)>&& on_click_handler);
Button(WindowFrame&, Function<void(Button&)>&& on_click_handler);
~Button();
Gfx::IntRect relative_rect() const { return m_relative_rect; }
@ -56,12 +55,12 @@ public:
bool is_visible() const { return m_visible; }
void set_bitmap(const Gfx::CharacterBitmap& bitmap) { m_bitmap = bitmap; }
void set_icon(const Gfx::Bitmap& icon) { m_icon = icon; }
private:
WindowFrame& m_frame;
Gfx::IntRect m_relative_rect;
NonnullRefPtr<Gfx::CharacterBitmap> m_bitmap;
RefPtr<Gfx::Bitmap> m_icon;
bool m_pressed { false };
bool m_visible { true };
bool m_hovered { false };