Widgets: Rework event dispatching

This commit is contained in:
SirLynix
2022-07-20 13:36:21 +02:00
committed by Jérôme Leclercq
parent 05c78da22a
commit 0fcf24f336
14 changed files with 175 additions and 76 deletions

View File

@@ -34,13 +34,18 @@ namespace Nz
m_style->Layout(GetSize());
}
void ButtonWidget::OnMouseButtonPress(int /*x*/, int /*y*/, Mouse::Button button)
bool ButtonWidget::OnMouseButtonPress(int /*x*/, int /*y*/, Mouse::Button button)
{
if (button == Mouse::Left)
{
m_style->OnPress();
return true;
}
return false;
}
void ButtonWidget::OnMouseButtonRelease(int x, int y, Mouse::Button button)
bool ButtonWidget::OnMouseButtonRelease(int x, int y, Mouse::Button button)
{
if (button == Mouse::Left)
{
@@ -50,7 +55,11 @@ namespace Nz
// we don't want this to trigger the button, so double-check
if (IsInside(float(x), float(y)))
OnButtonTrigger(this);
return true;
}
return false;
}
void ButtonWidget::OnMouseEnter()