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

LibGUI: Start working on a GScrollBar.

This widget is far from finished, but it's off to a good start.
Also added a GResizeEvent and GWidget::resize_event() so that widgets
can react to being resized.
This commit is contained in:
Andreas Kling 2019-02-09 11:19:38 +01:00
parent 4d5fe39494
commit 1f355f2a79
11 changed files with 231 additions and 5 deletions

View file

@ -17,6 +17,7 @@ public:
virtual void event(GEvent&) override;
virtual void paint_event(GPaintEvent&);
virtual void resize_event(GResizeEvent&);
virtual void show_event(GShowEvent&);
virtual void hide_event(GHideEvent&);
virtual void keydown_event(GKeyEvent&);
@ -56,6 +57,7 @@ public:
virtual const char* class_name() const override { return "GWidget"; }
void set_relative_rect(const Rect&);
void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); }
void move_to(const Point& point) { set_relative_rect({ point, relative_rect().size() }); }
void move_to(int x, int y) { move_to({ x, y }); }
@ -97,6 +99,8 @@ public:
bool global_cursor_tracking() const;
private:
void handle_paint_event(GPaintEvent&);
GWindow* m_window { nullptr };
Rect m_relative_rect;