add 'onfocus' ui event & optimize container:add
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user