21 #include <Dimension.h> 37 virtual ~
Layout() =
default;
44 typedef std::function<void (int x, int y, Layout* element, bool enteredElseLeaving)> EventFunction;
57 virtual std::map<std::string, IHudDrawable*>
getGLSquares(
float layoutXPos,
float layoutYPos,
58 float layoutWidth,
float layoutHeight);
84 virtual void getGLSquares(
float layoutXPos,
float layoutYPos,
float layoutWidth,
85 float layoutHeight, std::map<std::string, IHudDrawable*> *map) = 0;
106 virtual Layout* findById(std::string
id);
108 virtual void invokeListeners(
int x,
int y, ListenerType listenerType);
109 virtual void invokeListenersInternal(
int x,
int y, ListenerType listenerType,
bool mayBeHit);
111 virtual Layout* addClickListener(EventFunction eventFunction);
112 virtual Layout* addHoverListener(EventFunction eventFunction);
118 virtual void addChild(
Layout* child);
120 virtual void clearChildren();
121 virtual void clearHoverListeners();
122 virtual void clearClickListeners();
124 virtual void callListeners(
int x,
int y, ListenerType listenerType,
bool enteringElseLeaving);
126 virtual void updateGraphic();
130 std::vector<Layout*> children;
135 std::vector<EventFunction>* hoverListeners =
new std::vector<EventFunction>();
136 std::vector<EventFunction>* clickListeners =
new std::vector<EventFunction>();
137 GLSquare* renderedBackground =
nullptr;
139 bool hoveredBackground =
false;
140 bool mouseWasDown =
false;
142 std::string getNextRandId();
virtual std::map< std::string, IHudDrawable * > getGLSquares(float layoutXPos, float layoutYPos, float layoutWidth, float layoutHeight)
virtual Layout * setLayoutId(std::string id)
virtual Layout * setBackground(HUDGraphic *graphic)