TDME2  1.9.200
GUIElementNode.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <set>
4 #include <string>
5 
6 #include <tdme/tdme.h>
8 #include <tdme/gui/fwd-tdme.h>
13 
14 using std::set;
15 using std::string;
16 
31 
32 /**
33  * GUI element node
34  * @author Andreas Drewke
35  */
37 {
38  friend class tdme::gui::GUIParser;
39  friend class GUINode;
40  friend class GUIScreenNode;
41 
42 public:
47 
48 private:
49  string name;
50  string value;
51  bool selected;
52  bool disabled;
54  bool focusable;
63  vector<string> options;
64 
65 protected:
66  // forbid class copy
68 
69  /**
70  * Constructor
71  * @param screenNode screen node
72  * @param parentNode parent node
73  * @param id id
74  * @param flow flow
75  * @param overflowX overflow x
76  * @param overflowY overflow y
77  * @param alignments alignments
78  * @param requestedConstraints requested constraints
79  * @param backgroundColor background color
80  * @param backgroundImage background image
81  * @param backgroundImageScale9Grid background image scale 9 grid
82  * @param backgroundImageEffectColorMul background image effect color mul
83  * @param backgroundImageEffectColorAdd background image effect color add
84  * @param border border
85  * @param padding padding
86  * @param showOn show on
87  * @param hideOn hide on
88  * @param tooltip tooltip
89  * @param name name
90  * @param value value
91  * @param selected selected
92  * @param disabled disabled
93  * @param focusable focusable
94  * @param ignoreEvents ignore events
95  * @param onInitialize on initialize expression
96  * @param onMouseClick on mouse click expression
97  * @param onMouseDoubleClickExpression on mouse double click expression
98  * @param onMouseOver on mouse over expression
99  * @param onMouseOut on mouse out expression
100  * @param onChangeExpression on change expression
101  * @param parentElementId parent element id
102  * @param options options
103  */
107  const string& id,
113  const GUIColor& backgroundColor,
114  const string& backgroundImage,
118  const GUINode_Border& border,
119  const GUINode_Padding& padding,
120  const GUINodeConditions& showOn,
121  const GUINodeConditions& hideOn,
122  const string& tooltip,
123  const string& name,
124  const string& value,
125  bool selected,
126  bool disabled,
127  bool focusable,
128  bool ignoreEvents,
129  const string& onInitialize,
130  const string& onMouseClick,
131  const string& onMouseDoubleClickExpression,
132  const string& onMouseOver,
133  const string& onMouseOut,
134  const string& onChangeExpression,
135  const string& parentElementId,
136  const string& options
137  );
138 
139  // overridden methods
140  const string getNodeType() override;
141  bool isContentNode() override;
142 
143 public:
144  /**
145  * @return focusable
146  */
147  bool isFocusable();
148 
149  /**
150  * @return name
151  */
152  const string& getName();
153 
154  /**
155  * @return value
156  */
157  const string& getValue();
158 
159  /**
160  * @return is selected
161  */
162  bool isSelected();
163 
164  /**
165  * @return is disabled
166  */
167  bool isDisabled();
168 
169 
170  /**
171  * @return on initialize expression
172  */
173  const string& getOnInitializeExpression();
174 
175  /**
176  * @return on mouse click expression
177  */
178  const string& getOnMouseClickExpression();
179 
180  /**
181  * @return on mouse double click expression
182  */
183  const string& getOnMouseDoubleClickExpression();
184 
185  /**
186  * @return on mouse over expression
187  */
188  const string& getOnMouseOverExpression();
189 
190  /**
191  * @return on mouse out expression
192  */
193  const string& getOnMouseOutExpression();
194 
195  /**
196  * @return on change expression
197  */
198  const string& getOnChangeExpression();
199 
200  /**
201  * Execute on change expression
202  */
204 
205  /**
206  * Execute expression
207  * @param screenNode screen node
208  * @param expression expression
209  */
210  static void executeExpression(GUIScreenNode* screenNode, const string& expression);
211 
212  /**
213  * @return parent element id
214  */
215  const string& getParentElementNodeId();
216 
217  /**
218  * @returns if option is among given options
219  */
220  bool hasOption(const string& option);
221 
222  /**
223  * @returns an option value, like <... options="type=float,min=0.0,max=1.0,step=0.1" /> or empty string if option does not exist
224  */
225  const string getOptionValue(const string& option);
226 
227  /**
228  * @return active conditions
229  */
231 
232  /**
233  * Handle keyboard event
234  * @param event keyboard event
235  */
237 
238 };
GUI parser.
Definition: GUIParser.h:40
static STATIC_DLL_IMPEXT string CONDITION_ALWAYS
const string getNodeType() override
const string & getOnMouseClickExpression()
void executeOnChangeExpression()
Execute on change expression.
const string & getOnInitializeExpression()
const string & getOnMouseDoubleClickExpression()
GUINodeConditions activeConditions
static STATIC_DLL_IMPEXT string CONDITION_FOCUS
static STATIC_DLL_IMPEXT string CONDITION_ONMOUSEOVER
const string getOptionValue(const string &option)
bool hasOption(const string &option)
static STATIC_DLL_IMPEXT string CONDITION_CLICK
static void executeExpression(GUIScreenNode *screenNode, const string &expression)
Execute expression.
void handleKeyboardEvent(GUIKeyboardEvent *event)
Handle keyboard event.
GUINodeConditions & getActiveConditions()
GUI element node conditions.
GUI node base class.
Definition: GUINode.h:64
GUINodeConditions hideOn
Definition: GUINode.h:162
GUIColor backgroundImageEffectColorMul
Definition: GUINode.h:157
GUINode_Border border
Definition: GUINode.h:160
GUINode_Scale9Grid backgroundImageScale9Grid
Definition: GUINode.h:156
GUIColor backgroundImageEffectColorAdd
Definition: GUINode.h:158
GUIParentNode * parentNode
Definition: GUINode.h:148
GUINode_Padding padding
Definition: GUINode.h:159
GUIScreenNode * screenNode
Definition: GUINode.h:147
GUINode_RequestedConstraints requestedConstraints
Definition: GUINode.h:151
GUINode_Alignments alignments
Definition: GUINode.h:150
GUINodeConditions showOn
Definition: GUINode.h:161
GUINode_Flow * flow
Definition: GUINode.h:86
GUI parent node base class thats supporting child nodes.
Definition: GUIParentNode.h:42
GUIParentNode_Overflow * overflowX
Definition: GUIParentNode.h:66
GUIParentNode_Overflow * overflowY
Definition: GUIParentNode.h:67
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
GUI node border entity.
GUI node padding entity.
GUI node scale 9 grid entity.
#define STATIC_DLL_IMPEXT
Definition: tdme.h:15
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6