mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
WindowServer: Add a WSButton class and make the window close buttons use it.
This commit is contained in:
parent
9fbac66a91
commit
3155a2e128
5 changed files with 112 additions and 50 deletions
32
Servers/WindowServer/WSButton.h
Normal file
32
Servers/WindowServer/WSButton.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Retained.h>
|
||||
|
||||
class CharacterBitmap;
|
||||
class Painter;
|
||||
class WSMouseEvent;
|
||||
|
||||
class WSButton {
|
||||
public:
|
||||
WSButton(Retained<CharacterBitmap>&&, Function<void()>&& on_click_handler);
|
||||
~WSButton();
|
||||
|
||||
Rect rect() const { return m_rect; }
|
||||
void set_rect(const Rect& rect) { m_rect = rect; }
|
||||
|
||||
void paint(Painter&);
|
||||
|
||||
void on_mouse_event(const WSMouseEvent&);
|
||||
|
||||
Function<void()> on_click;
|
||||
|
||||
bool is_visible() const { return m_visible; }
|
||||
|
||||
private:
|
||||
Rect m_rect;
|
||||
Retained<CharacterBitmap> m_bitmap;
|
||||
bool m_pressed { false };
|
||||
bool m_visible { true };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue