TDME2  1.9.200
GUISpaceNode.cpp
Go to the documentation of this file.
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
10 
11 using std::string;
12 
18 
19 GUISpaceNode::GUISpaceNode(
20  GUIScreenNode* screenNode,
21  GUIParentNode* parentNode,
22  const string& id,
23  GUINode_Flow* flow,
24  const GUINode_Alignments& alignments,
25  const GUINode_RequestedConstraints& requestedConstraints,
26  const GUIColor& backgroundColor,
27  const string& backgroundImage,
28  const GUINode_Scale9Grid& backgroundImageScale9Grid,
29  const GUIColor& backgroundImageEffectColorMul,
30  const GUIColor& backgroundImageEffectColorAdd,
31  const GUINode_Border& border,
32  const GUINode_Padding& padding,
33  const GUINodeConditions& showOn,
34  const GUINodeConditions& hideOn,
35  const string& tooltip
36 ):
37  GUINode(screenNode, parentNode, id, flow, alignments, requestedConstraints, backgroundColor, backgroundImage, backgroundImageScale9Grid, backgroundImageEffectColorMul, backgroundImageEffectColorAdd, border, padding, showOn, hideOn, tooltip)
38 {
39 }
40 
42 {
43  return "space";
44 }
45 
47 {
48  return false;
49 }
50 
52 {
54 }
55 
57 {
59 }
60 
61 GUINode_RequestedConstraints GUISpaceNode::createRequestedConstraints(const string& left, const string& top, const string& width, const string& height, int factor)
62 {
63  GUINode_RequestedConstraints constraints;
65  constraints.left = getRequestedConstraintsValue(StringTools::trim(left), 0);
67  constraints.top = getRequestedConstraintsValue(StringTools::trim(top), 0);
69  constraints.width = getRequestedConstraintsValue(StringTools::trim(width), 1);
71  constraints.height = getRequestedConstraintsValue(StringTools::trim(height), 1);
72  if (constraints.leftType == GUINode_RequestedConstraints_RequestedConstraintsType::PIXEL) constraints.left*= factor;
73  if (constraints.topType == GUINode_RequestedConstraints_RequestedConstraintsType::PIXEL) constraints.top*= factor;
74  if (constraints.widthType == GUINode_RequestedConstraints_RequestedConstraintsType::PIXEL) constraints.width*= factor;
76  return constraints;
77 }
78 
80 {
82 }
83 
85 {
86  if (shouldRender() == false) return;
87 
88  GUINode::render(guiRenderer);
89 }
90 
GUI element node conditions.
static STATIC_DLL_IMPEXT GUINode_RequestedConstraints_RequestedConstraintsType * PIXEL
GUI node base class.
Definition: GUINode.h:64
static GUINode_RequestedConstraints_RequestedConstraintsType * getRequestedConstraintsType(const string &constraint, GUINode_RequestedConstraints_RequestedConstraintsType *defaultConstraintsType)
Get requested constraints type.
Definition: GUINode.cpp:288
virtual void render(GUIRenderer *guiRenderer)
Render.
Definition: GUINode.cpp:509
GUINode_ComputedConstraints computedConstraints
Definition: GUINode.h:152
bool shouldRender()
Returns if to render.
Definition: GUINode.h:302
virtual void dispose()
Dispose node.
Definition: GUINode.cpp:462
static int getRequestedConstraintsValue(const string &constraint, int defaultConstraintsValue)
Get requested constraints value.
Definition: GUINode.cpp:306
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
const string getNodeType() override
void dispose() override
Dispose node.
void render(GUIRenderer *guiRenderer) override
Render.
static GUINode_RequestedConstraints createRequestedConstraints(const string &left, const string &top, const string &width, const string &height, int factor)
Create requested constraints.
String tools class.
Definition: StringTools.h:22
GUI node border entity.
GUI node padding entity.
GUINode_RequestedConstraints_RequestedConstraintsType * topType
GUINode_RequestedConstraints_RequestedConstraintsType * widthType
GUINode_RequestedConstraints_RequestedConstraintsType * leftType
GUINode_RequestedConstraints_RequestedConstraintsType * heightType
GUI node scale 9 grid entity.