3#include "base_container_widget.hpp"
4#include <bugui/concepts/widget.hpp>
11template <
typename T,
bool can_delete = true>
13 :
deleter<T, base_container_widget, can_delete>
18 void update()
override final;
59template <
typename T,
bool can_delete>
63 static_cast<T*
>(
this)->set();
65 for (
auto& c : this->children) c->update();
68template <
typename T,
bool can_delete>
71 this->held.push_back(
widget);
74 static_cast<T*
>(
this)->on_held_added();
77template <
typename T,
bool can_delete>
80 if (this->held.empty())
return;
82 const auto it{std::find(this->held.begin()
83 , this->held.end(),
widget)};
84 if (it == this->held.end())
return;
88 static_cast<T*
>(
this)->on_held_removed();
91template <
typename T,
bool can_delete>
94 auto x_offset{this->parent->get_x()};
95 auto y_offset{this->parent->get_y()};
99 auto x{this->get_x()};
100 auto y{this->get_y()};
103 static_cast<const T*
>(
this)->paint(
painter);
109 for (
const auto& c : this->children) c->handle_painter(
painter);
114template <
typename T,
bool can_delete>
117 auto p_x{this->parent->get_x()};
118 auto p_y{this->parent->get_y()};
128 for (
const auto& c : this->children)
129 if (c->handle_presser(
presser))
135 : this->parent->remove_held(
this);
139 this->parent->remove_held(
this);
148 auto x{this->get_x()};
149 auto y{this->get_y()};
150 auto x_offset{x + p_x};
151 auto y_offset{y + p_y};
166 static_cast<T*
>(
this)->on_double_press(
presser);
174 static_cast<T*
>(
this)->on_drag(
presser);
182 this->parent->remove_held(
this);
183 static_cast<T*
>(
this)->on_drop(
presser);
190 : this->parent->remove_held(
this);
193 static_cast<T*
>(
this)->on_press(
presser);
199template <
typename T,
bool can_delete>
204 static_cast<T*
>(
this)->on_child_Delete();
Allows derived class to call a user defined on_Delete function.
Definition deleter.hpp:14
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.