mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
Intense hacking on Widgets.
This commit is contained in:
parent
8c84f9749e
commit
6f37429f57
20 changed files with 290 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "Event.h"
|
||||
#include "Object.h"
|
||||
#include "Rect.h"
|
||||
|
||||
class Widget : public Object {
|
||||
public:
|
||||
|
@ -18,9 +19,25 @@ public:
|
|||
virtual void onMouseDown(MouseEvent&);
|
||||
virtual void onMouseUp(MouseEvent&);
|
||||
|
||||
Rect rect() const { return m_rect; }
|
||||
int x() const { return rect().x(); }
|
||||
int y() const { return rect().y(); }
|
||||
int width() const { return rect().width(); }
|
||||
int height() const { return rect().height(); }
|
||||
|
||||
void update();
|
||||
|
||||
struct HitTestResult {
|
||||
Widget* widget { nullptr };
|
||||
int localX { 0 };
|
||||
int localY { 0 };
|
||||
};
|
||||
HitTestResult hitTest(int x, int y);
|
||||
|
||||
virtual const char* className() const override { return "Widget"; }
|
||||
|
||||
void setRect(const Rect&);
|
||||
|
||||
private:
|
||||
int m_x { 0 };
|
||||
int m_y { 0 };
|
||||
Rect m_rect;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue