2026-03-27 09:51:53 +03:00
|
|
|
#include "LayoutElement.hpp"
|
2026-03-31 17:33:09 +03:00
|
|
|
#include "Helpers/ConvertVec.hpp"
|
2026-04-24 10:06:45 +03:00
|
|
|
#include "../GUIManager.hpp"
|
2026-03-27 09:51:53 +03:00
|
|
|
|
|
|
|
|
namespace GUIStuff {
|
|
|
|
|
|
|
|
|
|
LayoutElement::LayoutElement(GUIManager& gui): Element(gui) {}
|
|
|
|
|
|
2026-04-02 21:57:26 +03:00
|
|
|
void LayoutElement::layout(const Clay_ElementId& id, const std::function<void(LayoutElement*, const Clay_ElementId&)>& layout, const Callbacks& c) {
|
2026-03-27 09:51:53 +03:00
|
|
|
this->c = c;
|
2026-04-02 21:57:26 +03:00
|
|
|
layout(this, id);
|
2026-03-27 09:51:53 +03:00
|
|
|
}
|
|
|
|
|
|
2026-04-02 21:57:26 +03:00
|
|
|
void LayoutElement::input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button) {
|
|
|
|
|
if(c.mouseButton) c.mouseButton(this, button);
|
2026-03-27 09:51:53 +03:00
|
|
|
}
|
|
|
|
|
|
2026-04-02 21:57:26 +03:00
|
|
|
void LayoutElement::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) {
|
|
|
|
|
if(c.mouseMotion) c.mouseMotion(this, motion);
|
2026-03-27 09:51:53 +03:00
|
|
|
}
|
|
|
|
|
|
2026-04-02 21:57:26 +03:00
|
|
|
void LayoutElement::input_mouse_wheel_callback(const InputManager::MouseWheelCallbackArgs& wheel) {
|
|
|
|
|
if(c.mouseWheel) c.mouseWheel(this, wheel);
|
2026-03-27 09:51:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LayoutElement::input_key_callback(const InputManager::KeyCallbackArgs& key) {
|
2026-04-02 21:57:26 +03:00
|
|
|
if(c.key) c.key(this, key);
|
2026-03-27 09:51:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|