gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
body.hpp
Go to the documentation of this file.
1
2#pragma once
3
5#include "core/color.hpp"
6
7namespace ui {
8
15class Body : public SingleChildWidget {
17 color_t backgroundColor;
18
19public:
26 Body(Widget *child, color_t backgroundColor = COLOR_BLACK, const Padding &padding = {0});
27
28 void draw() const override;
29 Size size() const override;
30 Bounds bounds() const override;
31
36 void setColor(color_t new_color);
37
38 DERIVE_EVENT_HANDLERS(Body)
39};
40
41} // namespace ui
The root widget of a UI.
Definition body.hpp:15
Bounds bounds() const override
Get the rendering bounds of this widget.
Size size() const override
Get the size of the widget.
void setColor(color_t new_color)
Set the background color.
void draw() const override
Render the widget to the screen.
Body(Widget *child, color_t backgroundColor=COLOR_BLACK, const Padding &padding={0})
Construct the body with an optional color and padding for the child widget.
The common interface for a widget that contains a single child.
Definition single_child_widget.hpp:11
Widget * child
The child widget.
Definition single_child_widget.hpp:14
The common interface for all UI objects.
Definition widget.hpp:27
Padding padding
The padding that will be applied to any child widgets.
Definition widget.hpp:51
uint16_t color_t
An RGB565 color value. 5 bits red, 6 bits green, 5 bits blue.
Definition color.hpp:13
A struct that holds the pixel space that a widget would take up on the screen.
Definition bounds.hpp:11
A struct that holds the padding that a parent widget may impose on a child widget.
Definition padding.hpp:13
A struct that holds the number of pixels that a widget would take up on the screen.
Definition size.hpp:17