mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add 'value' selectbox property
This commit is contained in:
parent
0042dbfb3d
commit
47f7259c72
4 changed files with 41 additions and 21 deletions
|
|
@ -435,17 +435,14 @@ static std::shared_ptr<UINode> read_select(
|
|||
int contentWidth = element.attr("width", "100").asInt();
|
||||
|
||||
auto& elements = element.getElements();
|
||||
std::vector<SelectBox::Element> options;
|
||||
SelectBox::Element selected;
|
||||
std::vector<SelectBox::Option> options;
|
||||
SelectBox::Option selected;
|
||||
for (const auto& elem : elements) {
|
||||
const auto& tag = elem->getTag();
|
||||
if (tag == "option") {
|
||||
auto value = elem->attr("value").getText();
|
||||
auto text = parse_inner_text(*elem, reader.getContext());
|
||||
SelectBox::Element option {
|
||||
std::move(value),
|
||||
std::move(text)
|
||||
};
|
||||
SelectBox::Option option {std::move(value), std::move(text)};
|
||||
if (elem->attr("selected", "false").asBool()) {
|
||||
selected = option;
|
||||
}
|
||||
|
|
@ -453,10 +450,7 @@ static std::shared_ptr<UINode> read_select(
|
|||
} else if (tag == "default") {
|
||||
auto value = elem->attr("value").getText();
|
||||
auto text = parse_inner_text(*elem, reader.getContext());
|
||||
selected = SelectBox::Element {
|
||||
std::move(value),
|
||||
std::move(text)
|
||||
};
|
||||
selected = SelectBox::Option {std::move(value), std::move(text)};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue