25 #include "eng3d/ui/table.hpp"
26 #include "eng3d/ui/widget.hpp"
27 #include "eng3d/ui/ui.hpp"
28 #include "eng3d/ui/div.hpp"
29 #include "eng3d/ui/label.hpp"
30 #include "eng3d/ui/scrollbar.hpp"
31 #include "eng3d/texture.hpp"
32 #include "eng3d/rectangle.hpp"
33 #include "eng3d/state.hpp"
42 key_type = UI::TableElement::KeyType::STRING;
47 key_type = UI::TableElement::KeyType::NUMBER;
53 key_type = UI::TableElement::KeyType::NUMBER;
58 if(this->key_type != right.key_type)
59 return this->key_type < right.key_type;
61 switch(this->key_type) {
62 case UI::TableElement::KeyType::NUMBER:
return this->key_number < right.key_number;
63 case UI::TableElement::KeyType::STRING:
return this->key_string < right.key_string;
64 case UI::TableElement::KeyType::NONE:
return false;
66 CXX_THROW(std::runtime_error,
"TableElement KeyType not supported");
71 columns_width{ _columns_width }
76 elements.resize(this->columns_width.size());
77 std::transform(this->columns_width.cbegin(), this->columns_width.cend(), elements.begin(), [
this](
const auto e) {
78 return &this->make_widget<UI::TableElement>(e, this->height);
85 glm::ivec2 size(5, 5);
86 glm::ivec2 texture_size(63, 63);
90 auto& tex_man = s.tex_man;
91 auto border_tex = tex_man.load(s.package_man.get_unique(
"gfx/test.png"));
101 assert(index < elements.size());
102 return elements[index];
static State & get_instance()
Border class that defines the texture and size of borders of the widgets.
std::shared_ptr< Eng3D::Texture > texture
An element on a table, operates on a k=v fashion where the key is used for sorting the table.
void set_key(const std::string &key)
TableElement(int width, int height, UI::Widget *_parent)
bool operator<(const UI::TableElement &right) const
UI::TableElement * get_element(size_t index)
TableRow(int width, int height, std::vector< int > &columns_width, UI::Widget *_parent)
WidgetType
The type of the widget, some widgets share types between them to keep simplicity.
std::string string_format(const std::string_view format, Args &&... args)
String formatter.
#define CXX_THROW(class,...)