mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
WindowServer: Make WSWindowFrame and WSButton deal in relative coordinates.
This was a bit painful to get right. The code is a lot more pleasant to deal with now that all coordinates are relative to their local system instead of being absolute screen coordinates.
This commit is contained in:
parent
2ac2d79a8e
commit
0d60c56b51
6 changed files with 67 additions and 79 deletions
|
@ -13,8 +13,10 @@ 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; }
|
||||
Rect relative_rect() const { return m_relative_rect; }
|
||||
void set_relative_rect(const Rect& rect) { m_relative_rect = rect; }
|
||||
|
||||
Rect rect() const { return { { }, m_relative_rect.size() }; }
|
||||
|
||||
void paint(Painter&);
|
||||
|
||||
|
@ -25,7 +27,7 @@ public:
|
|||
bool is_visible() const { return m_visible; }
|
||||
|
||||
private:
|
||||
Rect m_rect;
|
||||
Rect m_relative_rect;
|
||||
Retained<CharacterBitmap> m_bitmap;
|
||||
bool m_pressed { false };
|
||||
bool m_visible { true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue