Provides an interface for supplying and reclaiming nodes to and from CYIStreamer.
The responsibility of the adapter is to create and populate views that correspond to logical indices in a data model. Used in conjunction with CYIStreamer subclasses like CYIListView, adapters allow the representation of arbitrary data in a view. The association between adapters and streamers is a one-to-one association, in which the streamer retains ownership of the adapter.
Several CYINodeAdapter subclasses can be used as more specialized starting points for concrete implementations:
#include <streamer/YiNodeAdapter.h>
Public Member Functions | |
CYINodeAdapter () | |
virtual | ~CYINodeAdapter () |
virtual size_t | GetItemsCount () const =0 |
virtual glm::vec3 | GetInitialNodeSize (size_t index) const =0 |
virtual void | ConfigureProperties (size_t index, CYISceneNode *pNode) const |
IYIPropertiesSource * | GetProperties (const CYIString &viewTemplateName) const |
void | SetProperties (const std::map< CYIString, IYIPropertiesSource *> &properties) |
virtual std::unique_ptr< CYISceneNode > | BuildNode (size_t index, CYISceneManager *pSceneManager)=0 |
virtual void | ReleaseNode (size_t index, std::unique_ptr< CYISceneNode > pNode)=0 |
Public Attributes | |
CYISignal< size_t > | ItemAddedAtIndex |
CYISignal< size_t > | ItemRemovedAtIndex |
CYISignal< size_t, size_t > | ItemMoved |
CYINodeAdapter::CYINodeAdapter | ( | ) |
|
virtual |
|
pure virtual |
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.
Implemented in CYIViewAdapter, and CYIDelegatingNodeAdapter.
|
virtual |
Override to populate the properties for pNode at 0-based index index. The default implementation configures the size of pPlaceholder to the initial node size.
Subclasses should call CYINodeAdapter::ConfigureProperties.
Reimplemented in CYIViewAdapter.
|
pure virtual |
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.
Implemented in CYIDelegatingNodeAdapter, and CYIViewAdapter.
|
pure 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.
Implemented in CYIDelegatingViewAdapter, CYIDelegatingNodeAdapter, and CYIViewAdapter.
IYIPropertiesSource* CYINodeAdapter::GetProperties | ( | const CYIString & | viewTemplateName | ) | const |
Return a IYIPropertiesSource for the CYIViewTemplate named viewTemplateName or null if there is no IYIPropertiesSource for the CYIViewTemplate named viewTemplateName.
|
pure virtual |
Override to reclaim ownership of pNode, which represents the visual subtree at index. pNode may be recycled or destroyed.
Implemented in CYIViewAdapter, and CYIDelegatingNodeAdapter.
void CYINodeAdapter::SetProperties | ( | const std::map< CYIString, IYIPropertiesSource *> & | properties | ) |
Set the properties to be used to configure nodes created by this adapter. The map contains a mapping from CYIViewTemplate names to properties for those templates. The properties can be used to configure nodes created with this adapter.
This signal must be called each time a new item is added to the adapter. The parameter of the signal is the 0-based index at which the new item was added.
This signal should be called when an existing item is moved within the adapter's index list. The first parameter of the signal is the previous 0-based index of the item, and the second paramter is the new 0-based index of the item.
This signal must be called each time an item is removed from the adapter. The parameter of the signal is the 0-based index at which the item was prior to being removed.