|
| | Container (int layout=0, int padding=10) |
| |
| Element * | add (std::unique_ptr< Element > elem) |
| |
| template<typename T , typename... Args> |
| T * | createNode (Args &&...args) |
| |
| virtual bool | process (InputEvents *event) |
| | process any input that is received for this element More...
|
| |
| virtual void | render (Element *parent) |
| | display the current state of the display More...
|
| |
| bool | onTouchDown (InputEvents *event) |
| |
| bool | onTouchDrag (InputEvents *event) |
| |
| bool | onTouchUp (InputEvents *event) |
| |
| void | hide () |
| |
| void | unhide () |
| |
| void | renderBackground (bool fill=true) |
| |
| void | addNode (std::unique_ptr< Element > node) |
| |
| void | remove (Element *element) |
| |
| void | removeAll () |
| |
| void | position (int x, int y) |
| | position the element More...
|
| |
| void | recalcPosition (Element *parent) |
| |
| float | getEffectiveScale () const |
| |
| CST_Rect | getBounds () |
| |
| CST_Renderer * | getRenderer () |
| |
| Element * | setPosition (int x, int y) |
| |
| Element * | setAction (std::function< void()> func) |
| |
| Element * | setAbsolute (bool isAbs) |
| |
| template<typename T , typename... Args> |
| T * | createNode (Args &&... args) |
| |
| Element * | constrain (int flags, int padding=0) |
| |
| Element * | constrainToTarget (Element *target, int flags, int padding=0) |
| |
| Element * | animate (int durationIn, std::function< void(float)> onStep, std::function< void()> onFinish) |
| |
| Element * | moveToFront () |
| |
| Element * | setTouchable (bool touchable) |
| |
| void | screenshot (std::string path) |
| | Take a screenshot of this element and its children, and save it to the given path. More...
|
| |
|
| int | layout = 0 |
| |
| int | padding = 10 |
| |
| std::function< void()> | action = NULL |
| | the action to call (from binded callback) on touch or button selection https://stackoverflow.com/questions/14189440/c-class-member-callback-simple-examples More...
|
| |
| std::function< void(InputEvents *event)> | actionWithEvents = NULL |
| |
| std::vector< std::unique_ptr< Element, std::function< void(Element *)> > > | elements |
| | visible GUI child elements of this element More...
|
| |
| float | scale = 1.0f |
| |
| bool | touchable = false |
| | whether or not this element can be touched (highlights bounds) More...
|
| |
| bool | dragging = false |
| | whether or not this element is currently being dragged More...
|
| |
| bool | needsRedraw = false |
| | whether or not this element needs the screen redrawn next time it's processed More...
|
| |
| int | futureRedrawCounter = 0 |
| | whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws) More...
|
| |
| int | lastMouseY = 0 |
| | the last Y, X coordinate of the mouse (from a drag probably) More...
|
| |
| int | lastMouseX = 0 |
| |
| bool | hasBackground = false |
| |
| rgb | backgroundColor = {0, 0, 0} |
| |
| int | backgroundOpacity = 0xff |
| |
| bool | isAbsolute = false |
| |
| Element * | parent = nullptr |
| | the parent element (reference only, not owned) More...
|
| |
| bool | hidden = false |
| | whether this element should skip rendering or not More...
|
| |
| bool | isProtected = false |
| |
| int | elasticCounter = 0 |
| | how much time is left in an elastic-type flick/scroll set by the last distance traveled in a scroll, and counts down every frame More...
|
| |
| int | width = 0 |
| | width and height of this element (must be manually set, isn't usually calculated (but is in some cases, like text or images)) More...
|
| |
| int | height = 0 |
| |
| int | x = 0 |
| |
| int | y = 0 |
| |
| int | xAbs = 0 |
| |
| int | yAbs = 0 |
| |
| double | angle = 0 |
| | rotation angle in degrees More...
|
| |
| int | cornerRadius = 0 |
| |
| int | tag = 0 |
| |
| std::vector< std::unique_ptr< Constraint > > | constraints |
| |
| std::vector< std::unique_ptr< Animation > > | animations |
| |
| bool | useColorMask = false |
| | whether or not to overlay a color mask on top of this element More...
|
| |
| CST_Color | maskColor = {0,0,0,0} |
| | The color to overlay on top. More...
|
| |
Definition at line 10 of file Container.hpp.
◆ Container()
| Chesto::Container::Container |
( |
int |
layout = 0, |
|
|
int |
padding = 10 |
|
) |
| |
Definition at line 6 of file Container.cpp.
7{
8
9 this->layout = layout;
10 this->padding = padding;
11}
◆ add()
Definition at line 13 of file Container.cpp.
14{
15 int newPosX = (layout == ROW_LAYOUT) ? this->
width + padding : this->x;
16 int newPosY = (layout == COL_LAYOUT) ? this->height + padding : this->y;
17
18 Element* rawPtr = elem.get();
19 rawPtr->setPosition(newPosX, newPosY);
20 addNode(std::move(elem));
21
22 this->
width = (layout == ROW_LAYOUT) ? this->
width + rawPtr->width + padding : std::max(this->width, rawPtr->width);
23 this->height = (layout == COL_LAYOUT) ? this->height + rawPtr->height + padding : std::max(this->height, rawPtr->height);
24
25 return rawPtr;
26}
int width
width and height of this element (must be manually set, isn't usually calculated (but is in some case...
◆ createNode()
template<typename T , typename... Args>
| T * Chesto::Container::createNode |
( |
Args &&... |
args | ) |
|
|
inline |
Definition at line 16 of file Container.hpp.
16 {
17 auto ptr = std::make_unique<T>(std::forward<Args>(args)...);
18 T *rawPtr = ptr.get();
19 add(std::move(ptr));
20 return rawPtr;
21 }
◆ layout
| int Chesto::Container::layout = 0 |
◆ padding
| int Chesto::Container::padding = 10 |
The documentation for this class was generated from the following files: