Merge pull request #843 from MihailRis/common-vc-funcs

new functions and settings
This commit is contained in:
MihailRis 2026-06-01 00:27:11 +03:00 • committed by GitHub
commit 025e32eec1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 617 additions and 421 deletions

View file

@ -57,6 +57,10 @@ FullCheckBox::FullCheckBox(
add(checkbox);
auto& checkboxActions = actions;
label->setMargin(glm::vec4(5.f, 5.f, 0.f, 0.f));
label->listenAction(UIAction::CLICK, [&checkboxActions](auto& gui) {
checkboxActions.notify(UIAction::CLICK, gui);
});
add(label);
}

View file

@ -889,8 +889,8 @@ static std::shared_ptr<UINode> read_iframe(
return iframe;
}
UiXmlReader::UiXmlReader(gui::GUI& gui, scriptenv&& env)
: gui(gui), env(std::move(env)) {
UiXmlReader::UiXmlReader(gui::GUI& gui, const scriptenv& env)
: gui(gui), env(env) {
contextStack.emplace("");
add("image", read_image);
add("canvas", read_canvas);
@ -922,8 +922,7 @@ void UiXmlReader::addIgnore(const std::string& tag) {
ignored.insert(tag);
}
std::shared_ptr<UINode> UiXmlReader::readUINode(const xml::xmlelement& element
) {
std::shared_ptr<UINode> UiXmlReader::readUINode(const xml::xmlelement& element) {
if (element.has("if")) {
const auto& cond = element.attr("if").getText();
if (cond.empty() || cond == "false" || cond == "nil") return nullptr;

View file

@ -20,9 +20,9 @@ namespace gui {
std::unordered_set<std::string> ignored;
std::stack<std::string> contextStack;
std::string filename;
scriptenv env;
const scriptenv& env;
public:
UiXmlReader(gui::GUI& gui, scriptenv&& env);
UiXmlReader(gui::GUI& gui, const scriptenv& env);
void add(const std::string& tag, uinode_reader reader);
bool hasReader(const std::string& tag) const;