From 05d6fbd9951d35adda0e0c023dfd89b92a86b89d Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 25 Nov 2025 23:57:19 +0300 Subject: [PATCH 1/2] add onmouseover, onmouseout ui events & cleanup --- src/graphics/ui/elements/Button.cpp | 2 +- src/graphics/ui/elements/SelectBox.cpp | 6 ++--- src/graphics/ui/elements/UINode.cpp | 27 +++++-------------- src/graphics/ui/elements/UINode.hpp | 14 +++++----- src/graphics/ui/gui_xml.cpp | 36 ++++++++++---------------- 5 files changed, 32 insertions(+), 53 deletions(-) diff --git a/src/graphics/ui/elements/Button.cpp b/src/graphics/ui/elements/Button.cpp index 2fe6fc6a..c951e6c3 100644 --- a/src/graphics/ui/elements/Button.cpp +++ b/src/graphics/ui/elements/Button.cpp @@ -42,7 +42,7 @@ Button::Button( } if (action) { - listenClick(action); + listenAction(UIAction::CLICK, action); } setScrollable(false); diff --git a/src/graphics/ui/elements/SelectBox.cpp b/src/graphics/ui/elements/SelectBox.cpp index 7273294b..97a899e6 100644 --- a/src/graphics/ui/elements/SelectBox.cpp +++ b/src/graphics/ui/elements/SelectBox.cpp @@ -19,14 +19,14 @@ SelectBox::SelectBox( : Button(gui, selected.text, padding, nullptr, glm::vec2(contentWidth, -1)), options(std::move(options)) { - listenClick([this](GUI& gui) { + listenAction(UIAction::CLICK, [this](GUI& gui) { auto panel = std::make_shared(gui, getSize()); panel->setPos(calcPos() + glm::vec2(0, size.y)); for (const auto& option : this->options) { auto button = std::make_shared