![]() |
Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
|
Public Types | |
typedef Element | super |
Public Member Functions | |
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 | append (Element *element) |
void | remove (Element *element) |
void | removeAll (bool moveToTrash=false) |
void | position (int x, int y) |
position the element More... | |
void | recalcPosition (Element *parent) |
CST_Rect | getBounds () |
CST_Renderer * | getRenderer () |
void | wipeAll (bool delSelf=false) |
Element * | child (Element *child) |
Element * | setPosition (int x, int y) |
Element * | setAction (std::function< void()> func) |
Element * | centerHorizontallyIn (Element *parent) |
Element * | centerVerticallyIn (Element *parent) |
Element * | centerIn (Element *parent) |
Element * | setAbsolute (bool isAbs) |
Element * | constrain (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... | |
Public Attributes | |
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< 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} |
bool | isAbsolute = false |
Element * | parent = NULL |
the parent element (can sometimes be null if it isn't set) 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 | xOff = 0 |
int | yOff = 0 |
int | cornerRadius = 0 |
std::vector< Constraint * > | constraints |
std::vector< 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 33 of file Element.hpp.
typedef Element Element::super |
Definition at line 122 of file Element.hpp.
Element::Element | ( | ) |
Definition at line 12 of file Element.cpp.
|
virtual |
Definition at line 7 of file Element.cpp.
Element * Element::animate | ( | int | durationIn, |
std::function< void(float)> | onStep, | ||
std::function< void()> | onFinish | ||
) |
Definition at line 422 of file Element.cpp.
void Element::append | ( | Element * | element | ) |
Definition at line 328 of file Element.cpp.
Definition at line 389 of file Element.cpp.
Definition at line 401 of file Element.cpp.
Definition at line 395 of file Element.cpp.
Definition at line 369 of file Element.cpp.
Element * Element::constrain | ( | int | flags, |
int | padding = 0 |
||
) |
Definition at line 416 of file Element.cpp.
CST_Rect Element::getBounds | ( | ) |
Definition at line 178 of file Element.cpp.
CST_Renderer * Element::getRenderer | ( | ) |
Definition at line 412 of file Element.cpp.
|
inline |
Definition at line 51 of file Element.hpp.
Element * Element::moveToFront | ( | ) |
Definition at line 435 of file Element.cpp.
bool Element::onTouchDown | ( | InputEvents * | event | ) |
Definition at line 212 of file Element.cpp.
bool Element::onTouchDrag | ( | InputEvents * | event | ) |
Definition at line 232 of file Element.cpp.
bool Element::onTouchUp | ( | InputEvents * | event | ) |
Definition at line 286 of file Element.cpp.
void Element::position | ( | int | x, |
int | y | ||
) |
position the element
Definition at line 206 of file Element.cpp.
|
virtual |
process any input that is received for this element
Reimplemented in Button, EKeyboard, ListElement, and RootDisplay.
Definition at line 17 of file Element.cpp.
References elasticCounter, elements, futureRedrawCounter, hidden, needsRedraw, touchable, and InputEvents::touchIn().
Referenced by Button::process(), ListElement::process(), and RootDisplay::process().
void Element::recalcPosition | ( | Element * | parent | ) |
Definition at line 140 of file Element.cpp.
void Element::remove | ( | Element * | element | ) |
void Element::removeAll | ( | bool | moveToTrash = false | ) |
Definition at line 356 of file Element.cpp.
|
virtual |
display the current state of the display
Reimplemented in Button, EKeyboard, NetImageElement, ProgressBar, RootDisplay, and Texture.
Definition at line 60 of file Element.cpp.
References elasticCounter, elements, hidden, parent, touchable, and width.
Referenced by Button::render(), EKeyboard::render(), RootDisplay::render(), Texture::render(), and screenshot().
void Element::renderBackground | ( | bool | fill = true | ) |
Definition at line 188 of file Element.cpp.
void Element::screenshot | ( | std::string | path | ) |
Take a screenshot of this element and its children, and save it to the given path.
Definition at line 449 of file Element.cpp.
Element * Element::setAbsolute | ( | bool | isAbs | ) |
Definition at line 406 of file Element.cpp.
Element * Element::setAction | ( | std::function< void()> | func | ) |
Definition at line 383 of file Element.cpp.
Element * Element::setPosition | ( | int | x, |
int | y | ||
) |
Definition at line 377 of file Element.cpp.
Element * Element::setTouchable | ( | bool | touchable | ) |
Definition at line 443 of file Element.cpp.
|
inline |
Definition at line 53 of file Element.hpp.
void Element::wipeAll | ( | bool | delSelf = false | ) |
Definition at line 343 of file Element.cpp.
std::function<void()> Element::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
Definition at line 60 of file Element.hpp.
Referenced by Button::process().
std::function<void(InputEvents* event)> Element::actionWithEvents = NULL |
Definition at line 61 of file Element.hpp.
double Element::angle = 0 |
rotation angle in degrees
Definition at line 130 of file Element.hpp.
Referenced by Texture::render().
std::vector<Animation*> Element::animations |
Definition at line 163 of file Element.hpp.
rgb Element::backgroundColor = {0, 0, 0} |
Definition at line 98 of file Element.hpp.
std::vector<Constraint*> Element::constraints |
Definition at line 159 of file Element.hpp.
int Element::cornerRadius = 0 |
Definition at line 136 of file Element.hpp.
bool Element::dragging = false |
whether or not this element is currently being dragged
Definition at line 83 of file Element.hpp.
int Element::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
Definition at line 117 of file Element.hpp.
std::vector<Element*> Element::elements |
visible GUI child elements of this element
Definition at line 64 of file Element.hpp.
int Element::futureRedrawCounter = 0 |
whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws)
Definition at line 89 of file Element.hpp.
Referenced by process().
bool Element::hasBackground = false |
Definition at line 95 of file Element.hpp.
int Element::height = 0 |
Definition at line 120 of file Element.hpp.
bool Element::hidden = false |
whether this element should skip rendering or not
Definition at line 107 of file Element.hpp.
Referenced by EKeyboard::process(), process(), ListElement::process(), Button::render(), EKeyboard::render(), render(), NetImageElement::render(), ProgressBar::render(), and Texture::render().
bool Element::isAbsolute = false |
Definition at line 101 of file Element.hpp.
bool Element::isProtected = false |
Definition at line 113 of file Element.hpp.
int Element::lastMouseX = 0 |
Definition at line 92 of file Element.hpp.
int Element::lastMouseY = 0 |
the last Y, X coordinate of the mouse (from a drag probably)
Definition at line 92 of file Element.hpp.
CST_Color Element::maskColor = {0,0,0,0} |
The color to overlay on top.
Definition at line 180 of file Element.hpp.
Referenced by Texture::render().
bool Element::needsRedraw = false |
whether or not this element needs the screen redrawn next time it's processed
Definition at line 86 of file Element.hpp.
Referenced by process(), and InputEvents::processSDLEvents().
Element* Element::parent = NULL |
the parent element (can sometimes be null if it isn't set)
Definition at line 104 of file Element.hpp.
Referenced by Button::render(), render(), NetImageElement::render(), ProgressBar::render(), RootDisplay::render(), Texture::render(), and screenshot().
float Element::scale = 1.0f |
Definition at line 77 of file Element.hpp.
bool Element::touchable = false |
whether or not this element can be touched (highlights bounds)
Definition at line 80 of file Element.hpp.
bool Element::useColorMask = false |
whether or not to overlay a color mask on top of this element
Definition at line 177 of file Element.hpp.
Referenced by Texture::render().
int Element::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))
Definition at line 120 of file Element.hpp.
Referenced by Texture::loadPath(), NetImageElement::NetImageElement(), EKeyboard::process(), Button::render(), EKeyboard::render(), render(), NetImageElement::render(), Texture::render(), Texture::resize(), screenshot(), and TextElement::update().
int Element::x = 0 |
Definition at line 125 of file Element.hpp.
int Element::xAbs = 0 |
Definition at line 128 of file Element.hpp.
int Element::xOff = 0 |
Definition at line 133 of file Element.hpp.
int Element::y = 0 |
Definition at line 125 of file Element.hpp.
int Element::yAbs = 0 |
Definition at line 128 of file Element.hpp.
int Element::yOff = 0 |
Definition at line 133 of file Element.hpp.