diff --git a/doc/en/xml-ui-layouts.md b/doc/en/xml-ui-layouts.md index 5a4d7be4..6a739d16 100644 --- a/doc/en/xml-ui-layouts.md +++ b/doc/en/xml-ui-layouts.md @@ -42,6 +42,8 @@ Examples: - `ondoubleclick` - lua function called when you double click on an element. - `onfocus` - lua function called when focusing on an element. - `ondefocus` - lua function called when the element loses focus. +- `onmouseover` - lua function called when the cursor enters an element. +- `onmouseover` - lua function called when the cursor exits an element. - `tooltip` - tooltip text - `tooltip-delay` - tooltip show-up delay - `gravity` - automatic positioning of the element in the container. (Does not work in automatic containers like panel). Values: *top-left, top-center, top-right, center-left, center-center, center-right, bottom-left, bottom-center, bottom-right*. diff --git a/doc/ru/xml-ui-layouts.md b/doc/ru/xml-ui-layouts.md index b6efa7b2..3c5d1acc 100644 --- a/doc/ru/xml-ui-layouts.md +++ b/doc/ru/xml-ui-layouts.md @@ -46,6 +46,8 @@ - `ondoubleclick` - lua функция вызываемая при двойном нажатии на элемент. - `onfocus` - lua функция вызываемая при фокусировке на элемент. - `ondefocus` - lua функция вызываемая при потере фокуса элеметом. +- `onmouseover` - lua функция вызываемая при входе курсора в элемент. +- `onmouseover` - lua функция вызываемая при выходе курсора из элемента. - `tooltip` - текст всплывающей подсказки - `tooltip-delay` - задержка появления всплывающей подсказки - `gravity` - автоматическое позиционирование элемента в контейнере. (Не работает в автоматических контейнерах, как panel). Значения: *top-left, top-center, top-right, center-left, center-center, center-right, bottom-left, bottom-center, bottom-right*. 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