modm API documentation
|
#include <modm/ui/gui/widgets/button.hpp>
Public Member Functions | |
ButtonWidget (const char *lbl, Dimension d) | |
void | render (View *view) |
Draws the widget on screen. Each widget need to implement this. | |
void | setLabel (char *lbl) |
virtual void | activate (const InputEvent &ev, void *data) |
Interface for activating widget. Calls callback function if specified. | |
bool | checkIntersection (Widget *w) |
virtual void | deactivate (const InputEvent &ev, void *data) |
Interface for deactivating widget. Calls callback function if specified. | |
void | draw (View *view) |
ColorPalette & | getColorPalette () |
Get widget-specific color palette. NOT YET USED. | |
modm::gui::Dimension | getDimension () |
Get dimension of widget. | |
int16_t | getHeight () |
Get height of widget. Shortcut for getDimension().height. | |
modm::glcd::Point | getPosition () |
Get absolute position of widget on screen. | |
modm::glcd::Point | getRelativePosition () |
Get position of widget relative to its parent. | |
int16_t | getWidth () |
Get width of widget. Shortcut for getDimension().width. | |
virtual bool | handleInputEvent (const InputEvent *ev) |
bool | hasIntersections () |
Whether there are other widgets overlapping this one on top | |
virtual bool | isDirty () |
Whether widget needs to be redrawn or not. | |
bool | isInteractive () |
Whether widget can handle input events. | |
virtual void | markDirty () |
Mark widget, that it needs to be redrawn. | |
virtual void | markDrawn () |
Mark widget, that it doesn't need to be redrawn anymore. | |
void | setCallbackData (void *data) |
void | setColor (modm::gui::Color name, modm::color::Rgb565 color) |
virtual void | setColorPalette (ColorPalette &cp) |
Set widget-specific color palette. | |
virtual void | setFont (const uint8_t *newFont) |
Set widget-specific font. Use modm::font::FontName as argument. | |
virtual void | setFont (const modm::accessor::Flash< uint8_t > *font) |
Set widget-specific font. Use pointer to Flash as argument. | |
void | setParent (Widget *parent) |
Set parent for widget, updates the absolute position afterwards. | |
virtual void | setPosition (const modm::glcd::Point &pos) |
void | setRelativePosition (const modm::glcd::Point &pos) |
Only set the relative position. | |
void | updateIntersections (WidgetContainer *widgets) |
virtual void | updatePosition () |
Public Attributes | |
bool | activated |
where this widget is active or not (e.g. clicked) | |
void * | cbData |
arbitrary data that is passed to callbacks | |
eventCallback | cb_activate |
callbacks for activation and deactivation event | |
eventCallback | cb_deactivate |
ColorPalette | color_palette |
for now unused, maybe needed later for custom styles | |
Dimension | dimension |
dimensions | |
bool | dirty |
has changes to be drawed | |
modm::accessor::Flash< uint8_t > | font |
widget specific font | |
WidgetContainer | intersecting_widgets |
list of widgets that intersect with this widget | |
bool | is_interactive |
whether widget will receive events | |
Widget * | parent |
Parent widget, NULL when there's no parent. | |
modm::glcd::Point | position |
modm::glcd::Point | relative_position |
relative position inside a WidgetGroup for exemple | |
int16_t | uid |
Unique id for every widget. | |
|
inherited |
Check if given Widget w overlaps on top. For widgets overlapping below this function also returns false.
|
inheritedinline |
Interface for drawing widgets. Basically calls render(), but has some logic that needs to be executed before and after rendering a widget
|
inheritedvirtual |
Handles InputEvents and calls activate/deactivate if event coordinates are within widgets dimensions. Returning true means, that the event was inside these dimensions, false if not.
Reimplemented in modm::gui::WidgetGroup.
|
inheritedinlinevirtual |
Set position of widget relative to its parent. Also updates the absolute position by looping through parents.
Reimplemented in modm::gui::WidgetGroup.
|
inherited |
Clear old list of intersecting widgets and rebuild on the basis of the given widgets container.
|
inheritedinlinevirtual |
Updates the absolute position by looping through all parents and adding up their relative positions.
Reimplemented in modm::gui::WidgetGroup.
|
inherited |
position on screen (used for rendering), may be recomputed based on relative position