gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
panel.hpp
Go to the documentation of this file.
1
2#pragma once
3
5#include "core/color.hpp"
6#include "core/radius.hpp"
7#include "core/size.hpp"
8
9namespace ui {
10
18class Panel : public SingleChildWidget {
19 color_t color;
20 Size panelSize;
21 radius_t borderRadius;
22
23public:
34 Panel(Widget *child, color_t color, const Size &size = {0, 0}, radius_t borderRadius = 0, const Position &pos = {0, 0}, const Alignment &align = {ALIGN_LEFT, ALIGN_TOP}, const Padding &padding = {0});
35
36 void draw() const override;
37 void update(time_t time_ms) override;
38 void drawDone() override;
39 Size size() const override;
40
45 void setColor(color_t new_color);
46
52
57 void setBorderRadius(radius_t new_radius);
58
59 DERIVE_EVENT_HANDLERS(Panel)
60};
61
62} // namespace ui
A basic widget that displays a rounded rectangle behind another widget.
Definition panel.hpp:18
void drawDone() override
Reset any state variables after rendering has finished.
color_t getColor() const
Get the current widget color.
Panel(Widget *child, color_t color, const Size &size={0, 0}, radius_t borderRadius=0, const Position &pos={0, 0}, const Alignment &align={ALIGN_LEFT, ALIGN_TOP}, const Padding &padding={0})
Construct a panel with optional configuration.
void setColor(color_t new_color)
Set the panel color.
Size size() const override
Get the size of the widget.
void draw() const override
Render the widget to the screen.
void setBorderRadius(radius_t new_radius)
Set the border radius.
void update(time_t time_ms) override
Update any internal state of the widget, and check if it needs to be re-rendered.
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
uint16_t radius_t
A non-negative size for the pixel radius of curved shapes.
Definition radius.hpp:12
A struct that holds the normalized position of a widget.
Definition position.hpp:15
A struct that holds the number of pixels that a widget would take up on the screen.
Definition size.hpp:17