3#include "InputEvents.hpp"
4#include "colorspaces.hpp"
5#include "DrawUtils.hpp"
6#include "Animation.hpp"
13#define DEEP_HIGHLIGHT 200
14#define THICK_HIGHLIGHT 150
19#define RAMFS "resin:/"
46 void hide() { this->
hidden =
true; }
48 void unhide() { this->
hidden =
false; }
51 void renderBackground(
bool fill =
true);
56 std::function<void(
InputEvents* event)> actionWithEvents = NULL;
62 void addNode(std::unique_ptr<Element> node);
72 void addStackMember(
Element* element);
83 float getEffectiveScale()
const;
104 bool hasBackground =
false;
107 rgb backgroundColor = {0, 0, 0};
110 int backgroundOpacity = 0xff;
113 bool isAbsolute =
false;
122 CST_Rect getBounds();
125 bool isProtected =
false;
141 int xAbs = 0, yAbs = 0;
147 int cornerRadius = 0;
153 CST_Renderer* getRenderer();
156 Element* setPosition(
int x,
int y);
157 Element* setAction(std::function<
void()> func);
158 Element* setAbsolute(
bool isAbs);
162 template<
typename T,
typename... Args>
163 T* createNode(Args&&... args) {
164 auto ptr = std::make_unique<T>(std::forward<Args>(args)...);
165 T* rawPtr = ptr.get();
166 addNode(std::move(ptr));
171 std::vector<std::unique_ptr<Constraint>> constraints;
172 Element* constrain(
int flags,
int padding = 0);
173 Element* constrainToTarget(
Element* target,
int flags,
int padding = 0);
176 std::vector<std::unique_ptr<Animation>> animations;
179 std::function<
void(
float)> onStep,
180 std::function<
void()> onFinish
std::vector< std::unique_ptr< Element, std::function< void(Element *)> > > elements
visible GUI child elements of this element
double angle
rotation angle in degrees
int width
width and height of this element (must be manually set, isn't usually calculated (but is in some case...
virtual void render(Element *parent)
display the current state of the display
bool hidden
whether this element should skip rendering or not
virtual bool process(InputEvents *event)
process any input that is received for this element
bool needsRedraw
whether or not this element needs the screen redrawn next time it's processed
bool touchable
whether or not this element can be touched (highlights bounds)
int lastMouseY
the last Y, X coordinate of the mouse (from a drag probably)
CST_Color maskColor
The color to overlay on top.
Element * parent
the parent element (reference only, not owned)
void screenshot(std::string path)
Take a screenshot of this element and its children, and save it to the given path.
int elasticCounter
how much time is left in an elastic-type flick/scroll set by the last distance traveled in a scroll,...
std::function< void()> action
the action to call (from binded callback) on touch or button selection https://stackoverflow....
void position(int x, int y)
position the element
int futureRedrawCounter
whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws)
bool useColorMask
whether or not to overlay a color mask on top of this element
bool dragging
whether or not this element is currently being dragged