2#include "ctrlr_shifter.hpp"
3#include "ctrlr_deleter.hpp"
4#include <bugui/io/painter.hpp>
5#include <bugui/devices/all.hpp>
6#include <bugui/io/button_painter.hpp>
7#include <bugui/widgets/container_widget.hpp>
23 void update()
override final;
29 stdx::error set_midi_in_port
30 (
const libremidi::observer& observer
31 , std::string_view port_name)
32 {
return this->hdw->set_midi_in_port(observer, port_name); };
34 stdx::error set_midi_out_port
35 (
const libremidi::observer& observer
36 , std::string_view port_name)
38 auto ret{this->hdw->set_midi_out_port(observer, port_name)};
44 explicit controller(std::string_view device_name)
49 ::get(device_name,
static_cast<T*
>(
this))}
60inline void controller<T>::update()
62 if constexpr (has_set<T>)
63 static_cast<T*
>(
this)->set();
65 for (
auto& c : this->children) c->update();
71 this->held.push_back(
widget);
74 static_cast<T*
>(
this)->on_held_added();
80 if (this->held.empty())
return;
82 const auto it{std::find(this->held.begin(), this->held.end()
84 if (it == this->held.end())
return;
88 static_cast<T*
>(
this)->on_held_removed();
96 auto x{this->get_x()};
97 auto y{this->get_y()};
100 static_cast<const T*
>(
this)->paint(
painter);
104 for (
const auto& c : this->children) c->handle_painter(
painter);
110 for (
const auto& c : this->children)
111 if (c->handle_presser(
presser))
121 static_cast<T*
>(
this)->on_double_press(
presser);
125 static_cast<T*
>(
this)->on_drag(
presser);
129 static_cast<T*
>(
this)->on_drop(
presser);
133 static_cast<T*
>(
this)->on_press(
presser);
141 this->paint.set(this->get_x(), this->get_y());
142 this->paint.bound_at_offset(
this);
145 static_cast<T*
>(
this)->paint(this->paint);
148 for (
const auto& c : this->children)
149 c->handle_painter(this->paint);
151 this->hdw->set_grid(this->paint);
Provides base functionalities of the hardware object, and enables access from the base_controller.
Definition base_hardware.hpp:12
bool handle_child_Delete() override final
garanties that ctrlr_deleter::recursive_child_Delete returns
Definition controller.hpp:56
void repaint() override final
Calls for this widget to be repainted.
Definition controller.hpp:139
Ensures that buttons labeled Delete triggers the delete funcitonlaity on the widget tree,...
Definition ctrlr_deleter.hpp:12
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
Adds 2D information on top of a base_painter. The painter is used in user defined paint funcions to d...
Definition painter.hpp:17
void ofset(int x, int y)
Increment current displacement values by the given coordinates.
Adds 2D information on top of a button_presser. Meant to traverse the entire widget tree,...
Definition presser.hpp:16
void ofset(int x, int y)
Displaces the underlying rectangle by the given arguments.