32template <
typename Self,
typename Constructed>
36 static_assert(std::is_base_of<gridui::Widget, Constructed>::value,
"Constructed must inherit from gridui::Widget.");
43 Self&
css(
const std::string& key,
const std::string& value) {
45 s.style().set(key, value);
50 return Constructed(&self().m_state);
55 auto* cbHeap =
static_cast<void*
>(
new callback_t(cb));
56 self().m_state.addCallback(&callbackTrampoline, &callbackDeleter, name, cbHeap);
60 Self& self() {
return *
static_cast<Self*
>(
this); }
61 const Self& self()
const {
return *
static_cast<Self*
>(
this); }
63 static void callbackTrampoline(
void* cb, WidgetState* state) {
68 static void callbackDeleter(
void *cb) {
77 template <
typename Self,
typename Finished>
90 rbjson::Object&
extra();
91 rbjson::Object&
style();
Self & css(const std::string &key, const std::string &value)
std::function< void(Constructed &)> callback_t
void addCallback(const std::string &name, const callback_t &cb)