lxgui
Public Types | Public Member Functions | Protected Member Functions | List of all members
lxgui::gui::virtual_root Class Reference

Root of the virtual UI object hierarchy. More...

#include <gui_virtual_root.hpp>

Inheritance diagram for lxgui::gui::virtual_root:
lxgui::gui::frame_container

Public Types

using root_frame_list = std::list< utils::owner_ptr< frame > >
 Type of the root frame list. More...
 
using root_frame_list_view = utils::view::adaptor< root_frame_list, utils::view::smart_ptr_dereferencer, utils::view::non_null_filter >
 
using const_root_frame_list_view = utils::view::adaptor< const root_frame_list, utils::view::smart_ptr_dereferencer, utils::view::non_null_filter >
 

Public Member Functions

 virtual_root (manager &mgr, registry &non_virtual_registry)
 Constructor. More...
 
 ~virtual_root () override
 Destructor. More...
 
 virtual_root (const virtual_root &)=delete
 
 virtual_root (virtual_root &&)=delete
 
virtual_rootoperator= (const virtual_root &)=delete
 
virtual_rootoperator= (virtual_root &&)=delete
 
managerget_manager ()
 Returns the manager instance associated with this root. More...
 
const managerget_manager () const
 Returns the manager instance associated with this root. More...
 
virtual_registryget_registry ()
 Returns the UI object registry, which keeps track of all objects in the UI. More...
 
const virtual_registryget_registry () const
 Returns the UI object registry, which keeps track of all objects in the UI. More...
 
utils::observer_ptr< framecreate_root_frame (frame_core_attributes attr)
 Creates a new frame, ready for use, and owned by this frame_container. More...
 
template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr< framecreate_root_frame (frame_core_attributes attr)
 Creates a new frame, ready for use, and owned by this frame_container. More...
 
template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr< framecreate_root_frame (const std::string &name)
 Creates a new frame, ready for use, and owned by this frame_container. More...
 
utils::observer_ptr< frameadd_root_frame (utils::owner_ptr< frame > obj)
 Make a frame owned by this frame_container. More...
 
utils::owner_ptr< frameremove_root_frame (const utils::observer_ptr< frame > &obj)
 Remove a frame from the list of frames owned by this frame_container. More...
 
root_frame_list_view get_root_frames ()
 Returns the root frame list. More...
 
const_root_frame_list_view get_root_frames () const
 Returns the root frame list. More...
 
void garbage_collect ()
 Clean deleted entries from the frame list. More...
 
factoryget_factory ()
 Returns the GUI object factory. More...
 
const factoryget_factory () const
 Returns the GUI object factory. More...
 

Protected Member Functions

virtual utils::observer_ptr< framecreate_root_frame_ (frame_core_attributes attr)
 
void clear_frames_ ()
 

Detailed Description

Root of the virtual UI object hierarchy.

This class contains and owns all virtual "root" frames (frames with no parents) and is responsible for their lifetime.

Definition at line 23 of file gui_virtual_root.hpp.

Member Typedef Documentation

◆ const_root_frame_list_view

Definition at line 42 of file gui_frame_container.hpp.

◆ root_frame_list

Type of the root frame list.

Note
Constraints on the choice container type:
  • must not invalidate iterators on back insertion
  • must allow forward iteration
  • iterators can be invalidated on removal
  • most common use is iteration, not addition or removal
  • ordering of elements is irrelevant

Definition at line 37 of file gui_frame_container.hpp.

◆ root_frame_list_view

Definition at line 39 of file gui_frame_container.hpp.

Constructor & Destructor Documentation

◆ virtual_root() [1/3]

lxgui::gui::virtual_root::virtual_root ( manager mgr,
registry non_virtual_registry 
)
explicit

Constructor.

Parameters
mgrThe GUI manager
non_virtual_registryThe registry for non-virtual objects (for error messages)

Definition at line 8 of file gui_virtual_root.cpp.

◆ ~virtual_root()

lxgui::gui::virtual_root::~virtual_root ( )
override

Destructor.

Definition at line 13 of file gui_virtual_root.cpp.

◆ virtual_root() [2/3]

lxgui::gui::virtual_root::virtual_root ( const virtual_root )
delete

◆ virtual_root() [3/3]

lxgui::gui::virtual_root::virtual_root ( virtual_root &&  )
delete

Member Function Documentation

◆ add_root_frame()

