add 'refresh' containers method

This commit is contained in:
MihailRis 2025-06-01 17:08:01 +03:00
parent c6f64c34ef
commit 019c93d524

View File

@ -114,6 +114,16 @@ static int l_node_destruct(lua::State* L) {
return 0; return 0;
} }
static int l_container_refresh(lua::State* L) {
auto docnode = get_document_node(L);
auto node = dynamic_cast<Container*>(docnode.node.get());
if (node == nullptr) {
return 0;
}
node->refresh();
return 0;
}
static int l_node_reposition(lua::State* L) { static int l_node_reposition(lua::State* L) {
auto docnode = get_document_node(L); auto docnode = get_document_node(L);
docnode.node->reposition(); docnode.node->reposition();
@ -408,6 +418,13 @@ static int p_get_destruct(UINode*, lua::State* L) {
return lua::pushcfunction(L, lua::wrap<l_node_destruct>); return lua::pushcfunction(L, lua::wrap<l_node_destruct>);
} }
static int p_refresh(UINode* node, lua::State* L) {
if (dynamic_cast<Container*>(node)) {
return lua::pushcfunction(L, lua::wrap<l_container_refresh>);
}
return 0;
}
static int p_get_reposition(UINode*, lua::State* L) { static int p_get_reposition(UINode*, lua::State* L) {
return lua::pushcfunction(L, lua::wrap<l_node_reposition>); return lua::pushcfunction(L, lua::wrap<l_node_reposition>);
} }
@ -539,6 +556,7 @@ static int l_gui_getattr(lua::State* L) {
{"moveInto", p_move_into}, {"moveInto", p_move_into},
{"add", p_get_add}, {"add", p_get_add},
{"destruct", p_get_destruct}, {"destruct", p_get_destruct},
{"refresh", p_refresh},
{"reposition", p_get_reposition}, {"reposition", p_get_reposition},
{"clear", p_get_clear}, {"clear", p_get_clear},
{"setInterval", p_set_interval}, {"setInterval", p_set_interval},