- * ItemPool is container of Actor/ID pairs stored by ItemView
- */
-class ItemPool
-{
-public: // types
-
- typedef std::pair<unsigned int, Actor> IDKeyPair;
- typedef std::map<unsigned int, Actor> IDKeyContainer;
- typedef IDKeyContainer::iterator IDKeyIter;
- typedef IDKeyContainer::const_iterator IDKeyConstIter;
-
- typedef std::pair<Actor, unsigned int> ActorKeyPair;
- typedef std::map<Actor, unsigned int> ActorKeyContainer;
- typedef ActorKeyContainer::iterator ActorKeyIter;
- typedef ActorKeyContainer::const_iterator ActorKeyConstIter;
-
-public: // Construction & Destruction
-
- /**
- * Constructor
- * @param[in] itemView A reference to the ItemView class that owns this.
- */
- ItemPool(ItemView& itemView)
- : mItemView(itemView)
- {
- }
-
-public: // Methods
-
- /**
- * Returns a const reference to the IDKeyContainer whose key is based on the Item ID.
- * @return Const reference to IDKeyContainer.
- */
- const IDKeyContainer& GetIDKeyContainer() const
- {
- return mIdKeyContainer;
- }
-
- /**
- * Returns a const reference to the ActorKeyContainer whose key is based on the Actor.
- * @return Const reference to IDKeyContainer.
- */
- const ActorKeyContainer& GetActorKeyContainer() const
- {
- return mActorKeyContainer;
- }
-
- /**
- * Add a range of items to the ItemPool, if they are not already in the ItemPool.
- * @param[in] scrollingTowardsLast Should be true if scrolling towards the last item in the range.
- * @param[in] range The range of Item IDs to associate with the new actors.
- * @param[in] targetSize The current size of the layout.
- */
- void AddItems(bool scrollingTowardsLast, ItemRange range, const Vector3& targetSize);
-
- /**
- * Remove items from the ItemPool that are outside the given range.
- * @param[in] range The range of required items.
- */
- void RemoveItems(ItemRange range);
-
- /**
- * Remove an item from the ItemPool.
- * @param[in] itemId The item to remove.
- * @return Whether the item is found and removed or not.
- */
- bool RemoveItem(unsigned int itemId);
-
-private:
-
- /**
- * Adds an item, if not already in the ItemPool.
- * @param[in] itemId The item to add.
- * @param[in] targetSize The target size of the layout.
- */
- void AddItem(unsigned int itemId, const Vector3& targetSize);
-
-private:
-
- IDKeyContainer mIdKeyContainer;
- ActorKeyContainer mActorKeyContainer;
- ItemView& mItemView;
-};
-
-/**