modm API documentation
modm::gui::CheckboxWidget Class Reference

#include <modm/ui/gui/widgets/checkbox.hpp>

Inheritance diagram for modm::gui::CheckboxWidget:
modm::gui::Widget

Public Member Functions

 CheckboxWidget (bool initial, Dimension d)
 
void render (View *view)
 Draws the widget on screen. Each widget need to implement this.
 
bool getState ()
 
void setState (bool s)
 
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)
 
ColorPalettegetColorPalette ()
 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
 
Widgetparent
 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.
 

Detailed Description

Author
Daniel Krebs

Member Function Documentation

bool modm::gui::Widget::checkIntersection ( Widget *  w)
inherited

Check if given Widget w overlaps on top. For widgets overlapping below this function also returns false.

void modm::gui::Widget::draw ( View view)
inheritedinline

Interface for drawing widgets. Basically calls render(), but has some logic that needs to be executed before and after rendering a widget

bool modm::gui::Widget::handleInputEvent ( const InputEvent ev)
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.

virtual void modm::gui::Widget::setPosition ( const modm::glcd::Point pos)
inheritedinlinevirtual

Set position of widget relative to its parent. Also updates the absolute position by looping through parents.

Reimplemented in modm::gui::WidgetGroup.

void modm::gui::Widget::updateIntersections ( WidgetContainer widgets)
inherited

Clear old list of intersecting widgets and rebuild on the basis of the given widgets container.

virtual void modm::gui::Widget::updatePosition ( )
inheritedinlinevirtual

Updates the absolute position by looping through all parents and adding up their relative positions.

Reimplemented in modm::gui::WidgetGroup.

Member Data Documentation

modm::glcd::Point modm::gui::Widget::position
inherited

position on screen (used for rendering), may be recomputed based on relative position


The documentation for this class was generated from the following files: