1 #include "lxgui/gui_factory.hpp"
3 #include "lxgui/gui_frame.hpp"
4 #include "lxgui/gui_frame_renderer.hpp"
5 #include "lxgui/gui_layered_region.hpp"
6 #include "lxgui/gui_manager.hpp"
7 #include "lxgui/gui_out.hpp"
8 #include "lxgui/gui_registry.hpp"
18 auto iter = custom_object_list_.find(attr.
object_type);
19 if (iter == custom_object_list_.end()) {
21 <<
"\"." << std::endl;
29 if (!finalize_object_(reg, *new_object, attr))
39 auto iter = custom_frame_list_.find(attr.
object_type);
40 if (iter == custom_frame_list_.end()) {
42 <<
"\"." << std::endl;
50 if (!finalize_object_(reg, *new_frame, attr))
61 auto iter = custom_region_list_.find(attr.
object_type);
62 if (iter == custom_region_list_.end()) {
72 if (!finalize_object_(reg, *new_region, attr))
79 for (
const auto& reg : custom_lua_regs_)
84 if (!
object.is_virtual() || attr.
parent ==
nullptr) {
91 apply_inheritance_(
object, attr);
96 void factory::apply_inheritance_(region&
object,
const region_core_attributes& attr) {
97 for (
const auto& base : attr.inheritance) {
98 if (!
object.is_region_type(*base)) {
100 <<
"\"" <<
object.get_name() <<
"\" (" <<
object.get_region_type()
101 <<
") cannot inherit from \"" << base->get_name() <<
"\" ("
102 << base->get_region_type() <<
"). Inheritance skipped." << std::endl;
107 object.copy_from(*base);
void register_on_lua(sol::state &lua)
Registers all region types on the provided Lua state.
utils::owner_ptr< layered_region > create_layered_region(registry ®, const region_core_attributes &attr)
Creates a new layered_region.
factory(manager &mgr)
Constructor.
utils::owner_ptr< region > create_region(registry ®, const region_core_attributes &attr)
Creates a new region.
utils::owner_ptr< frame > create_frame(registry ®, const frame_core_attributes &attr)
Creates a new frame.
Manages the user interface.
The base class of all elements in the GUI.
Keeps track of created UI objects and records their names for lookup.
bool add_region(utils::observer_ptr< region > obj)
Adds a region to be handled by this registry.
bool check_region_name(std::string_view name) const
Checks the provided string is suitable for naming a region.
utils::observer_ptr< ObjectType > observer_from(ObjectType *self)
Obtain an observer pointer from a raw pointer (typically 'this')
const std::string warning
oup::observable_sealed_ptr< T > owner_ptr
Struct holding all the core information about a frame necessary for its creation.
Struct holding all the core information about a region necessary for its creation.
utils::observer_ptr< frame > parent