textbox autoresize
This commit is contained in:
@@ -70,6 +70,14 @@ static int l_menu_reset(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_textbox_paste(lua_State* L) {
|
||||
auto node = getDocumentNode(L);
|
||||
auto box = dynamic_cast<TextBox*>(node.node.get());
|
||||
auto text = lua_tostring(L, 2);
|
||||
box->paste(util::str2wstr_utf8(text));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_container_add(lua_State* L) {
|
||||
auto docnode = getDocumentNode(L);
|
||||
auto node = dynamic_cast<Container*>(docnode.node.get());
|
||||
@@ -121,6 +129,13 @@ static int p_get_back(UINode* node) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int p_get_paste(UINode* node) {
|
||||
if (dynamic_cast<TextBox*>(node)) {
|
||||
return state->pushcfunction(l_textbox_paste);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int p_get_page(UINode* node) {
|
||||
if (auto menu = dynamic_cast<Menu*>(node)) {
|
||||
return state->pushstring(menu->getCurrent().name);
|
||||
@@ -289,6 +304,7 @@ static int l_gui_getattr(lua_State* L) {
|
||||
{"page", p_get_page},
|
||||
{"back", p_get_back},
|
||||
{"reset", p_get_reset},
|
||||
{"paste", p_get_paste},
|
||||
{"inventory", p_get_inventory},
|
||||
{"focused", p_get_focused},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user