add 'onmiddleclick' ui event

This commit is contained in:
MihailRis 2026-08-13 22:15:50 +03:00
parent 60106d4fb1
commit 44bdd57fe5
3 changed files with 4 additions and 0 deletions

View file

@ -79,6 +79,8 @@ void UINode::click(int, int) {
void UINode::clicked(Mousecode button) { void UINode::clicked(Mousecode button) {
if (button == Mousecode::BUTTON_2) { if (button == Mousecode::BUTTON_2) {
actions.notify(UIAction::RIGHT_CLICK, gui); actions.notify(UIAction::RIGHT_CLICK, gui);
} else if (button == Mousecode::BUTTON_3) {
actions.notify(UIAction::MIDDLE_CLICK, gui);
} }
} }

View file

@ -58,6 +58,7 @@ namespace gui {
FOCUS, FOCUS,
DEFOCUS, DEFOCUS,
RIGHT_CLICK, RIGHT_CLICK,
MIDDLE_CLICK,
MOUSE_OVER, MOUSE_OVER,
MOUSE_OUT, MOUSE_OUT,
MOUSE_ENTER, MOUSE_ENTER,

View file

@ -181,6 +181,7 @@ static void read_uinode(
register_action(node, reader, element, "onclick", UIAction::CLICK); register_action(node, reader, element, "onclick", UIAction::CLICK);
register_action(node, reader, element, "onrightclick", UIAction::RIGHT_CLICK); register_action(node, reader, element, "onrightclick", UIAction::RIGHT_CLICK);
register_action(node, reader, element, "onmiddleclick", UIAction::MIDDLE_CLICK);
register_action(node, reader, element, "onfocus", UIAction::FOCUS); register_action(node, reader, element, "onfocus", UIAction::FOCUS);
register_action(node, reader, element, "ondefocus", UIAction::DEFOCUS); register_action(node, reader, element, "ondefocus", UIAction::DEFOCUS);
register_action(node, reader, element, "ondoubleclick", UIAction::DOUBLE_CLICK); register_action(node, reader, element, "ondoubleclick", UIAction::DOUBLE_CLICK);