lxgui
Public Member Functions | List of all members
lxgui::gui::factory Class Reference

Handles the creation of new UI objects. More...

#include <gui_factory.hpp>

Public Member Functions

 factory (manager &mgr)
 Constructor. More...
 
 factory (const factory &)=delete
 
 factory (factory &&)=delete
 
factoryoperator= (const factory &)=delete
 
factoryoperator= (factory &&)=delete
 
utils::owner_ptr< regioncreate_region (registry &reg, const region_core_attributes &attr)
 Creates a new region. More...
 
utils::owner_ptr< framecreate_frame (registry &reg, const frame_core_attributes &attr)
 Creates a new frame. More...
 
utils::owner_ptr< layered_regioncreate_layered_region (registry &reg, const region_core_attributes &attr)
 Creates a new layered_region. More...
 
template<typename ObjectType , typename Enable = typename std::enable_if<std::is_base_of<gui::region, ObjectType>::value>::type>
void register_region_type ()
 Registers a new object type. More...
 
template<typename ObjectType , typename FunctionType , typename Enable = typename std::enable_if<std::is_base_of<gui::region, ObjectType>::value>::type>
void register_region_type (FunctionType &&factory_func)
 Registers a new object type. More...
 
void register_on_lua (sol::state &lua)
 Registers all region types on the provided Lua state. More...
 

Detailed Description

Handles the creation of new UI objects.

Note
This is a low-level class, which is only meant to be used internally by the GUI. To create your own UI objects, use root::create_root_frame(), frame::create_child(), or frame::create_region().

Definition at line 39 of file gui_factory.hpp.

Constructor & Destructor Documentation

◆ factory() [1/3]

lxgui::gui::factory::factory ( manager mgr)
explicit

Constructor.

Parameters
mgrThe GUI manager

Definition at line 12 of file gui_factory.cpp.

◆ factory() [2/3]

lxgui::gui::factory::factory ( const factory )
delete

◆ factory() [3/3]

lxgui::gui::factory::factory ( factory &&  )
delete

Member Function Documentation

◆ create_frame()

utils::owner_ptr< frame > lxgui::gui::factory::create_frame ( registry reg,
const frame_core_attributes attr 
)

Creates a new frame.

Parameters
regThe registry in which to register this frame
attrThe attributes of the frame
Returns
The new frame
Note
This function takes care of the basic initializing: the frame is directly usable. However, you still need to call notify_loaded() when you are done with any extra initialization you require on this frame. If you do not, the frame's OnLoad callback will not fire.

Definition at line 35 of file gui_factory.cpp.

◆ create_layered_region()

utils::owner_ptr< layered_region > lxgui::gui::factory::create_layered_region ( registry reg,
const region_core_attributes attr 
)

Creates a new layered_region.

Parameters
regThe registry in which to register this region
attrThe attributes of the region
Returns
The new layered_region
Note
This function takes care of the basic initializing: the region is directly usable.

Definition at line 57 of file gui_factory.cpp.

◆ create_region()

utils::owner_ptr< region > lxgui::gui::factory::create_region ( registry reg,
const region_core_attributes attr 
)

Creates a new region.

Parameters
regThe registry in which to register this object
attrThe attributes of the object
Returns
The new frame
Note
This function takes care of the basic initializing: the object is directly usable.

Definition at line 14 of file gui_factory.cpp.

◆ operator=() [1/2]

factory& lxgui::gui::factory::operator= ( const factory )
delete

◆ operator=() [2/2]

factory& lxgui::gui::factory::operator= ( factory &&  )
delete

◆ register_on_lua()

void lxgui::gui::factory::register_on_lua ( sol::state &  lua)

Registers all region types on the provided Lua state.

Parameters
luaThe Lua state

Definition at line 78 of file gui_factory.cpp.

◆ register_region_type() [1/2]

template<typename ObjectType , typename Enable = typename std::enable_if<std::is_base_of<gui::region, ObjectType>::value>::type>
void lxgui::gui::factory::register_region_type ( )
inline

Registers a new object type.

Note
Set the first template argument as the C++ type of this object.

Definition at line 114 of file gui_factory.hpp.

◆ register_region_type() [2/2]

template<typename ObjectType , typename FunctionType , typename Enable = typename std::enable_if<std::is_base_of<gui::region, ObjectType>::value>::type>
void lxgui::gui::factory::register_region_type ( FunctionType &&  factory_func)
inline

Registers a new object type.

Parameters
factory_funcFactory function to call to create a new instance
Note
Set the first template argument as the C++ type of this object.

Definition at line 136 of file gui_factory.hpp.


The documentation for this class was generated from the following files: