You.i Engine
YiStreamer.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_STREAMER_H_
3 #define _YI_STREAMER_H_
4 
5 #include "scenetree/YiAABB.h"
7 #include "view/YiSceneView.h"
8 
9 #include <glm/fwd.hpp>
10 
11 class CYILayoutConfig;
12 class CYINodeAdapter;
13 class CYISceneManager;
14 class CYISceneNode;
15 class CYIStreamableView;
16 class CYIStreamerSlots;
17 
37 {
38  friend class CYIStreamerSlots;
39  friend class CYIStreamableView;
40 
41 public:
42  CYIStreamer();
43  virtual ~CYIStreamer();
44 
52  void SetAdapter(std::unique_ptr<CYINodeAdapter> pAdapter);
53 
57  const CYINodeAdapter *GetAdapter() const;
58 
63 
70 
74  bool IsStreamedIn(size_t index) const;
75 
79  CYISceneNode *GetStreamedNode(size_t index) const;
80 
84  size_t GetItemIndex(CYISceneNode *pStreamableItem) const;
85 
86 protected:
92  void Init(CYISceneManager *pSceneManager);
93 
98 
107  virtual void StreamedIn(size_t index, CYISceneNode *pStreamedItem);
108 
114  virtual void OnStreamedIn(size_t index, CYISceneNode *pStreamedItem);
115 
122  virtual void StreamedOut(size_t index, CYISceneNode *pStreamedItem);
123 
127  virtual void OnStreamedOut(size_t index, CYISceneNode *pStreamedItem);
128 
134  virtual void InsertItem(size_t index, std::unique_ptr<CYISceneNode> pItem) = 0;
135 
143  virtual std::unique_ptr<CYISceneNode> RemoveItem(size_t index, CYISceneNode *pItem) = 0;
144 
152  virtual void ReorderItem(size_t fromIndex, size_t toIndex, CYISceneNode *pItem) = 0;
153 
157  virtual bool IsItemInStreamingRegion(CYISceneNode *pItem) const = 0;
158 
164  virtual CYISceneNode *GetItem(size_t index) const = 0;
165 
169  virtual bool CanBeStreamedOut(size_t index, CYISceneNode *pNode) const = 0;
170 
174  virtual void OnFocusGainedForItem(size_t index);
175 
183  virtual void FocusGainedForItem(size_t index);
184 
188  virtual void OnFocusLostForItem(size_t index);
189 
197  virtual void FocusLostForItem(size_t index);
198 
199 private:
200  void CreateItemsFromAdapter();
201  void InsertItemPriv(size_t index);
202  void RemoveAllItems();
203  void RemoveItemPriv(size_t index);
204  void MoveItemPriv(size_t fromIndex, size_t toIndex);
205  void OnAdapterItemAdded(size_t index);
206  void OnAdapterItemRemoved(size_t index);
207  void OnAdapterItemMoved(size_t fromIndex, size_t toIndex);
208  void StreamIn(size_t index, CYIStreamableView *pView);
209  void StreamOut(size_t index, CYIStreamableView *pView);
210  void UpdateAllIndices();
211 
212  std::unique_ptr<CYINodeAdapter> m_pAdapter;
213  CYISceneManager *m_pSceneManager;
214  size_t m_items;
215  std::unique_ptr<CYIStreamerSlots> m_pSlots;
216 
218 };
219 
224 #endif // _YI_STREAMER_H_
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:69
A class that implements a scene node streamer.
Definition: YiStreamer.h:36
Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them ...
Definition: YiSceneManager.h:82
virtual std::unique_ptr< CYISceneNode > RemoveItem(size_t index, CYISceneNode *pItem)=0
friend class CYIStreamableView
Definition: YiStreamer.h:39
virtual void OnFocusLostForItem(size_t index)
virtual void FocusGainedForItem(size_t index)
Direction
Definition: YiFocus.h:44
virtual bool CanBeStreamedOut(size_t index, CYISceneNode *pNode) const =0
const CYINodeAdapter * GetAdapter() const
virtual void ReorderItem(size_t fromIndex, size_t toIndex, CYISceneNode *pItem)=0
virtual void OnStreamedIn(size_t index, CYISceneNode *pStreamedItem)
virtual void StreamedOut(size_t index, CYISceneNode *pStreamedItem)
size_t GetItemIndex(CYISceneNode *pStreamableItem) const
Provides an interface for supplying and reclaiming nodes to and from CYIStreamer. ...
Definition: YiNodeAdapter.h:32
virtual void OnStreamedOut(size_t index, CYISceneNode *pStreamedItem)
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:105
virtual void FocusLostForItem(size_t index)
A class used to hold node-specific layout configuration (such as, for example, Margin).
Definition: YiLayoutConfig.h:25
FocusRootRule
Definition: YiFocus.h:60
virtual void StreamedIn(size_t index, CYISceneNode *pStreamedItem)
virtual ~CYIStreamer()
bool IsStreamedIn(size_t index) const
bool RequestFocusOnItem(size_t index, CYIFocus::Direction direction=CYIFocus::Direction::Forward, CYIFocus::FocusRootRule focusRootRule=CYIFocus::FocusRootRule::DescendantsUpdateContext, const CYIAABB &previousFocusRect=CYIAABB())
This class represents an Axis-Aligned Bounding Box.
Definition: YiAABB.h:22
virtual CYISceneNode * GetItem(size_t index) const =0
void SetAdapter(std::unique_ptr< CYINodeAdapter > pAdapter)
CYISceneNode * GetStreamedNode(size_t index) const
friend class CYIStreamerSlots
Definition: YiStreamer.h:38
void UpdateStreamedStateOfAllItems()
virtual void InsertItem(size_t index, std::unique_ptr< CYISceneNode > pItem)=0
void Init(CYISceneManager *pSceneManager)
virtual void OnFocusGainedForItem(size_t index)
virtual bool IsItemInStreamingRegion(CYISceneNode *pItem) const =0