34GUIElementController::GUIElementController(
GUINode* node)
38 this->
disabled = required_dynamic_cast<GUIElementNode*>(
node)->isDisabled();
52 auto& nodeConditions = required_dynamic_cast<GUIElementNode*>(
node)->getActiveConditions();
76 auto elementNode = required_dynamic_cast<GUIElementNode*>(this->node);
78 event->setProcessed(
true);
79 if (event->
getType() == GUIMouseEvent::MOUSEEVENT_PRESSED) {
82 if (elementNode->isFocusable() ==
true) {
86 if (event->
getType() == GUIMouseEvent::MOUSEEVENT_DRAGGED) {
89 if (event->
getType() == GUIMouseEvent::MOUSEEVENT_RELEASED) {
92 auto now = Time::getCurrentMillis();
95 auto onMouseDoubleClickExpression = elementNode->getOnMouseDoubleClickExpression();
96 if (onMouseDoubleClickExpression.size() > 0) {
99 auto onMouseClickExpression = elementNode->getOnMouseClickExpression();
105 auto onMouseClickExpression = elementNode->getOnMouseClickExpression();
111 auto onMouseDoubleClickExpression = elementNode->getOnMouseDoubleClickExpression();
112 if (onMouseDoubleClickExpression.size() > 0) {
115 auto onMouseClickExpression = elementNode->getOnMouseClickExpression();
123 if (event->
getType() == GUIMouseEvent::MOUSEEVENT_PRESSED) {
126 event->setProcessed(
true);
130 event->setProcessed(
true);
132 if (event->
getType() == GUIMouseEvent::MOUSEEVENT_MOVED) {
133 if (elementNode->isEventBelongingToNode(event) ==
true) {
134 if (elementNode->getOptionValue(
"mouse-cursor") ==
"hand") Application::setMouseCursor(
MOUSE_CURSOR_HAND);
138 auto onMouseOverExpression = elementNode->getOnMouseOverExpression();
141 if (elementNode->getOptionValue(
"mouse-cursor") ==
"hand") Application::setMouseCursor(
MOUSE_CURSOR_NORMAL);
143 auto onMouseOutExpression = elementNode->getOnMouseOutExpression();
155 case GUIKeyboardEvent::KEYCODE_SPACE: {
156 event->setProcessed(
true);
157 if (event->
getType() == GUIKeyboardEvent::KEYBOARDEVENT_KEY_PRESSED) {
158 auto onMouseClickExpression = required_dynamic_cast<GUIElementNode*>(
node)->getOnMouseClickExpression();
174 auto onInitializeExpression = required_dynamic_cast<GUIElementNode*>(
node)->getOnInitializeExpression();
182 auto now = Time::getCurrentMillis();
185 auto onMouseClickExpression = required_dynamic_cast<GUIElementNode*>(
node)->getOnMouseClickExpression();
#define MOUSE_CURSOR_NORMAL
#define MOUSE_CURSOR_HAND
Application base class, please make sure to allocate application on heap to have correct application ...
void addMouseOutCandidateElementNode(GUINode *node)
Add node that is a possible mouse out candidate as it received a mouse over.
void setFoccussedNode(GUIElementNode *newFoccussedNode)
Set focussed node.
GUIKeyboardEventType getType()
GUIMouseEventType getType()
void onFocusGained() override
On focus gained.
void dispose() override
Dispose controller.
void postLayout() override
Post layout event.
void initialize() override
Initialize controller after element has been created.
void handleKeyboardEvent(GUIKeyboardEvent *event) override
Handle keyboard event.
void onFocusLost() override
On focus lost.
void setValue(const MutableString &value) override
Set value.
void handleMouseEvent(GUINode *node, GUIMouseEvent *event) override
Handle mouse event.
void tick() override
Tick method will be executed once per frame.
static STATIC_DLL_IMPEXT string CONDITION_DISABLED
static STATIC_DLL_IMPEXT string CONDITION_ENABLED
void setDisabled(bool disabled) override
Set disabled.
const MutableString & getValue() override
bool isDisabled() override
void onSubTreeChange() override
On sub tree change.
static constexpr int64_t TIME_DOUBLECLICK
static STATIC_DLL_IMPEXT string CONDITION_ONMOUSEOVER
static STATIC_DLL_IMPEXT string CONDITION_CLICK
static void executeExpression(GUIScreenNode *screenNode, const string &expression)
Execute expression.
GUI element node conditions.
GUI node controller base class.
bool isEventBelongingToNode(GUIMouseEvent *event, Vector2 &position)
Is event belonging to node.
GUIScreenNode * getScreenNode()
GUI screen node that represents a screen that can be rendered via GUI system.
void delegateMouseOver(GUIElementNode *node)
Delegate mouse over event.
void delegateActionPerformed(GUIActionListenerType type, GUIElementNode *node)
Delegate action performed.
void delegateContextMenuRequest(GUIElementNode *node, int mouseX, int mouseY)
Delegate mouse over event.
void addTickNode(GUINode *node)
Add tick node, registered node controllers will have a tick once per frame.