Starting work on moving GUI to event system (doesnt compile)
This commit is contained in:
parent
f1a855edc3
commit
ef7dfcef05
69 changed files with 4296 additions and 3709 deletions
34
src/GUIStuff/Elements/LayoutElement.cpp
Normal file
34
src/GUIStuff/Elements/LayoutElement.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "LayoutElement.hpp"
|
||||
|
||||
namespace GUIStuff {
|
||||
|
||||
LayoutElement::LayoutElement(GUIManager& gui): Element(gui) {}
|
||||
|
||||
void LayoutElement::layout(const std::function<void()>& layout, const Callbacks& c) {
|
||||
this->c = c;
|
||||
layout();
|
||||
}
|
||||
|
||||
bool LayoutElement::input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button, bool mouseHovering) {
|
||||
if(c.mouseButton)
|
||||
return c.mouseButton(button, mouseHovering);
|
||||
return Element::input_mouse_button_callback(button, mouseHovering);
|
||||
}
|
||||
|
||||
bool LayoutElement::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion, bool mouseHovering) {
|
||||
if(c.mouseMotion)
|
||||
return c.mouseMotion(motion, mouseHovering);
|
||||
return Element::input_mouse_motion_callback(motion, mouseHovering);
|
||||
}
|
||||
|
||||
bool LayoutElement::input_mouse_wheel_callback(const InputManager::MouseWheelCallbackArgs& wheel, bool mouseHovering) {
|
||||
if(c.mouseWheel)
|
||||
return c.mouseWheel(wheel, mouseHovering);
|
||||
return Element::input_mouse_wheel_callback(wheel, mouseHovering);
|
||||
}
|
||||
|
||||
void LayoutElement::input_key_callback(const InputManager::KeyCallbackArgs& key) {
|
||||
if(c.key) c.key(key);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue