You.i Engine
CYIDelegatingViewAdapter Class Reference

Detailed Description

A CYIViewAdapter implementation that delegates its responsibilities to a CYIDelegatingViewAdapter::Delegate implementation.

CYIDelegatingViewAdapter allows the extension of existing classes, such as CYIAbstractScreenViewController subclasses, with CYIViewAdapter 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 CYIDelegatingViewAdapter::Delegate and construct this adapter with the delegate implementation.

See also

#include <streamer/YiDelegatingViewAdapter.h>

Inheritance diagram for CYIDelegatingViewAdapter:


class  Delegate

Public Member Functions

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

Protected Member Functions

virtual void PopulateView (size_t index, CYISceneView *pView) override
virtual void OnReleaseView (size_t index, CYISceneView *pView) override

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ CYIDelegatingViewAdapter()

CYIDelegatingViewAdapter::CYIDelegatingViewAdapter ( Delegate pDelegate,
const std::shared_ptr< IYIViewRecycler > &  pViewRecycler = std::shared_ptr< IYIViewRecycler >() 

Creates a new delegate adapter using delegate pDelegate and an optional view recycler pViewRecycler. pDelegate must be non-null. The created object does not take ownership of the pointer pDelegate.

If pViewRecycler is nullptr, the adapter will use a CYICreateDeleteViewRecycler.

◆ ~CYIDelegatingViewAdapter()

virtual CYIDelegatingViewAdapter::~CYIDelegatingViewAdapter ( )

Member Function Documentation

◆ GetDelegate()

Delegate* CYIDelegatingViewAdapter::GetDelegate ( ) const

Returns the delegate assigned to this adapter.

◆ GetItemsCount()

virtual size_t CYIDelegatingViewAdapter::GetItemsCount ( ) const

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

Implements CYIViewAdapter.

◆ GetViewClass()

virtual const CYIRuntimeTypeInfo* CYIDelegatingViewAdapter::GetViewClass ( size_t  index) const

Returns the class type for the item at adapter index index. Returns nullptr by default, indicating that the class type from the view template should be used. The class type must be derived from CYISceneView. Subclasses can override this function to provide a view class for the item at adapter index index.

See also

Reimplemented from CYIViewAdapter.

◆ GetViewTemplate()

virtual std::shared_ptr<CYIAssetViewTemplate> CYIDelegatingViewAdapter::GetViewTemplate ( size_t  index) const

Returns the view template that will be used to construct the item at adapter index index. The size of this template will be used as the initial node size for adapter index index.

Implements CYIViewAdapter.

◆ OnReleaseView()

virtual void CYIDelegatingViewAdapter::OnReleaseView ( size_t  index,
CYISceneView pView 

Called before pView is recycled. If this adaper is using a CYIPooledViewRecycler, this is the ideal time to reset pView before it is returned to the pool.

Do not retain a pointer to pView as ownership is relinquished to the IYIViewRecycler after this function is called.
See also

Reimplemented from CYIViewAdapter.

◆ PopulateView()

virtual void CYIDelegatingViewAdapter::PopulateView ( size_t  index,
CYISceneView pView 

Populates the view pView, which is associated with adapter index index.

Implements CYIViewAdapter.

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