6 #include <unordered_map>
7 #include <unordered_set>
32 using std::unique_ptr;
33 using std::unordered_map;
34 using std::unordered_set;
100 void cfParse(
const string& term,
string&
function, vector<string>& arguments);
109 bool cfCall(
GUIElementNode* elementNode,
const string&
function,
const vector<string>& arguments);
126 bool cfEmpty(
const vector<string>& arguments);
204 const string& backgroundImage,
229 virtual void setLeft(
int left);
235 virtual void setTop(
int top);
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);
483 static GUINode_Padding createPadding(
const string& allPadding,
const string& left,
const string& top,
const string& right,
const string& bottom);
537 return effects.empty() ==
false;
578 auto belongsToElement =
585 return belongsToElement;
753 static void dumpNode(
GUINode* node,
int depth = 0,
int indent = 0,
int depthIdx = 0);
GUI element node conditions.
GUI node controller base class.
GUI node horizontal alignment enum.
GUI node vertical alignment enum.
GUI node requested constraints requested constraints type enum.
void setGUIEffectOffsetY(int guiEffectOffsetY)
Set GUI effect offset Y.
void cfCallDetermineElementNodeDependencies(const string &function, const vector< string > &arguments, vector< string > &elementNodeDependencies)
Determine element node dependencies - Call condition function with arguments.
bool cfCall(GUIElementNode *elementNode, const string &function, const vector< string > &arguments)
Call condition function with arguments.
virtual int getContentHeight()=0
static GUINode_RequestedConstraints_RequestedConstraintsType * getRequestedConstraintsType(const string &constraint, GUINode_RequestedConstraints_RequestedConstraintsType *defaultConstraintsType)
Get requested constraints type.
GUIColor backgroundImageEffectColorMul
float computeParentChildrenRenderOffsetXTotal()
GUINode_RequestedConstraints & getRequestsConstraints()
GUIEffectState * getEffectState()
virtual void determineMouseEventNodes(GUIMouseEvent *event, bool floatingNode, unordered_set< string > &eventNodeIds, unordered_set< string > &eventFloatingNodeIds, int flags=DETERMINEMOUSEEVENTNODES_FLAG_NONE)
Determine mouse event nodes.
static GUINode_Alignments createAlignments(const string &horizontal, const string &vertical)
Create alignments.
void scrollToNodeY(GUIParentNode *toNode=nullptr)
Scroll to node Y.
void scrollToNodeX(GUIParentNode *toNode=nullptr)
Scroll to node X.
void onSetConditions(const vector< string > &conditions)
On set condition.
virtual int getContentWidth()=0
bool isCoordinateBelongingToNode(const Vector2 &coordinate)
Is coordinate belonging to node.
void setTooltip(const string &tooltip)
Set tooltip.
void addEffect(const string &id, GUIEffect *effect)
Add effect, effect already registered with the is will be removed.
virtual void setLeft(int left)
Set computed left.
virtual void layoutOnDemand()
Layout on demand.
GUINode_Scale9Grid backgroundImageScale9Grid
virtual void determineNodesByCoordinate(const Vector2 &coordinate, unordered_set< string > &nodeIds)
Determine nodes by coordinate.
bool cfHasCondition(GUIElementNode *elementNode, const vector< string > &arguments)
Condition function: has condition.
virtual ~GUINode()
Destructor.
const string & getToolTip()
vector< string > lastConditions
void _scrollToNodeX(GUIParentNode *toNode=nullptr)
Scroll to node X.
void cfDetermineElementNodeDependencies(vector< string > &elementNodeDependencies)
Determine element node dependencies.
static GUIColor getRequestedColor(const string &color, const GUIColor &defaultColor)
Get color.
virtual void render(GUIRenderer *guiRenderer)
Render.
static int getRequestedPixelValue(const string &value, int defaultValue)
Get requested pixel value.
void cfParse(const string &term, string &function, vector< string > &arguments)
Parse condition function term.
static constexpr int DETERMINEMOUSEEVENTNODES_FLAG_TOOLTIP
GUIColor backgroundImageEffectColorAdd
virtual void computeContentAlignment()
Do content alignment.
bool isLayouted()
Returns if layouted.
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.
unique_ptr< GUINodeController > controller
GUIParentNode * parentNode
void _scrollToNodeY(GUIParentNode *toNode=nullptr)
Scroll to node Y.
virtual const string getNodeType()=0
static void dumpNode(GUINode *node, int depth=0, int indent=0, int depthIdx=0)
Dump node.
virtual void undoEffects(GUIRenderer *guiRenderer)
Undo effects.
virtual bool isContentNode()=0
bool isEventBelongingToNode(GUIMouseEvent *event, Vector2 &nodeCoordinate)
Is event belonging to node.
Texture * backgroundTexture
bool haveActiveOutEffect()
Determine if we have a out effect active.
GUINode_ComputedConstraints computedConstraints
void cfHasConditionDetermineElementNodeDependencies(const vector< string > &arguments, vector< string > &elementNodeDependencies)
Determine element node dependencies - Condition function: has condition.
unordered_map< string, GUIEffect * > effects
virtual void setTop(int top)
Set computed top.
GUINode_Border & getBorder()
GUIParentNode * getParentNode()
virtual void setConditionsMet()
Set conditions met for this node and its subnodes.
GUINodeController * getController()
GUIScreenNode * screenNode
bool isEventBelongingToNode(GUIMouseEvent *event)
Is event belonging to node.
const string getHierarchicalId()
virtual int getAutoWidth()
int layoutConstraintPixel(GUINode_RequestedConstraints_RequestedConstraintsType *type, int autoValue, int parentValue, int value)
Layout constraint.
GUINode_RequestedConstraints requestedConstraints
static constexpr int DETERMINEMOUSEEVENTNODES_FLAG_NONE
int getGUIEffectOffsetX()
GUIColor & getBackgroundColor()
float computeParentChildrenRenderOffsetYTotal()
bool shouldRender()
Returns if to render.
GUIParentNode * getParentControllerNode()
bool isConditionsMet()
Returns if conditions are set.
void setGUIEffectOffsetX(int guiEffectOffsetX)
Set GUI effect offset X.
virtual void dispose()
Dispose node.
GUINode_Padding & getPadding()
bool cfEmpty(const vector< string > &arguments)
Condition function: empty.
void removeEffect(const string &id)
Remove effect.
void setBackgroundImage(const string &backgroundImage)
Set background image.
static GUINode_RequestedConstraints createRequestedConstraints(const string &left, const string &top, const string &width, const string &height, int factor)
Create requested constraints.
GUIScreenNode * getScreenNode()
virtual void applyEffects(GUIRenderer *guiRenderer)
Apply effects.
GUINode_Alignments alignments
static void dumpParentNodes(GUINode *node, int indent=0)
Dump parent nodes.
bool isCoordinateBelongingToNode(const Vector2 &coordinate, Vector2 &nodeCoordinate)
Is coordinate belonging to node.
void setController(GUINodeController *controller)
Set up node controller.
bool checkConditions()
Check if conditions are met.
GUIEffect * getEffect(const string &id)
Get effect.
unique_ptr< GUIEffectState > effectState
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.
void getEventNodePosition(GUIMouseEvent *event, Vector2 &position)
Get event position clamped to node constraints TODO: use Vector2 instead of array<float,...
virtual void layout()
Layout.
static GUINodeConditions createConditions(const string &conditions)
Create conditions.
int getGUIEffectOffsetY()
static GUINode_Padding createPadding(const string &allPadding, const string &left, const string &top, const string &right, const string &bottom)
Create padding.
GUINode_ComputedConstraints & getComputedConstraints()
static GUINode_Scale9Grid createScale9Grid(const string &all, const string &left, const string &top, const string &right, const string &bottom)
Create scale 9 grid.
void getEventOffNodeRelativePosition(GUIMouseEvent *event, Vector2 &position)
Get event off node relative position TODO: use Vector2 instead of array<float, 2>
virtual int getAutoHeight()
static int getRequestedConstraintsValue(const string &constraint, int defaultConstraintsValue)
Get requested constraints value.
static GUINode_Flow * createFlow(const string &flow)
Create flow.
GUI parent node base class thats supporting child nodes.
GUI screen node that represents a screen that can be rendered via GUI system.
Vector2 class representing vector2 mathematical structure and operations with x, y components.
GUI node computed constraints.
GUI node requested constraints entity.
GUI node scale 9 grid entity.
#define FORBID_CLASS_COPY(CLASS)