File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,17 @@ namespace Nui::Dom
49
49
if (value)
50
50
element_.call <Nui::val>(" setAttribute" , Nui::val{std::string{key}}, Nui::val{" " });
51
51
}
52
- void setAttribute (std::string_view key, int value)
52
+ template <typename T>
53
+ requires std::integral<T>
54
+ void setAttribute (std::string_view key, T value)
53
55
{
54
- element_.call <Nui::val>(" setAttribute" , Nui::val{std::string{key}}, Nui::val{value});
56
+ element_.call <Nui::val>(" setAttribute" , Nui::val{std::string{key}}, Nui::val{static_cast < int >( value) });
55
57
}
56
- void setAttribute (std::string_view key, double value)
58
+ template <typename T>
59
+ requires std::floating_point<T>
60
+ void setAttribute (std::string_view key, T value)
57
61
{
58
- element_.call <Nui::val>(" setAttribute" , Nui::val{std::string{key}}, Nui::val{value});
62
+ element_.call <Nui::val>(" setAttribute" , Nui::val{std::string{key}}, Nui::val{static_cast < double >( value) });
59
63
}
60
64
void setAttribute (std::string_view key, Nui::val value)
61
65
{
Original file line number Diff line number Diff line change @@ -345,9 +345,9 @@ namespace Nui
345
345
// Children functions:
346
346
template <typename ... ElementT>
347
347
requires requires (ElementT&&... elements) {
348
- std::vector<std::function<std::shared_ptr<Dom::Element>(Dom::Element&, Renderer const &)>>{
349
- std::forward<ElementT>(elements)...};
350
- }
348
+ std::vector<std::function<std::shared_ptr<Dom::Element>(Dom::Element&, Renderer const &)>>{
349
+ std::forward<ElementT>(elements)...};
350
+ }
351
351
auto operator ()(ElementT&&... elements) &&
352
352
{
353
353
return std::function<std::shared_ptr<Dom::Element>(Dom::Element&, Renderer const &)>{
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
+ #include < nui/frontend/elements/impl/html_element.hpp>
4
+
3
5
#define NUI_DECLARE_SVG_ELEMENT_RENAME (NAME, HTML_ACTUAL ) \
4
6
namespace Nui ::Elements::Svg \
5
7
{ \
6
8
struct NAME : HtmlElement \
7
9
{ \
8
- constexpr NAME (NAME const &) = default; \
9
- constexpr NAME (NAME&&) = default; \
10
- constexpr NAME (std::vector<Attribute> const & attributes) \
10
+ HTML_ELEMENT_CONSTEXPR NAME (NAME const &) = default; \
11
+ HTML_ELEMENT_CONSTEXPR NAME (NAME&&) = default; \
12
+ HTML_ELEMENT_CONSTEXPR NAME (std::vector<Attribute> const & attributes) \
11
13
: HtmlElement{HTML_ACTUAL, &SvgElementBridge, attributes} \
12
14
{} \
13
- constexpr NAME (std::vector<Attribute>&& attributes) \
15
+ HTML_ELEMENT_CONSTEXPR NAME (std::vector<Attribute>&& attributes) \
14
16
: HtmlElement{HTML_ACTUAL, &SvgElementBridge, std::move (attributes)} \
15
17
{} \
16
18
template <typename ... T> \
17
- constexpr NAME (T&&... attributes) \
19
+ HTML_ELEMENT_CONSTEXPR NAME (T&&... attributes) \
18
20
: HtmlElement{HTML_ACTUAL, &SvgElementBridge, std::forward<T>(attributes)...} \
19
21
{} \
20
22
}; \
You can’t perform that action at this time.
0 commit comments