Merge branch 'main' into debugging-client
This commit is contained in:
+22
-22
@@ -30,31 +30,31 @@
|
||||
using namespace gui;
|
||||
|
||||
static Align align_from_string(std::string_view str, Align def) {
|
||||
if (str == "left") return Align::left;
|
||||
if (str == "center") return Align::center;
|
||||
if (str == "right") return Align::right;
|
||||
if (str == "top") return Align::top;
|
||||
if (str == "bottom") return Align::bottom;
|
||||
if (str == "left") return Align::LEFT;
|
||||
if (str == "center") return Align::CENTER;
|
||||
if (str == "right") return Align::RIGHT;
|
||||
if (str == "top") return Align::TOP;
|
||||
if (str == "bottom") return Align::BOTTOM;
|
||||
return def;
|
||||
}
|
||||
|
||||
static Gravity gravity_from_string(const std::string& str) {
|
||||
static const std::unordered_map<std::string, Gravity> gravity_names {
|
||||
{"top-left", Gravity::top_left},
|
||||
{"top-center", Gravity::top_center},
|
||||
{"top-right", Gravity::top_right},
|
||||
{"center-left", Gravity::center_left},
|
||||
{"center-center", Gravity::center_center},
|
||||
{"center-right", Gravity::center_right},
|
||||
{"bottom-left", Gravity::bottom_left},
|
||||
{"bottom-center", Gravity::bottom_center},
|
||||
{"bottom-right", Gravity::bottom_right},
|
||||
{"top-left", Gravity::TOP_LEFT},
|
||||
{"top-center", Gravity::TOP_CENTER},
|
||||
{"top-right", Gravity::TOP_RIGHT},
|
||||
{"center-left", Gravity::CENTER_LEFT},
|
||||
{"center-center", Gravity::CENTER_CENTER},
|
||||
{"center-right", Gravity::CENTER_RIGHT},
|
||||
{"bottom-left", Gravity::BOTTOM_LEFT},
|
||||
{"bottom-center", Gravity::BOTTOM_CENTER},
|
||||
{"bottom-right", Gravity::BOTTOM_RIGHT},
|
||||
};
|
||||
auto found = gravity_names.find(str);
|
||||
if (found != gravity_names.end()) {
|
||||
return found->second;
|
||||
}
|
||||
return Gravity::none;
|
||||
return Gravity::NONE;
|
||||
}
|
||||
|
||||
static runnable create_runnable(
|
||||
@@ -73,7 +73,7 @@ static runnable create_runnable(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static onaction create_action(
|
||||
static OnAction create_action(
|
||||
const UiXmlReader& reader,
|
||||
const xml::xmlelement& element,
|
||||
const std::string& name
|
||||
@@ -178,7 +178,7 @@ static void read_uinode(
|
||||
}
|
||||
|
||||
if (auto onclick = create_action(reader, element, "onclick")) {
|
||||
node.listenAction(onclick);
|
||||
node.listenClick(onclick);
|
||||
}
|
||||
|
||||
if (auto onclick = create_action(reader, element, "onrightclick")) {
|
||||
@@ -252,7 +252,7 @@ static void read_base_panel_impl(
|
||||
if (element.has("orientation")) {
|
||||
auto& oname = element.attr("orientation").getText();
|
||||
if (oname == "horizontal") {
|
||||
panel.setOrientation(Orientation::horizontal);
|
||||
panel.setOrientation(Orientation::HORIZONTAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ static void read_panel_impl(
|
||||
if (element.has("orientation")) {
|
||||
auto& oname = element.attr("orientation").getText();
|
||||
if (oname == "horizontal") {
|
||||
panel.setOrientation(Orientation::horizontal);
|
||||
panel.setOrientation(Orientation::HORIZONTAL);
|
||||
}
|
||||
}
|
||||
if (subnodes) {
|
||||
@@ -338,7 +338,7 @@ static std::shared_ptr<UINode> read_label(
|
||||
if (element.has("multiline")) {
|
||||
label->setMultiline(element.attr("multiline").asBool());
|
||||
if (!element.has("valign")) {
|
||||
label->setVerticalAlign(Align::top);
|
||||
label->setVerticalAlign(Align::TOP);
|
||||
}
|
||||
}
|
||||
if (element.has("text-wrap")) {
|
||||
@@ -364,8 +364,8 @@ static std::shared_ptr<UINode> read_split_box(
|
||||
float splitPos = element.attr("split-pos", "0.5").asFloat();
|
||||
Orientation orientation =
|
||||
element.attr("orientation", "vertical").getText() == "horizontal"
|
||||
? Orientation::horizontal
|
||||
: Orientation::vertical;
|
||||
? Orientation::HORIZONTAL
|
||||
: Orientation::VERTICAL;
|
||||
auto splitBox = std::make_shared<SplitBox>(
|
||||
reader.getGUI(), glm::vec2(), splitPos, orientation
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user