gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
ui::Row Class Reference

A container widget that horizontally organizes its children into a structured row. More...

#include <row.hpp>

Inheritance diagram for ui::Row:
ui::Collection ui::MultiChildWidget ui::Widget ui::EventHandlers< Widget > ui::CoreEventHandlers< T >

Public Member Functions

void update (time_t time) override
 Update any internal state of the widget, and check if it needs to be re-rendered.
 
void push (Widget *const child) override
 Append a child widget to the end of the list.
 
void setMinWidth (uisize_t minWidth)
 Set the minimum width of each cell in the row.
 
void setChildAlign (align_t align)
 Set where to start when displaying child widgets; on the left, or right.
 
uisize_t getMinWidth () const
 Get the minimum width of each cell in the row.
 
align_t getChildAlign () const
 Get where to start when displaying child widgets; on the left, or right.
 
 Collection (const Size &size, const Position &pos={0, 0}, const Alignment &align={ALIGN_LEFT, ALIGN_TOP}, const Padding &padding={0})
 Construct a collection.
 
- Public Member Functions inherited from ui::Collection
 Collection (const Size &size, const Position &pos={0, 0}, const Alignment &align={ALIGN_LEFT, ALIGN_TOP}, const Padding &padding={0})
 Construct a collection.
 
Size size () const override
 Get the size of the widget.
 
- Public Member Functions inherited from ui::MultiChildWidget
 MultiChildWidget (const Position &pos={0, 0}, const Alignment &align={ALIGN_LEFT, ALIGN_TOP}, const Padding &padding={0})
 Constructor.
 
 ~MultiChildWidget () override
 Destructor.
 
void render (bool force) const override
 Recursively render this widget and any child widgets that need it.
 
void drawDone () override
 Reset any state variables after rendering has finished.
 
void draw () const override
 Render the widget to the screen.
 
bool handleEvent (Event &event) override
 Handle events from the touchscreen.
 
virtual void drawBoundingBox (time_t time) const override
 Render the bounding box of this and any child widgets.
 
WidgetgetWidgetById (id_t id) noexcept override
 Get the first widget (this or any children) that has the given ID.
 
- Public Member Functions inherited from ui::Widget
 Widget (const Position &pos={0, 0}, const Alignment &align={ALIGN_LEFT, ALIGN_TOP}, const Padding &padding={0})
 The default widget constructor.
 
virtual ~Widget ()
 The default widget destructor.
 
virtual Bounds bounds () const
 Get the rendering bounds of this widget.
 
void setPosition (const Position &pos)
 Set the position of this widget.
 
Position getPosition () const
 Get the position of this widget.
 
void setAlign (const Alignment &align)
 Set the alignment of this widget.
 
void requestRedraw ()
 Tell this widget that it needs to be re-rendered.
 
void requestParentRedraw ()
 Tell the parent widget that it needs to be re-rendered.
 
bool needsRedraw () const
 Check if this widget has requested to be redrawn.
 
void setParent (Widget *parent)
 Set the parent widget.
 
Bounds parentBounds () const
 Get the bounds of the parent widget, if any.
 
void onpress (std::function< void(Widget &, const Event &)> callback) override
 Register a touchscreen event handler that triggers on press.
 
void onblur (std::function< void(Widget &, const Event &)> callback) override
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
void onhold (std::function< void(Widget &, const Event &, time_t)> callback) override
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onrelease (std::function< void(Widget &, const Event &)> callback) override
 Register a touchscreen event handler that triggers on release.
 
void click ()
 Manually trigger the onrelease event handler.
 
void press ()
 Manually trigger the onpress event handler.
 
void blur ()
 Manually trigger the onblur event handler.
 
void release ()
 Manually trigger the onrelease event handler.
 
void hold (time_t time)
 Manually trigger the onhold event handler.
 
- Public Member Functions inherited from ui::EventHandlers< Widget >
void onpress (std::function< void(Widget &)> callback)
 Register a touchscreen event handler that triggers on press.
 
void onpress (std::function< void(const Event &)> callback)
 Register a touchscreen event handler that triggers on press.
 