utils::observer_ptr< frame > lxgui::gui::frame_container::add_root_frame ( utils::owner_ptr< frame obj)
inherited

Make a frame owned by this frame_container.

Parameters
objThe frame to add to the root frame list
Returns
Raw pointer to the frame

Definition at line 27 of file gui_frame_container.cpp.

◆ clear_frames_()

void lxgui::gui::frame_container::clear_frames_ ( )
protectedinherited

Definition at line 63 of file gui_frame_container.cpp.

◆ create_root_frame() [1/3]

template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr<frame> lxgui::gui::frame_container::create_root_frame ( const std::string &  name)
inlineinherited

Creates a new frame, ready for use, and owned by this frame_container.

Parameters
nameThe name of this 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 112 of file gui_frame_container.hpp.

◆ create_root_frame() [2/3]

utils::observer_ptr<frame> lxgui::gui::frame_container::create_root_frame ( frame_core_attributes  attr)
inlineinherited

Creates a new frame, ready for use, and owned by this frame_container.

Parameters
attrThe core attributes of the frame (parent will be ignored)
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 71 of file gui_frame_container.hpp.

◆ create_root_frame() [3/3]

template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr<frame> lxgui::gui::frame_container::create_root_frame ( frame_core_attributes  attr)
inlineinherited

Creates a new frame, ready for use, and owned by this frame_container.

Parameters
attrThe core attributes of the frame (object_type and parent will be ignored)
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 91 of file gui_frame_container.hpp.

◆ create_root_frame_()

utils::observer_ptr< frame > lxgui::gui::frame_container::create_root_frame_ ( frame_core_attributes  attr)
protectedvirtualinherited

Definition at line 17 of file gui_frame_container.cpp.

◆ garbage_collect()

void lxgui::gui::frame_container::garbage_collect ( )
inherited

Clean deleted entries from the frame list.

Note
This must not be called while the root frames are being iterated on. All this does is free up "nullptr" entries from the list, to speed up future iteration.

Definition at line 56 of file gui_frame_container.cpp.

◆ get_factory() [1/2]

factory& lxgui::gui::frame_container::get_factory ( )
inlineinherited

Returns the GUI object factory.

Returns
The GUI object factory

Definition at line 158 of file gui_frame_container.hpp.

◆ get_factory() [2/2]

const factory& lxgui::gui::frame_container::get_factory ( ) const
inlineinherited

Returns the GUI object factory.

Returns
The GUI object factory

Definition at line 166 of file gui_frame_container.hpp.

◆ get_manager() [1/2]

manager& lxgui::gui::virtual_root::get_manager ( )
inline

Returns the manager instance associated with this root.

Returns
The manager instance associated with this root

Definition at line 44 of file gui_virtual_root.hpp.

◆ get_manager() [2/2]

const manager& lxgui::gui::virtual_root::get_manager ( ) const
inline

Returns the manager instance associated with this root.

Returns
The manager instance associated with this root

Definition at line 52 of file gui_virtual_root.hpp.

◆ get_registry() [1/2]

virtual_registry& lxgui::gui::virtual_root::get_registry ( )
inline

Returns the UI object registry, which keeps track of all objects in the UI.

Returns
The registry object

Definition at line 60 of file gui_virtual_root.hpp.

◆ get_registry() [2/2]

const virtual_registry& lxgui::gui::virtual_root::get_registry ( ) const
inline

Returns the UI object registry, which keeps track of all objects in the UI.

Returns
The registry object

Definition at line 68 of file gui_virtual_root.hpp.

◆ get_root_frames() [1/2]

frame_container::root_frame_list_view lxgui::gui::frame_container::get_root_frames ( )
inherited

Returns the root frame list.

Returns
The root frame list

Definition at line 48 of file gui_frame_container.cpp.

◆ get_root_frames() [2/2]

frame_container::const_root_frame_list_view lxgui::gui::frame_container::get_root_frames ( ) const
inherited

Returns the root frame list.

Returns
The root frame list

Definition at line 52 of file gui_frame_container.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ remove_root_frame()

utils::owner_ptr< frame > lxgui::gui::frame_container::remove_root_frame ( const utils::observer_ptr< frame > &  obj)
inherited

Remove a frame from the list of frames owned by this frame_container.

Parameters
objThe frame to be released
Returns
A unique_ptr to the previously owned frame, ignore it to destroy it.

Definition at line 33 of file gui_frame_container.cpp.


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