mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
Launcher: Factor the app buttons into a LaunchButton class.
Added some LibGUI helpers while I'm at it.
This commit is contained in:
parent
bf766fc12c
commit
6d7f000ffc
5 changed files with 39 additions and 36 deletions
|
@ -5,7 +5,7 @@
|
|||
#include <AK/Function.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
|
||||
class GButton final : public GWidget {
|
||||
class GButton : public GWidget {
|
||||
public:
|
||||
explicit GButton(GWidget* parent);
|
||||
virtual ~GButton() override;
|
||||
|
|
|
@ -56,7 +56,11 @@ public:
|
|||
virtual const char* class_name() const override { return "GWidget"; }
|
||||
|
||||
void set_relative_rect(const Rect&);
|
||||
|
||||
void move_to(const Point& point) { set_relative_rect({ point, relative_rect().size() }); }
|
||||
void move_to(int x, int y) { move_to({ x, y }); }
|
||||
void resize(const Size& size) { set_relative_rect({ relative_rect().location(), size }); }
|
||||
void resize(int width, int height) { resize({ width, height }); }
|
||||
|
||||
Color background_color() const { return m_background_color; }
|
||||
Color foreground_color() const { return m_foreground_color; }
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
|
||||
Rect rect() const;
|
||||
void set_rect(const Rect&);
|
||||
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
|
||||
|
||||
Point position() const { return rect().location(); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue