mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add 'onfocus' ui event & optimize container:add
This commit is contained in:
parent
8e8cabf2d1
commit
1e90115a26
9 changed files with 31 additions and 10 deletions
|
|
@ -63,7 +63,7 @@ static runnable create_runnable(
|
|||
const std::string& name
|
||||
) {
|
||||
if (element.has(name)) {
|
||||
std::string text = element.attr(name).getText();
|
||||
const std::string& text = element.attr(name).getText();
|
||||
if (!text.empty()) {
|
||||
return scripting::create_runnable(
|
||||
reader.getEnvironment(), text, reader.getFilename()
|
||||
|
|
@ -180,6 +180,10 @@ static void read_uinode(
|
|||
node.listenAction(onclick);
|
||||
}
|
||||
|
||||
if (auto onfocus = create_action(reader, element, "onfocus")) {
|
||||
node.listenFocus(onfocus);
|
||||
}
|
||||
|
||||
if (auto ondefocus = create_action(reader, element, "ondefocus")) {
|
||||
node.listenDefocus(ondefocus);
|
||||
}
|
||||
|
|
@ -761,7 +765,7 @@ static std::shared_ptr<UINode> read_iframe(
|
|||
return iframe;
|
||||
}
|
||||
|
||||
UiXmlReader::UiXmlReader(gui::GUI& gui, const scriptenv& env) : gui(gui), env(env) {
|
||||
UiXmlReader::UiXmlReader(gui::GUI& gui, scriptenv&& env) : gui(gui), env(std::move(env)) {
|
||||
contextStack.emplace("");
|
||||
add("image", read_image);
|
||||
add("canvas", read_canvas);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue