CYD-UI
A C++ library for building native graphic user interfaces
Loading...
Searching...
No Matches
component_attributes.cppm
Go to the documentation of this file.
1// Copyright (c) 2024, Víctor Castillo Agüero.
2// SPDX-License-Identifier: GPL-3.0-or-later
3
5
6import std;
7
8export import reflect;
9
10export import cydui.dimensions;
11import cydui.graphics;
12
13export import :holder;
14
15export
17 struct attribute_i {
18 virtual ~attribute_i() = default;
19 };
21 using content = std::vector<cydui::components::component_builder_t>;
22
23 template<typename E>
24 struct attr_content: public attribute_i {
25 template<typename S = E, typename = std::enable_if_t<!std::is_void_v<S>>>
26 inline S &operator()(content &&_content_) {
27 this->_content = _content_;
28 return *(E*)this;
29 }
30
31 template<typename S = E, typename = std::enable_if_t<!std::is_void_v<S>>>
32 inline S &operator()(content &_content_) {
33 this->_content = _content_;
34 return *(E*)this;
35 }
36
37 template<typename S = E, typename = std::enable_if_t<std::is_void_v<S>>>
38 inline void operator()(content &&_content_) {
39 this->_content = _content_;
40 }
41
42 template<typename S = E, typename = std::enable_if_t<std::is_void_v<S>>>
43 inline void operator()(content &_content_) {
44 this->_content = _content_;
45 }
47 content _content { };
49 bool operator==(const attr_content &rhl) const {
50 if (this->_content.size() != rhl._content.size()) {
51 return false;
52 }
53
54 // TODO - Should I deep compare every child?
55
56 return true;
57 }
58 };
59
60 template<typename T = void>
62 bool operator==(const attrs_component &rhl) const {
64 }
68
69 return *this;
70 }
71 };
72
73#undef COMPONENT_ATTRIBUTE
74#undef COMPONENT_ATTRIBUTE_W_MONITOR
75}
std::vector< cydui::components::component_builder_t > content
S & operator()(content &&_content_)
bool operator==(const attr_content &rhl) const
virtual ~attribute_i()=default
attrs_component & update_with(const attrs_component &rhl)
bool operator==(const attrs_component &rhl) const