![]() |
Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
|


Public Member Functions | |
| Grid (int columns, int width, int cellPadding=0, int rowPadding=0) | |
| void | refresh () |
| Recalculate positions for all child elements. | |
| bool | process (InputEvents *event) override |
| process any input that is received for this element | |
Public Member Functions inherited from Chesto::Element | |
| virtual void | render (Element *parent) |
| display the current state of the display | |
| 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 | |
| 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. | |
Public Attributes | |
| int | columns |
| int | width |
| int | cellPadding |
| int | rowPadding |
| int | highlighted = -1 |
| Cursor state. | |
| bool | touchMode = true |
Public Attributes inherited from Chesto::Element | |
| 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 | |
| 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 | |
| float | scale = 1.0f |
| bool | touchable = false |
| whether or not this element can be touched (highlights bounds) | |
| bool | dragging = false |
| whether or not this element is currently being dragged | |
| bool | needsRedraw = false |
| whether or not this element needs the screen redrawn next time it's processed | |
| int | futureRedrawCounter = 0 |
| whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws) | |
| int | lastMouseY = 0 |
| the last Y, X coordinate of the mouse (from a drag probably) | |
| 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) | |
| bool | hidden = false |
| whether this element should skip rendering or not | |
| 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 | |
| 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)) | |
| int | height = 0 |
| int | x = 0 |
| int | y = 0 |
| int | xAbs = 0 |
| int | yAbs = 0 |
| double | angle = 0 |
| rotation angle in degrees | |
| 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 | |
| CST_Color | maskColor = {0,0,0,0} |
| The color to overlay on top. | |
Additional Inherited Members | |
Public Types inherited from Chesto::Element | |
| typedef Element | super |
Protected Member Functions inherited from Chesto::Element | |
| void | addStackMember (Element *element) |
| Chesto::Grid::Grid | ( | int | columns, |
| int | width, | ||
| int | cellPadding = 0, |
||
| int | rowPadding = 0 |
||
| ) |
The Grid component is similar to Container in that it has to deal with positioning its child elements, but unlike container, it is designed to take in the full list of elements, and then arrange them based on some fixed width.
Calling refresh rebuilds the grid, again according to the width and its elements, which allows for reflowing when container sizes change.
Definition at line 14 of file Grid.cpp.
|
overridevirtual |
process any input that is received for this element
Reimplemented from Chesto::Element.
Definition at line 72 of file Grid.cpp.
References Chesto::Element::elements, highlighted, and Chesto::Element::process().
| void Chesto::Grid::refresh | ( | ) |
Recalculate positions for all child elements.
Definition at line 24 of file Grid.cpp.
References Chesto::Element::elements.
| int Chesto::Grid::highlighted = -1 |