38 #include <glm/vec2.hpp>
40 #include "eng3d/ttf.hpp"
41 #include "eng3d/rectangle.hpp"
42 #include "eng3d/color.hpp"
43 #include "eng3d/utils.hpp"
155 std::shared_ptr<Eng3D::Texture>
texture =
nullptr;
161 Border(std::shared_ptr<Eng3D::Texture> _texture, glm::ivec2 _size, glm::ivec2 _texture_size, glm::ivec2 _offset = glm::ivec2(0))
177 void recalc_child_pos();
182 inline void notice_death() {
183 if(!this->dead_child) {
184 this->dead_child =
true;
186 this->
parent->notice_death();
190 bool need_recalc =
false;
192 std::string text_str;
193 bool is_clickable =
false;
195 bool dead_child =
false;
214 constexpr
void move_by(
const glm::ivec2 offset) {
221 template<
typename T,
typename ... Targs>
224 auto p =
new T(std::forward<decltype(args)>(args)...,
this);
229 virtual void set_text(
const std::string& text);
232 virtual void set_tooltip(std::function<std::string()> tooltip_text_creator);
243 this->y = rhs.
y - this->
height;
251 this->x = rhs.
x - this->
width;
255 this->x = rhs.
x + rhs.
width;
268 virtual void set_on_drag(std::function<
void(glm::ivec2, glm::ivec2)> _on_drag) {
277 std::sort(this->
children.begin(), this->children.end(), comp);
278 this->need_recalc =
true;
286 this->notice_death();
297 cnt += child->height;
333 std::shared_ptr<Eng3D::TrueType::Font>
font;
348 std::function<void(glm::ivec2 mouse_pos, glm::ivec2 mouse_delta)>
on_drag;
Border class that defines the texture and size of borders of the widgets.
std::shared_ptr< Eng3D::Texture > texture
Border(std::shared_ptr< Eng3D::Texture > _texture, glm::ivec2 _size, glm::ivec2 _texture_size, glm::ivec2 _offset=glm::ivec2(0))
Generalized chart data, used mostly by chart widgets, however it's not specific to any widget.
ChartData(float _num, std::string _info, Eng3D::Color _color)
ChartData(float _num, std::string _info, uint32_t rgb)
The UI context that handles all the ui widgets.
WidgetType
The type of the widget, some widgets share types between them to keep simplicity.
Flex
Ordering mode for flex.
FlexJustify
Justification alignment for flex.
Origin
The origin of the widget.
Primitive color type used through the engine.