+
+class TestItemLayout;
+
+typedef IntrusivePtr<TestItemLayout> TestItemLayoutPtr;
+
+// Implementation of ItemLayout
+class TestItemLayout : public ItemLayout
+{
+public:
+
+ /**
+ * Constructor
+ */
+ TestItemLayout()
+ {
+ }
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~TestItemLayout()
+ {
+ }
+
+ /**
+ * Create a new grid layout.
+ */
+ static TestItemLayoutPtr New()
+ {
+ return TestItemLayoutPtr(new TestItemLayout());
+ }
+
+public: // From ItemLayout
+
+ /**
+ * Query the minimum valid layout position; this is a negative value.
+ *
+ * When scrolling, the first item will move within the range 0 to GetMinimumLayoutPosition().
+ * @param[in] numberOfItems The current number of items in the layout.
+ * @param[in] layoutSize The size of the layout area.
+ * @return The minimum layout position.
+ */
+ virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const
+ {
+ return 0.0f;
+ }
+
+ /**
+ * Query the closest anchor position for the given layout position.
+ *
+ * This anchor position is the position where all the items in the layout are aligned to
+ * their rounded layout positions in integer.
+ * @param[in] layoutPosition The layout position.
+ * @return The closest anchor position for the given layout position.
+ */
+ virtual float GetClosestAnchorPosition(float layoutPosition) const
+ {
+ return 0.0f;
+ }
+
+ /**
+ * Query the layout position for the first item in the layout to move to when the layout
+ * needs to scroll to a particular item.
+ *
+ * @param[in] itemId The ID of an item in the layout.
+ * @return The layout position for the first item in the layout to move to.
+ */
+ virtual float GetItemScrollToPosition(unsigned int itemId) const
+ {
+ return 0.0f;
+ }
+
+ /**
+ * Query the items within a given layout-area.
+ *
+ * @param[in] firstItemPosition The layout-position of the first item in the layout.
+ * @param[in] layoutSize The size of the layout area.
+ * @return The ID of the first & last visible item.
+ */
+ virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const
+ {
+ return ItemRange(0, 10);
+ }
+
+ /**
+ * Query the number of items that should be reserved, for scrolling purposes.
+ *
+ * @param[in] layoutSize The size of the layout area.
+ * @return The number of extra items.
+ */
+ virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const
+ {
+ return 0;
+ }
+
+ /**
+ * Retrieve the default size of an item in the layout.
+ *
+ * @param[in] itemId The ID of an item in the layout.
+ * @param[in] layoutSize The layout size
+ * @param[out] itemSize The target size of an item.
+ */
+ virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const
+ {
+ }
+
+ /**
+ * @brief Query the scroll direction of the layout.
+ * @return The scroll direction in degrees.
+ */
+ virtual Degree GetScrollDirection() const
+ {
+ return Degree( 0.0f );
+ }
+
+ /**
+ * @brief Query the scroll speed factor of the layout while dragging.
+ * @return The scroll speed factor of the layout.
+ */
+ virtual float GetScrollSpeedFactor() const
+ {
+ return 0;
+ }
+
+ /**
+ * @brief Query the maximum swipe speed in pixels per second.
+ * @return speed The maximum swipe speed.
+ */
+ virtual float GetMaximumSwipeSpeed() const
+ {
+ return 0;
+ }
+
+ /**
+ * @brief Get the duration of the flick animation in second.
+ * @return The duration of the flick animation.
+ */
+ virtual float GetItemFlickAnimationDuration() const
+ {
+ return 0;
+ }
+
+ /*
+ * @brief Applies constraints defined by the layout to an actor.
+ *
+ * @param[in] actor The actor to constrain.
+ * @param[in] itemId The ID of the item represented by the actor.
+ * @param[in] layoutSize the current size of the item view instance.
+ * @param[in] itemViewActor The item view instance which requests the application of constraints.
+ */
+ virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
+ {
+ }
+
+ /**
+ * @brief Gets the position of a given item
+ *
+ * @param[in] itemID id of the item we want to get its position
+ * @param[in] currentLayoutPosition the current layout position of the item view instance
+ * @param[in] layoutSize the current size of the item view instance
+ * @return The item position (x,y,z)
+ */
+ virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const
+ {
+ return Vector3::ZERO;
+ }
+};
+