5#include "TinyGPU/Color/RGB565.h"
6#include "TinyGPU/Color/RGB666.h"
7#include "TinyGPU/Color/RGB888.h"
8#include "TinyMaterialDesign/Core/Container.h"
9#include "TinyMaterialDesign/Core/Widget.h"
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
44 this->bounds = bounds;
45 items_.bounds = bounds;
60 typename Container<RGB_T>::ChildAtFn at) {
61 items_.setChildProvider(std::move(count), std::move(at));
65 Widget<RGB_T>::setTheme(theme);
66 items_.setTheme(theme);
71 return Bounds(
this->bounds.x,
this->bounds.y + index * height,
this->bounds.w, height);
74 void draw(tinygpu::ISurface<RGB_T>& target)
override {
75 drawBackground(target);
76 items_.bounds =
this->bounds;
83 const size_t radius = toPx(
this->theme().shape.medium);
84 target.fillRoundRect(toPx(
this->bounds.x), toPx(
this->bounds.y), toPx(
this->bounds.w),
85 toPx(
this->bounds.h), radius,
this->theme().colors.surface);
86 target.drawRoundRect(toPx(
this->bounds.x), toPx(
this->bounds.y), toPx(
this->bounds.w),
87 toPx(
this->bounds.h), radius,
this->theme().colors.outline);
90 int childCount()
const override {
return items_.childCount(); }
91 Widget<RGB_T>*
child(
int index)
override {
return items_.child(index); }
93 bool onGesture(
const tinygpu::GestureEvent& event)
override {
94 items_.bounds =
this->bounds;
96 if (Container<RGB_T>::isContinuousType(event.type)) {
97 if (event.phase == tinygpu::GesturePhase::kBegan) {
98 routingToItems_ = items_.bounds.contains(event.startPoint.x, event.startPoint.y);
100 return routingToItems_ ? items_.onGesture(event) :
true;
103 if (items_.bounds.contains(event.point.x, event.point.y) && items_.onGesture(event)) {
106 if (isTapGesture(event.type) && !
this->bounds.contains(event.point.x, event.point.y)) {
107 if (onOutsideTap) onOutsideTap();
112 bool update(uint32_t nowMs)
override {
return items_.update(nowMs); }
117 return items_.bounds.contains(x, y) && items_.isDraggableAt(x, y);
122 bool routingToItems_ =
false;
A widget that holds child widgets, draws/dispatches gestures to them, and scrolls its content vertica...
Definition: Container.h:56
Definition: AnchorLayout.h:4
Axis-aligned pixel rectangle used for widget bounds and hit-testing.
Definition: Bounds.h:21
Bundles a color scheme, shape tokens, typography, and spacing into one theme, passed to widgets so th...
Definition: MaterialTheme.h:50