Implement mouse event propagation

This commit is contained in:
Magnus Norddahl 2024-01-10 23:06:05 +01:00
commit 1697c4fc5d
18 changed files with 135 additions and 60 deletions

View file

@ -55,19 +55,21 @@ void CheckboxLabel::OnPaint(Canvas* canvas)
canvas->drawText(Point(14.0, GetHeight() - 5.0), Colorf::fromRgba8(255, 255, 255), text);
}
void CheckboxLabel::OnMouseDown(const Point& pos, int key)
bool CheckboxLabel::OnMouseDown(const Point& pos, int key)
{
mouseDownActive = true;
SetFocus();
return true;
}
void CheckboxLabel::OnMouseUp(const Point& pos, int key)
bool CheckboxLabel::OnMouseUp(const Point& pos, int key)
{
if (mouseDownActive)
{
Toggle();
}
mouseDownActive = false;
return true;
}
void CheckboxLabel::OnMouseLeave()