lxgui
gui_layered_region_parser.cpp
1 #include "lxgui/gui_frame.hpp"
2 #include "lxgui/gui_layered_region.hpp"
3 #include "lxgui/gui_layout_node.hpp"
4 #include "lxgui/gui_manager.hpp"
5 #include "lxgui/gui_out.hpp"
6 
7 namespace lxgui::gui {
8 
10  parse_attributes_(node);
11 
12  parse_size_node_(node);
13  parse_anchor_node_(node);
14 }
15 
17  if (const auto attr = node.try_get_attribute_value<bool>("hidden"))
18  set_shown(!attr.value());
19 
20  if (node.get_attribute_value_or<bool>("setAllAnchors", false))
21  set_all_anchors("$parent");
22 }
23 
24 } // namespace lxgui::gui
void parse_attributes_(const layout_node &node) override
void parse_layout(const layout_node &node) override
Parses data from a layout_node.
An node in a layout file.
std::optional< std::string_view > try_get_attribute_value(std::string_view name) const noexcept
Returns the value of the attribute with the provided name, nullopt if not found.
T get_attribute_value_or(std::string_view name, T fallback) const noexcept
Returns the value of the attribute with the provided name, or a default if not found or parsing faile...
void set_shown(bool is_shown)
shows/hides this region.
Definition: gui_region.cpp:196
void set_all_anchors(const utils::observer_ptr< region > &obj)
Adjusts this regions anchors to fit the provided region.
Definition: gui_region.cpp:437
virtual void parse_size_node_(const layout_node &node)
virtual void parse_anchor_node_(const layout_node &node)