void onpress (std::function< void()> callback)
 Register a touchscreen event handler that triggers on press.
 
void onrelease (std::function< void(Widget &)> callback)
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
void onrelease (std::function< void(const Event &)> callback)
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
void onrelease (std::function< void()> callback)
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
void onblur (std::function< void(Widget &)> callback)
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
void onblur (std::function< void(const Event &)> callback)
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
void onblur (std::function< void()> callback)
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
void onhold (std::function< void(Widget &, time_t)> callback)
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onhold (std::function< void(const Event &, time_t)> callback)
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onhold (std::function< void(time_t)> callback)
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onhold (std::function< void(Widget &)> callback)
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onhold (std::function< void(const Event &)> callback)
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onhold (std::function< void()> callback)
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onclick (std::function< void(Widget &)> callback)
 Register a touchscreen event handler that triggers on release.
 
void onclick (std::function< void(const Event &)> callback)
 Register a touchscreen event handler that triggers on release.
 
void onclick (std::function< void()> callback)
 Register a touchscreen event handler that triggers on release.
 
- Public Member Functions inherited from ui::CoreEventHandlers< T >
virtual void onpress (std::function< void(T &, const Event &)> callback)=0
 Register a touchscreen event handler that triggers on press.
 
virtual void onrelease (std::function< void(T &, const Event &)> callback)=0
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
virtual void onblur (std::function< void(T &, const Event &)> callback)=0
 Register a touchscreen event handler that triggers when the widget stops being pressed.
 
virtual void onhold (std::function< void(T &, const Event &, time_t)> callback)=0
 Register a touchscreen event handler that repeatedly triggers when the widget is held for a while.
 
void onclick (std::function< void(T &, const Event &)> callback)
 Register a touchscreen event handler that triggers on release.
 

Additional Inherited Members

- Public Attributes inherited from ui::Widget
id_t id
 An optional (usually unique) identifier that can be used to search for this widget.
 
- Protected Attributes inherited from ui::MultiChildWidget
std::vector< Widget * > children
 The child widgets.
 
- Protected Attributes inherited from ui::Widget
Padding padding
 The padding that will be applied to any child widgets.
 
bool redrawSelf
 If true, force a redraw of this widget and any child widgets.
 

Detailed Description

A container widget that horizontally organizes its children into a structured row.

Member Function Documentation

◆ Collection()

ui::Collection::Collection ( const Size size,
const Position pos = {0, 0},
const Alignment align = {ALIGN_LEFT, ALIGN_TOP},
const Padding padding = {0} 
)

Construct a collection.

Parameters
sizeThe size of this container widget.
posThe position of this widget relative to its parent.
alignThe alignment of this widget relative to its parent.
paddingThe padding to apply to the child widget.

◆ getChildAlign()

align_t ui::Row::getChildAlign ( ) const
inline

Get where to start when displaying child widgets; on the left, or right.

Returns
The alignment of cells in the row.

◆ getMinWidth()

uisize_t ui::Row::getMinWidth ( ) const
inline

Get the minimum width of each cell in the row.

Returns
The minimum cell width.

◆ push()

void ui::Row::push ( Widget *const  child)
overridevirtual

Append a child widget to the end of the list.

Parameters
childThe new child widget.

Reimplemented from ui::MultiChildWidget.

◆ setChildAlign()

void ui::Row::setChildAlign ( align_t  align)

Set where to start when displaying child widgets; on the left, or right.

If align is ui::ALIGN_LEFT, then child widgets are rendered from left to right. If align is ui::ALIGN_RIGHT, then child widgets are rendered from right to left.

Note
ui::ALIGN_CENTER is undefined behavior and should not be used, for the sake of clarity at least.

◆ setMinWidth()

void ui::Row::setMinWidth ( uisize_t  minWidth)

Set the minimum width of each cell in the row.

Parameters
minWidthThe minimum cell width.

◆ update()

void ui::Row::update ( time_t  time)
overridevirtual

Update any internal state of the widget, and check if it needs to be re-rendered.

Parameters
timeThe current time in milliseconds.

Reimplemented from ui::MultiChildWidget.


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