mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 09:06:23 +02:00
Add button click and checkbox toggle handlers for UI controls
This commit is contained in:
@@ -18,8 +18,11 @@ public class Button() : Control("Button")
|
||||
set => SetProperty(nameof(TextColor), ref field, value);
|
||||
} = Color.Black;
|
||||
|
||||
public void Click()
|
||||
public override void HandleMouseEvent(MouseEvent mouseEvent)
|
||||
{
|
||||
OnClick?.Invoke(this, EventArgs.Empty);
|
||||
if (mouseEvent.Type == MouseEventType.ButtonDown && mouseEvent.Button == MouseButton.Left)
|
||||
{
|
||||
OnClick?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,12 @@ public class CheckBox() : Control("CheckBox")
|
||||
get;
|
||||
set => SetProperty(nameof(TextColor), ref field, value);
|
||||
} = Color.White;
|
||||
|
||||
public override void HandleMouseEvent(MouseEvent mouseEvent)
|
||||
{
|
||||
if (mouseEvent.Type == MouseEventType.ButtonDown && mouseEvent.Button == MouseButton.Left)
|
||||
{
|
||||
IsChecked = !IsChecked;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user