TDME2  1.9.200
GUINode.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <array>
4 #include <memory>
5 #include <string>
6 #include <unordered_map>
7 #include <unordered_set>
8 #include <vector>
9 
10 #include <tdme/tdme.h>
11 #include <tdme/engine/fwd-tdme.h>
15 #include <tdme/gui/fwd-tdme.h>
27 #include <tdme/math/Vector2.h>
29 
30 using std::array;
31 using std::string;
32 using std::unique_ptr;
33 using std::unordered_map;
34 using std::unordered_set;
35 using std::vector;
36 
58 
59 /**
60  * GUI node base class
61  * @author Andreas Drewke
62  */
64 {
65  friend class tdme::gui::GUI;
66  friend class GUIElementNode;
67  friend class GUIImageNode;
68  friend class GUILayerNode;
69  friend class GUILayoutNode;
70  friend class GUIParentNode;
71  friend class GUIScreenNode;
72  friend class GUITableNode;
73  friend class GUITableCellNode;
74  friend class GUITableRowNode;
78  friend class GUINodeConditions;
79  friend class GUINode_Flow;
84 
85 private:
87 
88  /**
89  * Determine element node dependencies
90  * @param elementNodeDependencies element node dependencies
91  */
92  void cfDetermineElementNodeDependencies(vector<string>& elementNodeDependencies);
93 
94  /**
95  * Parse condition function term
96  * @param term term
97  * @param function function
98  * @param arguments function arguments
99  */
100  void cfParse(const string& term, string& function, vector<string>& arguments);
101 
102  /**
103  * Call condition function with arguments
104  * @param elementNode element node to work with
105  * @param function function to be called
106  * @param arguments function arguments
107  * @return condition met
108  */
109  bool cfCall(GUIElementNode* elementNode, const string& function, const vector<string>& arguments);
110 
111  /**
112  * Determine element node dependencies - Call condition function with arguments
113  * @param function function to be called
114  * @param arguments function arguments
115  * @param elementNodeDependencies element node dependencies
116  */
117  void cfCallDetermineElementNodeDependencies(const string& function, const vector<string>& arguments, vector<string>& elementNodeDependencies);
118 
119  /**
120  * Condition function: empty
121  * @param arguments arguments
122  * Argument should look like 'test', "test", '', "", 123, 0, 123.4, 0.0 for now
123  * Arguments or OR connected
124  * @return if 1 argument has not been empty
125  */
126  bool cfEmpty(const vector<string>& arguments);
127 
128  /**
129  * Condition function: has condition
130  * @param elementNode element node to work with
131  * @param arguments arguments
132  * Format of arguments: [elementid.]condition
133  * Arguments or OR connected
134  * @return if 1 condition has been met
135  */
136  bool cfHasCondition(GUIElementNode* elementNode, const vector<string>& arguments);
137 
138  /**
139  * Determine element node dependencies - Condition function: has condition
140  * @param arguments arguments
141  * Format of arguments: [elementid.]condition
142  * Arguments or OR connected
143  */
144  void cfHasConditionDetermineElementNodeDependencies(const vector<string>& arguments, vector<string>& elementNodeDependencies);
145 
146 protected:
147  GUIScreenNode* screenNode { nullptr };
148  GUIParentNode* parentNode { nullptr };
149  string id;
163  unique_ptr<GUINodeController> controller;
164  unordered_map<string, GUIEffect*> effects;
168  bool layouted;
170  vector<string> lastConditions;
171  unique_ptr<GUIEffectState> effectState;
172  string tooltip;
173 
174  // forbid class copy
176 
177  /**
178  * Public constructor
179  * @param screenNode screen node
180  * @param parentNode parent node
181  * @param id id
182  * @param flow flow
183  * @param alignments alignments
184  * @param requestedConstraints requested constraints
185  * @param backgroundColor background color
186  * @param backgroundImage background image
187  * @param backgroundImageScale9Grid background image scale 9 grid
188  * @param backgroundImageEffectColorMul background image effect color mul
189  * @param backgroundImageEffectColorAdd background image effect color add
190  * @param border border
191  * @param padding padding
192  * @param showOn show on
193  * @param hideOn hide on
194  * @param tooltip tooltip
195  */
196  GUINode(
199  const string& id,
203  const GUIColor& backgroundColor,
204  const string& backgroundImage,
208  const GUINode_Border& border,
209  const GUINode_Padding& padding,
210  const GUINodeConditions& showOn,
211  const GUINodeConditions& hideOn,
212  const string& tooltip
213  );
214 
215  /**
216  * Destructor
217  */
218  virtual ~GUINode();
219 
220  /**
221  * @return is content node
222  */
223  virtual bool isContentNode() = 0;
224 
225  /**
226  * Set computed left
227  * @param left left
228  */
229  virtual void setLeft(int left);
230 
231  /**
232  * Set computed top
233  * @param top top
234  */
235  virtual void setTop(int top);
236 
237  /**
238  * Layout
239  */
240  virtual void layout();
241 
242  /**
243  * Do content alignment
244  */
245  virtual void computeContentAlignment();
246 
247  /**
248  * Layout constraint
249  * @param type type
250  * @param autoValue auto value
251  * @param parentValue parent value
252  * @param value value
253  * @return pixel
254  */
255  int layoutConstraintPixel(GUINode_RequestedConstraints_RequestedConstraintsType* type, int autoValue, int parentValue, int value);
256 
257  /**
258  * Get requested constraints type
259  * @param constraint constraint
260  * @param defaultConstraintsType default constraints type
261  * @return requested constraints type
262  */
264 
265  /**
266  * Get requested constraints value
267  * @param constraint constraint
268  * @param defaultConstraintsValue default constraints value
269  * @return requested constraints value
270  */
271  static int getRequestedConstraintsValue(const string& constraint, int defaultConstraintsValue);
272 
273  /**
274  * Get requested pixel value
275  * @param value value
276  * @param defaultValue default value
277  * @return value
278  */
279  static int getRequestedPixelValue(const string& value, int defaultValue);
280 
281  /**
282  * Check if conditions are met
283  * @return conditions met
284  */
285  bool checkConditions();
286 
287  /**
288  * On set condition
289  * @param conditions conditions
290  */
291  void onSetConditions(const vector<string>& conditions);
292 
293  /**
294  * Determine if we have a out effect active
295  */
296  bool haveActiveOutEffect();
297 
298  /**
299  * Returns if to render
300  * @return if node will be rendered
301  */
302  inline bool shouldRender() {
303  return conditionsMet == true || haveActiveOutEffect() == true;
304  }
305 
306  /**
307  * Scroll to node X
308  * @param toNode stop at node to node
309  */
310  void _scrollToNodeX(GUIParentNode* toNode = nullptr);
311 
312  /**
313  * Scroll to node Y
314  * @param toNode stop at node to node
315  */
316  void _scrollToNodeY(GUIParentNode* toNode = nullptr);
317 
318 public:
319  static constexpr int DETERMINEMOUSEEVENTNODES_FLAG_NONE { 0 };
320  static constexpr int DETERMINEMOUSEEVENTNODES_FLAG_TOOLTIP { 1 };
321 
322  /**
323  * @return scren node
324  */
326  return screenNode;
327  }
328 
329  /**
330  * @return parent node
331  */
333  return parentNode;
334  }
335 
336  /**
337  * @return id
338  */
339  inline const string& getId() {
340  return id;
341  }
342 
343  /**
344  * @return tooltip
345  */
346  inline const string& getToolTip() {
347  return tooltip;
348  }
349 
350  /**
351  * Set tooltip
352  * @param tooltip tooltip
353  */
354  inline void setTooltip(const string& tooltip) {
355  this->tooltip = tooltip;
356  }
357 
358  /**
359  * @return hierarchical id
360  */
361  const string getHierarchicalId();
362 
363  /**
364  * @return node type
365  */
366  virtual const string getNodeType() = 0;
367 
368  /**
369  * @return content width including border, margin
370  */
371  virtual int getContentWidth() = 0;
372 
373  /**
374  * @return content height including border, margin
375  */
376  virtual int getContentHeight() = 0;
377 
378  /**
379  * @return auto width if auto width requested or content width
380  */
381  virtual int getAutoWidth();
382 
383  /**
384  * @return auto height if auto height requested or content height
385  */
386  virtual int getAutoHeight();
387 
388  /**
389  * @return border
390  */
392  return border;
393  }
394 
395  /**
396  * @return padding
397  */
399  return padding;
400  }
401 
402  /**
403  * @return requested constraints
404  */
406  return requestedConstraints;
407  }
408 
409  /**
410  * @return computed constraints
411  */
413  return computedConstraints;
414  }
415 
416  /**
417  * @return background color
418  */
420  return backgroundColor;
421  }
422 
423  /**
424  * Create alignments
425  * @param horizontal horizontal
426  * @param vertical vertical
427  * @return alignments
428  */
429  static GUINode_Alignments createAlignments(const string& horizontal, const string& vertical);
430 
431  /**
432  * Create requested constraints
433  * @param left left
434  * @param top top
435  * @param width width
436  * @param height height
437  * @param factor factor
438  * @return requested constraints
439  */
440  static GUINode_RequestedConstraints createRequestedConstraints(const string& left, const string& top, const string& width, const string& height, int factor);
441 
442  /**
443  * Get color
444  * @param color color
445  * @param defaultColor default color
446  * @throws tdme::gui::GUIParserException
447  * @return value
448  */
449  static GUIColor getRequestedColor(const string& color, const GUIColor& defaultColor);
450 
451  /**
452  * Create flow
453  * @param flow flow
454  * @return flow
455  */
456  static GUINode_Flow* createFlow(const string& flow);
457 
458  /**
459  * Create border
460  * @param allBorder all border
461  * @param left left
462  * @param top top
463  * @param right right
464  * @param bottom bottom
465  * @param allBorderColor all border color
466  * @param leftColor left color
467  * @param topColor top color
468  * @param rightColor right color
469  * @param bottomColor bottom color
470  * @return border
471  */
472  static GUINode_Border createBorder(const string& allBorder, const string& left, const string& top, const string& right, const string& bottom, const string& allBorderColor, const string& leftColor, const string& topColor, const string& rightColor, const string& bottomColor);
473 
474  /**
475  * Create padding
476  * @param allPadding all padding
477  * @param left left
478  * @param top top
479  * @param right right
480  * @param bottom bottom
481  * @return padding
482  */
483  static GUINode_Padding createPadding(const string& allPadding, const string& left, const string& top, const string& right, const string& bottom);
484 
485  /**
486  * Create scale 9 grid
487  * @param all all
488  * @param left left
489  * @param top top
490  * @param right right
491  * @param bottom bottom
492  * @return scale 9 grid
493  */
494  static GUINode_Scale9Grid createScale9Grid(const string& all, const string& left, const string& top, const string& right, const string& bottom);
495 
496  /**
497  * Create conditions
498  * @param conditions conditions
499  */
500  static GUINodeConditions createConditions(const string& conditions);
501 
502  /**
503  * Dispose node
504  */
505  virtual void dispose();
506 
507  /**
508  * Returns if conditions are set
509  * @return if conditions are set
510  */
511  inline bool isConditionsMet() {
512  return conditionsMet;
513  }
514 
515  /**
516  * Set conditions met for this node and its subnodes
517  */
518  virtual void setConditionsMet();
519 
520  /**
521  * Returns if layouted
522  * @return if layouted
523  */
524  inline bool isLayouted() {
525  return layouted;
526  }
527 
528  /**
529  * Layout on demand
530  */
531  virtual void layoutOnDemand();
532 
533  /**
534  * @return if node has effects
535  */
536  inline bool hasEffects() {
537  return effects.empty() == false;
538  }
539 
540  /**
541  * Apply effects
542  * @param guiRenderer gui renderer
543  */
544  virtual void applyEffects(GUIRenderer* guiRenderer);
545 
546  /**
547  * Undo effects
548  * @param guiRenderer gui renderer
549  */
550  virtual void undoEffects(GUIRenderer* guiRenderer);
551 
552  /**
553  * Render
554  * @param guiRenderer gui renderer
555  * @param floatingNodes floating nodes
556  */
557  virtual void render(GUIRenderer* guiRenderer);
558 
559  /**
560  * @return compute parent children render offset X total
561  */
563 
564  /**
565  * @return compute children render offset Y total
566  */
568 
569  /**
570  * Is coordinate belonging to node
571  * @param coordinate coordinate
572  * @param nodeCoordinate node coordinate
573  * @return boolean
574  */
575  inline bool isCoordinateBelongingToNode(const Vector2& coordinate, Vector2& nodeCoordinate) {
576  auto x = coordinate[0] + computeParentChildrenRenderOffsetXTotal();
577  auto y = coordinate[1] + computeParentChildrenRenderOffsetYTotal();
578  auto belongsToElement =
583  nodeCoordinate[0] = static_cast<int>((x - (computedConstraints.left + computedConstraints.alignmentLeft)));
584  nodeCoordinate[1] = static_cast<int>((y - (computedConstraints.top + computedConstraints.alignmentTop)));
585  return belongsToElement;
586  }
587 
588  /**
589  * Is coordinate belonging to node
590  * @param coordinate coordinate
591  * @return boolean
592  */
593  inline bool isCoordinateBelongingToNode(const Vector2& coordinate) {
594  Vector2 nodeCoordinate;
595  return isCoordinateBelongingToNode(coordinate, nodeCoordinate);
596  }
597 
598  /**
599  * Is event belonging to node
600  * @param event event
601  * @param nodeCoordinate node coordinate
602  * @return boolean
603  */
604  inline bool isEventBelongingToNode(GUIMouseEvent* event, Vector2& nodeCoordinate) {
605  return isCoordinateBelongingToNode(Vector2(event->getX(), event->getY()), nodeCoordinate);
606  }
607 
608  /**
609  * Is event belonging to node
610  * @param event event
611  * @return boolean
612  */
613  inline bool isEventBelongingToNode(GUIMouseEvent* event) {
614  Vector2 nodeCoordinate;
615  return isEventBelongingToNode(event, nodeCoordinate);
616  }
617 
618  /**
619  * Get event off node relative position
620  * TODO: use Vector2 instead of array<float, 2>
621  * @param event event
622  * @param position (will return x = 0 if in node on x axis, will return x < 0 (-pixel) if on the left of element, x > 0 (+pixel) if on the right of element, y behaves analogous to x)
623  * @return void
624  */
625  void getEventOffNodeRelativePosition(GUIMouseEvent* event, Vector2& position);
626 
627  /**
628  * Get event position clamped to node constraints
629  * TODO: use Vector2 instead of array<float, 2>
630  * @param event event
631  * @param position position in node coordinate space clamped to node constraints
632  * @return void
633  */
634  void getEventNodePosition(GUIMouseEvent* event, Vector2& position);
635 
636  /**
637  * @return first parent node in tree with controller node attached
638  */
640 
641  /**
642  * Determine nodes by coordinate
643  * @param coordinate coordinate
644  * @param nodeIds node ids
645  */
646  virtual void determineNodesByCoordinate(const Vector2& coordinate, unordered_set<string>& nodeIds);
647 
648  /**
649  * Determine mouse event nodes
650  * @param event event
651  * @param floatingNode if node is floating node
652  * @param eventNodeIds event node ids
653  * @param eventFloatingNodeIds event floating node ids
654  * @param flags flags see DETERMINEMOUSEEVENTNODES_FLAG_*
655  */
656  virtual void determineMouseEventNodes(GUIMouseEvent* event, bool floatingNode, unordered_set<string>& eventNodeIds, unordered_set<string>& eventFloatingNodeIds, int flags = DETERMINEMOUSEEVENTNODES_FLAG_NONE);
657 
658  /**
659  * @return controller
660  */
662  return controller.get();
663  }
664 
665  /**
666  * Set up node controller
667  * @param controller controller
668  */
670 
671  /**
672  * Scroll to node Y
673  * @param toNode stop at node to node
674  */
675  void scrollToNodeY(GUIParentNode* toNode = nullptr);
676 
677  /**
678  * Scroll to node X
679  * @param toNode stop at node to node
680  */
681  void scrollToNodeX(GUIParentNode* toNode = nullptr);
682 
683  /**
684  * Set background image
685  * @param backgroundImage background image
686  */
687  void setBackgroundImage(const string& backgroundImage);
688 
689  /**
690  * @return GUI effect offset X
691  */
692  inline int getGUIEffectOffsetX() {
693  return guiEffectOffsetX;
694  }
695 
696  /**
697  * Set GUI effect offset X
698  * @param guiEffectOffsetX gui effect offset X
699  */
701  this->guiEffectOffsetX = guiEffectOffsetX;
702  }
703 
704  /**
705  * @return GUI effect offset Y
706  */
707  inline int getGUIEffectOffsetY() {
708  return guiEffectOffsetY;
709  }
710 
711  /**
712  * Set GUI effect offset Y
713  * @param guiEffectOffsetY gui effect offset Y
714  */
716  this->guiEffectOffsetY = guiEffectOffsetY;
717  }
718 
719  /**
720  * @return effect state
721  */
723  return effectState.get();
724  }
725 
726  /**
727  * Get effect
728  * @param id id
729  * @return effect or null
730  */
731  GUIEffect* getEffect(const string& id);
732 
733  /**
734  * Add effect, effect already registered with the is will be removed
735  * @param id id
736  * @param effect effect
737  */
738  void addEffect(const string& id, GUIEffect* effect);
739 
740  /**
741  * Remove effect
742  * @param id id
743  */
744  void removeEffect(const string& id);
745 
746  /**
747  * Dump node
748  * @param node node to dump
749  * @param depth depth
750  * @param indent indention
751  * @param depthIdx depth index
752  */
753  static void dumpNode(GUINode* node, int depth = 0, int indent = 0, int depthIdx = 0);
754 
755  /**
756  * Dump parent nodes
757  * @param node node to dump from
758  * @param indent indention
759  */
760  static void dumpParentNodes(GUINode* node, int indent = 0);
761 
762 };
Texture entity.
Definition: Texture.h:24
GUI module class.
Definition: GUI.h:64
GUI effect base class.
Definition: GUIEffect.h:26
GUI element node conditions.
GUI node controller base class.
GUI node base class.
Definition: GUINode.h:64
GUINodeConditions hideOn
Definition: GUINode.h:162
void setGUIEffectOffsetY(int guiEffectOffsetY)
Set GUI effect offset Y.
Definition: GUINode.h:715
void cfCallDetermineElementNodeDependencies(const string &function, const vector< string > &arguments, vector< string > &elementNodeDependencies)
Determine element node dependencies - Call condition function with arguments.
Definition: GUINode.cpp:1242
bool cfCall(GUIElementNode *elementNode, const string &function, const vector< string > &arguments)
Call condition function with arguments.
Definition: GUINode.cpp:1227
virtual int getContentHeight()=0
static GUINode_RequestedConstraints_RequestedConstraintsType * getRequestedConstraintsType(const string &constraint, GUINode_RequestedConstraints_RequestedConstraintsType *defaultConstraintsType)
Get requested constraints type.
Definition: GUINode.cpp:288
GUIColor backgroundImageEffectColorMul
Definition: GUINode.h:157
float computeParentChildrenRenderOffsetXTotal()
Definition: GUINode.cpp:952
GUINode_RequestedConstraints & getRequestsConstraints()
Definition: GUINode.h:405
GUINode_Border border
Definition: GUINode.h:160
GUIEffectState * getEffectState()
Definition: GUINode.h:722
virtual void determineMouseEventNodes(GUIMouseEvent *event, bool floatingNode, unordered_set< string > &eventNodeIds, unordered_set< string > &eventFloatingNodeIds, int flags=DETERMINEMOUSEEVENTNODES_FLAG_NONE)
Determine mouse event nodes.
Definition: GUINode.cpp:1030
static GUINode_Alignments createAlignments(const string &horizontal, const string &vertical)
Create alignments.
Definition: GUINode.cpp:262
void scrollToNodeY(GUIParentNode *toNode=nullptr)
Scroll to node Y.
Definition: GUINode.cpp:1100
void scrollToNodeX(GUIParentNode *toNode=nullptr)
Scroll to node X.
Definition: GUINode.cpp:1096
void onSetConditions(const vector< string > &conditions)
On set condition.
Definition: GUINode.cpp:1341
virtual int getContentWidth()=0
bool isCoordinateBelongingToNode(const Vector2 &coordinate)
Is coordinate belonging to node.
Definition: GUINode.h:593
void setTooltip(const string &tooltip)
Set tooltip.
Definition: GUINode.h:354
void addEffect(const string &id, GUIEffect *effect)
Add effect, effect already registered with the is will be removed.
Definition: GUINode.cpp:1316
virtual void setLeft(int left)
Set computed left.
Definition: GUINode.cpp:179
virtual void layoutOnDemand()
Layout on demand.
Definition: GUINode.cpp:473
GUINode_Scale9Grid backgroundImageScale9Grid
Definition: GUINode.h:156
virtual void determineNodesByCoordinate(const Vector2 &coordinate, unordered_set< string > &nodeIds)
Determine nodes by coordinate.
Definition: GUINode.cpp:1020
bool cfHasCondition(GUIElementNode *elementNode, const vector< string > &arguments)
Condition function: has condition.
Definition: GUINode.cpp:1257
virtual ~GUINode()
Destructor.
Definition: GUINode.cpp:139
const string & getToolTip()
Definition: GUINode.h:346
vector< string > lastConditions
Definition: GUINode.h:170
void _scrollToNodeX(GUIParentNode *toNode=nullptr)
Scroll to node X.
Definition: GUINode.cpp:1055
void cfDetermineElementNodeDependencies(vector< string > &elementNodeDependencies)
Determine element node dependencies.
Definition: GUINode.cpp:1164
static GUIColor getRequestedColor(const string &color, const GUIColor &defaultColor)
Get color.
Definition: GUINode.cpp:333
virtual void render(GUIRenderer *guiRenderer)
Render.
Definition: GUINode.cpp:509
static int getRequestedPixelValue(const string &value, int defaultValue)
Get requested pixel value.
Definition: GUINode.cpp:324
void cfParse(const string &term, string &function, vector< string > &arguments)
Parse condition function term.
Definition: GUINode.cpp:1183
static constexpr int DETERMINEMOUSEEVENTNODES_FLAG_TOOLTIP
Definition: GUINode.h:320
GUIColor backgroundImageEffectColorAdd
Definition: GUINode.h:158
virtual void computeContentAlignment()
Do content alignment.
Definition: GUINode.cpp:207
bool isLayouted()
Returns if layouted.
Definition: GUINode.h:524
GUINode(GUIScreenNode *screenNode, GUIParentNode *parentNode, const string &id, GUINode_Flow *flow, const GUINode_Alignments &alignments, const GUINode_RequestedConstraints &requestedConstraints, const GUIColor &backgroundColor, const string &backgroundImage, const GUINode_Scale9Grid &backgroundImageScale9Grid, const GUIColor &backgroundImageEffectColorMul, const GUIColor &backgroundImageEffectColorAdd, const GUINode_Border &border, const GUINode_Padding &padding, const GUINodeConditions &showOn, const GUINodeConditions &hideOn, const string &tooltip)
Public constructor.
Definition: GUINode.cpp:88
unique_ptr< GUINodeController > controller
Definition: GUINode.h:163
GUIParentNode * parentNode
Definition: GUINode.h:148
void _scrollToNodeY(GUIParentNode *toNode=nullptr)
Scroll to node Y.
Definition: GUINode.cpp:1077
virtual const string getNodeType()=0
static void dumpNode(GUINode *node, int depth=0, int indent=0, int depthIdx=0)
Dump node.
Definition: GUINode.cpp:1104
virtual void undoEffects(GUIRenderer *guiRenderer)
Undo effects.
Definition: GUINode.cpp:504
virtual bool isContentNode()=0
bool isEventBelongingToNode(GUIMouseEvent *event, Vector2 &nodeCoordinate)
Is event belonging to node.
Definition: GUINode.h:604
Texture * backgroundTexture
Definition: GUINode.h:154
bool haveActiveOutEffect()
Determine if we have a out effect active.
Definition: GUINode.cpp:1452
GUINode_ComputedConstraints computedConstraints
Definition: GUINode.h:152
GUINode_Padding padding
Definition: GUINode.h:159
void cfHasConditionDetermineElementNodeDependencies(const vector< string > &arguments, vector< string > &elementNodeDependencies)
Determine element node dependencies - Condition function: has condition.
Definition: GUINode.cpp:1277
unordered_map< string, GUIEffect * > effects
Definition: GUINode.h:164
virtual void setTop(int top)
Set computed top.
Definition: GUINode.cpp:185
GUINode_Border & getBorder()
Definition: GUINode.h:391
GUIParentNode * getParentNode()
Definition: GUINode.h:332
virtual void setConditionsMet()
Set conditions met for this node and its subnodes.
Definition: GUINode.cpp:468
GUINodeController * getController()
Definition: GUINode.h:661
GUIScreenNode * screenNode
Definition: GUINode.h:147
bool isEventBelongingToNode(GUIMouseEvent *event)
Is event belonging to node.
Definition: GUINode.h:613
const string getHierarchicalId()
Definition: GUINode.cpp:150
virtual int getAutoWidth()
Definition: GUINode.cpp:161
int layoutConstraintPixel(GUINode_RequestedConstraints_RequestedConstraintsType *type, int autoValue, int parentValue, int value)
Layout constraint.
Definition: GUINode.cpp:239
GUINode_RequestedConstraints requestedConstraints
Definition: GUINode.h:151
static constexpr int DETERMINEMOUSEEVENTNODES_FLAG_NONE
Definition: GUINode.h:319
GUIColor & getBackgroundColor()
Definition: GUINode.h:419
float computeParentChildrenRenderOffsetYTotal()
Definition: GUINode.cpp:962
bool shouldRender()
Returns if to render.
Definition: GUINode.h:302
GUIParentNode * getParentControllerNode()
Definition: GUINode.cpp:1011
bool isConditionsMet()
Returns if conditions are set.
Definition: GUINode.h:511
void setGUIEffectOffsetX(int guiEffectOffsetX)
Set GUI effect offset X.
Definition: GUINode.h:700
virtual void dispose()
Dispose node.
Definition: GUINode.cpp:462
GUINode_Padding & getPadding()
Definition: GUINode.h:398
bool cfEmpty(const vector< string > &arguments)
Condition function: empty.
Definition: GUINode.cpp:1293
void removeEffect(const string &id)
Remove effect.
Definition: GUINode.cpp:1330
void setBackgroundImage(const string &backgroundImage)
Set background image.
Definition: GUINode.cpp:1304
static GUINode_RequestedConstraints createRequestedConstraints(const string &left, const string &top, const string &width, const string &height, int factor)
Create requested constraints.
Definition: GUINode.cpp:270
GUIScreenNode * getScreenNode()
Definition: GUINode.h:325
virtual void applyEffects(GUIRenderer *guiRenderer)
Apply effects.
Definition: GUINode.cpp:480
GUINode_Alignments alignments
Definition: GUINode.h:150
const string & getId()
Definition: GUINode.h:339
static void dumpParentNodes(GUINode *node, int indent=0)
Dump parent nodes.
Definition: GUINode.cpp:1137
bool isCoordinateBelongingToNode(const Vector2 &coordinate, Vector2 &nodeCoordinate)
Is coordinate belonging to node.
Definition: GUINode.h:575
void setController(GUINodeController *controller)
Set up node controller.
Definition: GUINode.cpp:1046
bool checkConditions()
Check if conditions are met.
Definition: GUINode.cpp:426
GUIEffect * getEffect(const string &id)
Get effect.
Definition: GUINode.cpp:1323
unique_ptr< GUIEffectState > effectState
Definition: GUINode.h:171
static GUINode_Border createBorder(const string &allBorder, const string &left, const string &top, const string &right, const string &bottom, const string &allBorderColor, const string &leftColor, const string &topColor, const string &rightColor, const string &bottomColor)
Create border.
Definition: GUINode.cpp:347
void getEventNodePosition(GUIMouseEvent *event, Vector2 &position)
Get event position clamped to node constraints TODO: use Vector2 instead of array<float,...
Definition: GUINode.cpp:998
virtual void layout()
Layout.
Definition: GUINode.cpp:191
GUINodeConditions showOn
Definition: GUINode.h:161
static GUINodeConditions createConditions(const string &conditions)
Create conditions.
Definition: GUINode.cpp:397
static GUINode_Padding createPadding(const string &allPadding, const string &left, const string &top, const string &right, const string &bottom)
Create padding.
Definition: GUINode.cpp:369
GUINode_Flow * flow
Definition: GUINode.h:86
GUINode_ComputedConstraints & getComputedConstraints()
Definition: GUINode.h:412
static GUINode_Scale9Grid createScale9Grid(const string &all, const string &left, const string &top, const string &right, const string &bottom)
Create scale 9 grid.
Definition: GUINode.cpp:383
void getEventOffNodeRelativePosition(GUIMouseEvent *event, Vector2 &position)
Get event off node relative position TODO: use Vector2 instead of array<float, 2>
Definition: GUINode.cpp:972
virtual int getAutoHeight()
Definition: GUINode.cpp:170
static int getRequestedConstraintsValue(const string &constraint, int defaultConstraintsValue)
Get requested constraints value.
Definition: GUINode.cpp:306
static GUINode_Flow * createFlow(const string &flow)
Create flow.
Definition: GUINode.cpp:342
GUI parent node base class thats supporting child nodes.
Definition: GUIParentNode.h:42
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
Vector2 class representing vector2 mathematical structure and operations with x, y components.
Definition: Vector2.h:20
GUI node border entity.
GUI node padding entity.
GUI node scale 9 grid entity.
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6