You.i Engine
CYIDelegatingNodeAdapter Class Reference

Detailed Description

An CYINodeAdapter implementation that delegates its responsibilities to a CYIDelegatingNodeAdapter::Delegate implementation.

CYIDelegatingNodeAdapter allows the extension of existing classes, such as a CYIAbstractScreenViewController subclass, with CYINodeAdapter responsibilities. The adapter does not take ownership of the delegate and so the delegate may be re-used across adapter instances.

In order to make use of this adapter, extend CYIDelegatingNodeAdapter::Delegate and construct this adapter with the delegate implementation.

#include <streamer/YiDelegatingNodeAdapter.h>

Inheritance diagram for CYIDelegatingNodeAdapter:

Classes

class  Delegate
 

Public Member Functions

 CYIDelegatingNodeAdapter (Delegate *pDelegate)
 
virtual ~CYIDelegatingNodeAdapter ()
 
DelegateGetDelegate () const
 
virtual size_t GetItemsCount () const override
 
virtual glm::vec3 GetInitialNodeSize (size_t index) const override
 
virtual std::unique_ptr< CYISceneNodeBuildNode (size_t index, CYISceneManager *pSceneManager) override
 
virtual void ReleaseNode (size_t index, std::unique_ptr< CYISceneNode > pNode) override
 
- Public Member Functions inherited from CYINodeAdapter
 CYINodeAdapter ()
 
virtual ~CYINodeAdapter ()
 
virtual void ConfigureProperties (size_t index, CYISceneNode *pNode) const
 
IYIPropertiesSourceGetProperties (const CYIString &viewTemplateName) const
 
void SetProperties (const std::map< CYIString, IYIPropertiesSource *> &properties)
 

Additional Inherited Members

- Public Attributes inherited from CYINodeAdapter
CYISignal< size_tItemAddedAtIndex
 
CYISignal< size_tItemRemovedAtIndex
 
CYISignal< size_t, size_tItemMoved
 

Constructor & Destructor Documentation

◆ CYIDelegatingNodeAdapter()

CYIDelegatingNodeAdapter::CYIDelegatingNodeAdapter ( Delegate pDelegate)

Creates a new delegate adapter using delegate pDelegate. pDelegate must be non-null. The created object does not take ownership of the provided pointer.

◆ ~CYIDelegatingNodeAdapter()

virtual CYIDelegatingNodeAdapter::~CYIDelegatingNodeAdapter ( )
virtual

Member Function Documentation

◆ BuildNode()

virtual std::unique_ptr<CYISceneNode> CYIDelegatingNodeAdapter::BuildNode ( size_t  index,
CYISceneManager pSceneManager 
)
overridevirtual

Override to provide the node representing the visual subtree at 0-based index. This may be a newly constructed CYISceneNode or one that is recycled, so long as it is fully initialized. The same CYISceneNode may not be re-used until CYINodeAdapter::ReleaseNode is called at which point the implementation is free to deallocate or recycle the node.

See also
ReleaseNode

Implements CYINodeAdapter.

◆ GetDelegate()

Delegate* CYIDelegatingNodeAdapter::GetDelegate ( ) const

Returns the delegate assigned to this adapter.

◆ GetInitialNodeSize()

virtual glm::vec3 CYIDelegatingNodeAdapter::GetInitialNodeSize ( size_t  index) const
overridevirtual

Override to return the initial node size for 0-based adapter index index. This is only used when items are initially added and does not need to reflect changes in size.

Implements CYINodeAdapter.

◆ GetItemsCount()

virtual size_t CYIDelegatingNodeAdapter::GetItemsCount ( ) const
overridevirtual

Returns the number of items managed by this adapter. This may be queried throughout the lifetime of the adapter and must report the correct value as items are added and removed. The number of items will be used to produce the 0-based consecutive indices. Indices may be invalidated when the number of items have changed and may no longer correspond to the same visual representations.

See also
CYINodeAdapter::ItemAddedAtIndex
CYINodeAdapter::ItemRemovedAtIndex

Implements CYINodeAdapter.

◆ ReleaseNode()

virtual void CYIDelegatingNodeAdapter::ReleaseNode ( size_t  index,
std::unique_ptr< CYISceneNode pNode 
)
overridevirtual

Override to reclaim ownership of pNode, which represents the visual subtree at index. pNode may be recycled or destroyed.

Note
By the time ReleaseNode has been called the node has already been detached from the scene tree.
See also
BuildNode

Implements CYINodeAdapter.


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