modm API documentation
modm::gui::WidgetGroup Class Reference

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

Inheritance diagram for modm::gui::WidgetGroup:
modm::gui::Widget modm::gui::NumberRocker< T > modm::gui::StringRocker modm::gui::TabPanel

Public Member Functions

 WidgetGroup (Dimension d)
 
bool pack (Widget *w, const modm::glcd::Point &coord)
 packs widgets inside WidgetGroup (relative coordinates!)
 
void render (View *view)
 Draws the widget on screen. Each widget need to implement this.
 
bool handleInputEvent (const InputEvent *ev)
 
void setColorPalette (ColorPalette &cb)
 Set widget-specific color palette.
 
void setPosition (const modm::glcd::Point &pos)
 
bool isDirty ()
 Whether widget needs to be redrawn or not.
 
void markDirty ()
 Mark widget, that it needs to be redrawn.
 
void markDrawn ()
 Mark widget, that it doesn't need to be redrawn anymore.
 
void updatePosition ()
 
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.
 
bool hasIntersections ()
 Whether there are other widgets overlapping this one on top
 
bool isInteractive ()
 Whether widget can handle input events.
 
void setCallbackData (void *data)
 
void setColor (modm::gui::Color name, modm::color::Rgb565 color)
 
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.
 
void setRelativePosition (const modm::glcd::Point &pos)
 Only set the relative position.
 
void updateIntersections (WidgetContainer *widgets)
 

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.
 

Protected Attributes

WidgetContainer widgets
 

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::WidgetGroup::handleInputEvent ( const InputEvent ev)
virtual

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 from modm::gui::Widget.

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

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

Reimplemented from modm::gui::Widget.

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

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

void modm::gui::WidgetGroup::updatePosition ( )
inlinevirtual

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

Reimplemented from modm::gui::Widget.

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: