mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
Add a CheckBox widget.
This commit is contained in:
parent
c7463aad11
commit
16576112b0
13 changed files with 177 additions and 36 deletions
|
@ -16,10 +16,10 @@ Widget::~Widget()
|
|||
{
|
||||
}
|
||||
|
||||
void Widget::setRect(const Rect& rect)
|
||||
void Widget::setWindowRelativeRect(const Rect& rect)
|
||||
{
|
||||
// FIXME: Make some kind of event loop driven ResizeEvent?
|
||||
m_rect = rect;
|
||||
m_relativeRect = rect;
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ Widget::HitTestResult Widget::hitTest(int x, int y)
|
|||
// FIXME: Care about z-order.
|
||||
for (auto* ch : children()) {
|
||||
auto* child = (Widget*)ch;
|
||||
if (child->rect().contains(x, y)) {
|
||||
return child->hitTest(x - child->rect().x(), y - child->rect().y());
|
||||
if (child->relativeRect().contains(x, y)) {
|
||||
return child->hitTest(x - child->relativeRect().x(), y - child->relativeRect().y());
|
||||
}
|
||||
}
|
||||
return { this, x, y };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue