You.i Engine
YiDelegatingViewAdapter.h
Go to the documentation of this file.
1 #ifndef _YI_VIEW_DELEGATE_ADAPTER_H_
2 #define _YI_VIEW_DELEGATE_ADAPTER_H_
3 
5 
23 {
24 public:
28  class Delegate
29  {
30  public:
31  virtual ~Delegate() = default;
32  virtual size_t GetItemsCountForAdapter() const = 0;
33  virtual std::shared_ptr<CYIAssetViewTemplate> GetViewTemplateForAdapter(size_t index) const = 0;
34  virtual const CYIRuntimeTypeInfo *GetViewClassForAdapter(size_t index) const;
35  virtual void PopulateViewForAdapter(size_t index, CYISceneView *pView) = 0;
36  virtual void OnReleaseViewForAdapter(size_t index, CYISceneView *pView);
37  };
38 
44  CYIDelegatingViewAdapter(Delegate *pDelegate, const std::shared_ptr<IYIViewRecycler> &pViewRecycler = std::shared_ptr<IYIViewRecycler>());
45  virtual ~CYIDelegatingViewAdapter();
46 
50  Delegate *GetDelegate() const;
51 
52  virtual size_t GetItemsCount() const override;
53  virtual std::shared_ptr<CYIAssetViewTemplate> GetViewTemplate(size_t index) const override;
54  virtual const CYIRuntimeTypeInfo *GetViewClass(size_t index) const override;
55 
56 protected:
57  virtual void PopulateView(size_t index, CYISceneView *pView) override;
58  virtual void OnReleaseView(size_t index, CYISceneView *pView) override;
59 
60 private:
61  Delegate *m_pDelegate;
62 
64 };
65 
70 #endif
virtual void OnReleaseViewForAdapter(size_t index, CYISceneView *pView)
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
A simplified CYINodeAdapter interface for automatically building views using provided view templates...
Definition: YiViewAdapter.h:23
virtual void PopulateViewForAdapter(size_t index, CYISceneView *pView)=0
A CYIViewAdapter implementation that delegates its responsibilities to a CYIDelegatingViewAdapter::De...
Definition: YiDelegatingViewAdapter.h:22
virtual ~CYIDelegatingViewAdapter()
Delegate * GetDelegate() const
virtual std::shared_ptr< CYIAssetViewTemplate > GetViewTemplateForAdapter(size_t index) const =0
virtual size_t GetItemsCountForAdapter() const =0
virtual void PopulateView(size_t index, CYISceneView *pView) override
virtual const CYIRuntimeTypeInfo * GetViewClass(size_t index) const override
CYIDelegatingViewAdapter(Delegate *pDelegate, const std::shared_ptr< IYIViewRecycler > &pViewRecycler=std::shared_ptr< IYIViewRecycler >())
Definition: YiDelegatingViewAdapter.h:28
The abstract runtime representation of a C++ type.
Definition: YiRtti.h:58
virtual void OnReleaseView(size_t index, CYISceneView *pView) override
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:259
virtual std::shared_ptr< CYIAssetViewTemplate > GetViewTemplate(size_t index) const override
virtual const CYIRuntimeTypeInfo * GetViewClassForAdapter(size_t index) const
virtual size_t GetItemsCount() const override