2#include "ctrlr_shifter.hpp"
3#include <io/painter.hpp>
4#include <devices/all.hpp>
5#include <io/button_painter.hpp>
6#include <widgets/container_widget.hpp>
20 void update()
override final;
27 explicit controller(std::string_view device_name)
31 ::get(device_name,
static_cast<T*
>(
this))}
42inline void controller<T>::update()
44 if constexpr (has_set<T>)
45 static_cast<T*
>(
this)->set();
47 for (
auto& c : this->children) c->update();
53 this->held.push_back(
widget);
56 static_cast<T*
>(
this)->on_held_added();
62 if (this->held.empty())
return;
64 const auto it{std::find(this->held.begin(), this->held.end()
66 if (it == this->held.end())
return;
70 static_cast<T*
>(
this)->on_held_removed();
78 auto x{this->get_x()};
79 auto y{this->get_y()};
82 static_cast<const T*
>(
this)->paint(
painter);
86 for (
const auto& c : this->children) c->handle_painter(
painter);
92 for (
const auto& c : this->children)
96 presser.ofset(-this->get_x(), -this->get_y());
103 static_cast<T*
>(
this)->on_double_press(
presser);
107 static_cast<T*
>(
this)->on_drag(
presser);
111 static_cast<T*
>(
this)->on_drop(
presser);
115 static_cast<T*
>(
this)->on_press(
presser);
123 this->paint.set(this->get_x(), this->get_y());
124 this->paint.bound_at_offset(
this);
127 static_cast<T*
>(
this)->paint(this->paint);
130 for (
const auto& c : this->children)
131 c->handle_painter(this->paint);
133 this->hdw->set_grid(this->paint);
Provides base functionalities of the hardware object, and enables access from the base_controller.
Definition base_hardware.hpp:11
bool handle_child_Delete() override final
garanties that ctrlr_deleter::recursive_child_Delete returns
Definition controller.hpp:38
void repaint() override final
Calls for this widget to be repainted.
Definition controller.hpp:121
Ensures that buttons labeled Shift are registered on press and can be queried with Shift_held,...
Definition ctrlr_shifter.hpp:12
Instantiate a hardware object specialised with a specific device.
Definition hardware_factory.hpp:12
The painter class.
Definition painter.hpp:12
Definition presser.hpp:14