A simplified CYINodeAdapter interface for automatically building views using provided view templates.
Adapters are responsible for the construction and population of views corresponding to indices in a data model. CYIViewAdapter provides this functionality through the use of CYIAssetViewTemplate and IYIViewRecycler. Concrete implementations of CYIViewAdapter associate data model indices with CYIAssetViewTemplate instances in CYIViewAdapter::GetViewTemplate. These views are populated according to the data they represent in CYIViewAdapter::PopulateView. The creation and destruction of these views is managed by the IYIViewRecycler optional component provided at construction time. If no view recycler is provided a CYICreateDeleteViewRecycler is used. This default recycler creates and deletes views each time, offering no recycling.
For the most generalized adapter interface see CYINodeAdapter. To implement CYIViewAdapter's responsibilities in an existing class, such as a derivative of CYIAbstractScreenViewController, see CYIDelegatingViewAdapter.
#include <streamer/YiViewAdapter.h>

Public Member Functions | |
| CYIViewAdapter (const std::shared_ptr< IYIViewRecycler > &pViewRecycler=std::shared_ptr< IYIViewRecycler >()) | |
| virtual | ~CYIViewAdapter () |
| virtual uint32_t | GetItemsCount () const override=0 |
| virtual glm::vec3 | GetInitialNodeSize (uint32_t uIndex) const override |
| virtual void | ConfigureProperties (uint32_t uIndex, CYISceneNode *pNode) const override |
| virtual std::unique_ptr< CYISceneNode > | BuildNode (uint32_t uIndex, CYISceneManager *pSceneManager) finaloverride |
| virtual void | ReleaseNode (uint32_t uIndex, std::unique_ptr< CYISceneNode > pNode) finaloverride |
| virtual std::shared_ptr< CYIAssetViewTemplate > | GetViewTemplate (uint32_t uIndex) const =0 |
| virtual const CYIRuntimeTypeInfo * | GetViewClass (uint32_t uIndex) const |
Public Member Functions inherited from CYINodeAdapter | |
| CYINodeAdapter () | |
| virtual | ~CYINodeAdapter () |
| IYIPropertiesSource * | GetProperties (const CYIString &viewTemplateName) const |
| void | SetProperties (const std::map< CYIString, IYIPropertiesSource * > &properties) |
Public Member Functions inherited from CYIScriptableObject | |
| CYIScriptableObject () | |
| CYIScriptableObject (const CYIScriptableObject &other) | |
| CYIScriptableObject & | operator= (const CYIScriptableObject &other) |
| virtual | ~CYIScriptableObject () |
| CYIBindingImplementation * | GetBindingImplementation () const |
| void | SetBindingImplementation (CYIBindingImplementation *pBindingImplementation) |
| virtual const CYIRuntimeTypeInfo * | GetRuntimeTypeInfoForScriptObject () const |
Protected Member Functions | |
| virtual void | PopulateView (uint32_t uIndex, CYISceneView *pView)=0 |
| virtual void | OnReleaseView (uint32_t uIndex, CYISceneView *pView) |
Additional Inherited Members | |
Public Attributes inherited from CYINodeAdapter | |
| CYISignal< uint32_t > | ItemAddedAtIndex |
| CYISignal< uint32_t > | ItemRemovedAtIndex |
| CYISignal< uint32_t, uint32_t > | ItemMoved |
| CYIViewAdapter::CYIViewAdapter | ( | const std::shared_ptr< IYIViewRecycler > & | pViewRecycler = std::shared_ptr< IYIViewRecycler >() | ) |
Creates a new CYIViewAdapter with an optionally provided IYIViewRecycler, pViewRecycler. If no view recycler is provided, a CYICreateDeleteViewRecycler will be used.
|
virtual |
|
finaloverridevirtual |
Override to provide the node representing the visual subtree at 0-based uIndex. 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.
Implements CYINodeAdapter.
|
overridevirtual |
The default implementation configures pNode with properties from the view template at index uIndex, and with properties set explicitly using CYINodeAdapter::SetProperties(). Properties configured with CYINodeAdapter::SetProperties() will overwrite those from the template.
This method calls CYINodeAdapter::ConfigureProperties. Subclasses should call CYIViewAdapter::ConfigureProperties.
Reimplemented from CYINodeAdapter.
|
overridevirtual |
Returns the initial node size of the view template for 0-based adapter index uIndex.
Implements CYINodeAdapter.
|
overridepure virtual |
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.
Implements CYINodeAdapter.
Implemented in CYIDelegatingViewAdapter.
|
virtual |
Returns the class type for the item at adapter index uIndex. 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 uIndex.
Reimplemented in CYIDelegatingViewAdapter.
|
pure virtual |
Returns the view template that will be used to construct the item at adapter index uIndex. The size of this template will be used as the initial node size for adapter index uIndex.
Implemented in CYIDelegatingViewAdapter.
|
protectedvirtual |
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.
Reimplemented in CYIDelegatingViewAdapter.
|
protectedpure virtual |
Populates the view pView, which is associated with adapter index uIndex.
Implemented in CYIDelegatingViewAdapter.
|
finaloverridevirtual |
Override to reclaim ownership of pNode, which represents the visual subtree at uIndex. pNode may be recycled or destroyed.
Implements CYINodeAdapter.