mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
add textbox.syntax, textbox.markup, label.markup properties
This commit is contained in:
parent
c782645603
commit
65f208fc61
5 changed files with 49 additions and 6 deletions
|
|
@ -299,6 +299,22 @@ static int p_get_line_numbers(UINode* node, lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int p_get_syntax(UINode* node, lua::State* L) {
|
||||
if (auto box = dynamic_cast<TextBox*>(node)) {
|
||||
return lua::pushstring(L, box->getSyntax());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int p_get_markup(UINode* node, lua::State* L) {
|
||||
if (auto box = dynamic_cast<TextBox*>(node)) {
|
||||
return lua::pushstring(L, box->getMarkup());
|
||||
} else if (auto label = dynamic_cast<Label*>(node)) {
|
||||
return lua::pushstring(L, label->getMarkup());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int p_get_src(UINode* node, lua::State* L) {
|
||||
if (auto image = dynamic_cast<Image*>(node)) {
|
||||
return lua::pushstring(L, image->getTexture());
|
||||
|
|
@ -420,6 +436,8 @@ static int l_gui_getattr(lua::State* L) {
|
|||
{"lineNumbers", p_get_line_numbers},
|
||||
{"lineAt", p_get_line_at},
|
||||
{"linePos", p_get_line_pos},
|
||||
{"syntax", p_get_syntax},
|
||||
{"markup", p_get_markup},
|
||||
{"src", p_get_src},
|
||||
{"value", p_get_value},
|
||||
{"min", p_get_min},
|
||||
|
|
@ -512,6 +530,18 @@ static void p_set_line_numbers(UINode* node, lua::State* L, int idx) {
|
|||
box->setShowLineNumbers(lua::toboolean(L, idx));
|
||||
}
|
||||
}
|
||||
static void p_set_syntax(UINode* node, lua::State* L, int idx) {
|
||||
if (auto box = dynamic_cast<TextBox*>(node)) {
|
||||
box->setSyntax(lua::require_string(L, idx));
|
||||
}
|
||||
}
|
||||
static void p_set_markup(UINode* node, lua::State* L, int idx) {
|
||||
if (auto box = dynamic_cast<TextBox*>(node)) {
|
||||
box->setMarkup(lua::require_string(L, idx));
|
||||
} else if (auto label = dynamic_cast<Label*>(node)) {
|
||||
label->setMarkup(lua::require_string(L, idx));
|
||||
}
|
||||
}
|
||||
static void p_set_src(UINode* node, lua::State* L, int idx) {
|
||||
if (auto image = dynamic_cast<Image*>(node)) {
|
||||
image->setTexture(lua::require_string(L, idx));
|
||||
|
|
@ -612,6 +642,8 @@ static int l_gui_setattr(lua::State* L) {
|
|||
{"text", p_set_text},
|
||||
{"editable", p_set_editable},
|
||||
{"lineNumbers", p_set_line_numbers},
|
||||
{"syntax", p_set_syntax},
|
||||
{"markup", p_set_markup},
|
||||
{"src", p_set_src},
|
||||
{"caret", p_set_caret},
|
||||
{"value", p_set_value},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue