X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fscrollable%2Fitem-view%2Fitem-layout.h;h=9302e8adc06abe5fd4bbc672caa178e320653f48;hp=cf328f2f6a66713ea6b97ecd479a4ec06ad658e4;hb=07bbc876b9b069903dd4ed86c9dd5f2f66fc3b86;hpb=6d762b4acd946b3d02e76c1805e7af9a1a5b1809 diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h index cf328f2..9302e8a 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h +++ b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_ITEM_LAYOUT_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,7 @@ */ // EXTERNAL INCLUDES -#include -#include +#include // INTERNAL INCLUDES #include @@ -31,16 +30,15 @@ namespace Dali namespace Toolkit { +/** + * @addtogroup dali-toolkit-controls-item-view + * @{ + */ class ItemLayout; typedef IntrusivePtr ItemLayoutPtr; ///< Pointer to a Dali::Toolkit::ItemLayout object -typedef std::vector ItemLayoutContainer; ///< Container of Dali::Toolkit::ItemLayout objects -typedef ItemLayoutContainer::iterator ItemLayoutIter; ///< Iterator for Dali::Toolkit::ItemLayoutContainer -typedef ItemLayoutContainer::const_iterator ItemLayoutConstIter; ///< Const Iterator for Dali::Toolkit::ItemLayoutContainer - - /** * @brief A support class for managing ranges of items. */ @@ -128,21 +126,11 @@ struct ItemRange * An ItemLayout also describes the direction of input gestures, used to scroll through the layout. * Whilst scrolling, the layout provides a range of items that are within a layout-area (3D bounding volume). */ -class ItemLayout : public RefObject +class DALI_IMPORT_API ItemLayout : public RefObject { public: - /// @brief Function signature of a boolean constraint - typedef boost::function BoolFunction; - - /// @brief Function signature of a Vector3 constraint - typedef boost::function Vector3Function; - - /// @brief Function signature of a Vector4 constraint - typedef boost::function Vector4Function; - - /// @brief Function signature of a Quaternion constraint - typedef boost::function QuaternionFunction; + class Extension; ///< Forward declare future extension interface /** * @brief Virtual destructor. @@ -164,6 +152,26 @@ public: DALI_IMPORT_API ControlOrientation::Type GetOrientation() const; /** + * @brief Retrieve the target size of an item in the layout. + * + * This will return the default size for the layout unless overridden by calling SetItemSize(). + * + * @note layout-position is not provided as a parameter, since applying size constraints is not recommended. + * Animating to target-sizes is preferable, since this allows controls to perform layouting without constraints. + * @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. + */ + DALI_IMPORT_API void GetItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const; + + /** + * @brief Overrides the default size for the layout. + * + * @param[in] itemSize The size of each item. + */ + DALI_IMPORT_API void SetItemSize( const Vector3& itemSize ); + + /** * @brief Query the minimum valid layout position; this is a negative value. * * When scrolling, the first item will move within the range 0 to GetMinimumLayoutPosition(). @@ -229,77 +237,15 @@ public: virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const = 0; /** - * @brief Retrieve the target size of an item in the layout. + * @brief Retrieve the default size of an item in the layout. * * @note layout-position is not provided as a parameter, since applying size constraints is not recommended. * Animating to target-sizes is preferable, since this allows controls to perform layouting without constraints. * @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, or an uninitialized value. - * @return Whether the item size is available or not - */ - virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const = 0; - - /** - * @brief Retrieve the resize animation in the layout. - * - * @note This allows the layout to provide its own resize animation. - * @param[in] animation The resize animation, not owned by the layout - * @param[in] actor The actor to animate - * @param [in] size The target size. - * @param [in] durationSeconds The duration of the resizing. - */ - virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const = 0; - - /** - * @brief Retrieve the position constraint function of an item in the layout. - * - * The constraint will be applied when the item is created or the layout is activated. - * @param[in] itemId The ID of an item in the layout. - * @param[out] constraint The position constraint function of an item, or an uninitialized function pointer. - * @return Whether the position constraint function of an item is available or not - */ - virtual bool GetPositionConstraint(unsigned int itemId, Vector3Function& constraint) const = 0; - - /** - * @brief Retrieve the rotation constraint function of an item in the layout. - * - * The constraint will be applied when the item is created or the layout is activated. - * @param[in] itemId The ID of an item in the layout. - * @param[out] constraint The rotation constraint function of an item, or an uninitialized function pointer. - * @return Whether the rotation constraint function of an item is available or not - */ - virtual bool GetRotationConstraint(unsigned int itemId, QuaternionFunction& constraint) const = 0; - - /** - * @brief Retrieve the scale constraint function of an item in the layout. - * - * The constraint will be applied when the item is created or the layout is activated. - * @param[in] itemId The ID of an item in the layout. - * @param[out] constraint The scale constraint function of an item, or an uninitialized function pointer. - * @return Whether the scale constraint function of an item is available or not - */ - virtual bool GetScaleConstraint(unsigned int itemId, Vector3Function& constraint) const = 0; - - /** - * @brief Retrieve the color constraint function of an item in the layout. - * - * The constraint will be applied when the item is created or the layout is activated. - * @param[in] itemId The ID of an item in the layout. - * @param[out] constraint The color constraint function of an item, or an uninitialized function pointer. - * @return Whether the color constraint function of an item is available or not - */ - virtual bool GetColorConstraint(unsigned int itemId, Vector4Function& constraint) const = 0; - - /** - * @brief Retrieve the visibility constraint function of an item in the layout. - * - * The constraint will be applied when the item is created or the layout is activated. - * @param[in] itemId The ID of an item in the layout. - * @param[out] constraint The visibility constraint function of an item, or an uninitialized function pointer. - * @return Whether the visibility constraint function of an item is available or not + * @param[out] itemSize The target size of an item. */ - virtual bool GetVisibilityConstraint(unsigned int itemId, BoolFunction& constraint) const = 0; + virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const = 0; /** * @brief Query the scroll direction of the layout. @@ -311,38 +257,6 @@ public: virtual Degree GetScrollDirection() const = 0; /** - * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction. - * - * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a - * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis. - * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar - * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis - * - * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all - * layout implementations should provide their own version of this function to ensure proper functionality of - * internal toolkit systems. - * - * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for x-axis scrolling - */ - DALI_IMPORT_API virtual void GetXAxisScrollHint(Vector2& scrollHint) const; - - /** - * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction. - * - * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a - * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis. - * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar - * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis - * - * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all - * layout implementations should provide their own version of this function to ensure proper functionality of - * internal toolkit systems. - * - * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for y-axis scrolling - */ - DALI_IMPORT_API virtual void GetYAxisScrollHint(Vector2& scrollHint) const; - - /** * @brief Query the scroll speed factor of the layout while dragging. * * This factor is used by the layout to customise its scroll speed while dragging. @@ -383,7 +297,7 @@ public: * @param[in] loopEnabled Whether the KeyboardFocusManager is set to wrap around between first and last item * @return The next item ID. */ - DALI_IMPORT_API virtual int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled); + DALI_IMPORT_API virtual int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled); /** * @brief Query the flick speed factor of the layout while swipping. @@ -404,11 +318,10 @@ public: * * @param[in] actor The actor to constrain. * @param[in] itemId The ID of the item represented by the actor. - * @param[in] durationSeconds The time taken to fully constrain the actors. - * @param[in] scrollPositionObject The object which provides the layout position property. + * @param[in] layoutSize the current size of the item view instance. * @param[in] itemViewActor The item view instance which requests the application of constraints. */ - DALI_IMPORT_API virtual void ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Handle scrollPositionObject, const Actor& itemViewActor ); + DALI_IMPORT_API virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor ) = 0; /** * @brief Gets the position of a given item @@ -418,21 +331,17 @@ public: * @param[in] layoutSize the current size of the item view instance * @return The item position (x,y,z) */ - DALI_IMPORT_API virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const; - - /** - * @brief Set the alpha function used when applying constraints - * - * @param[in] func The alpha function to use. - */ - DALI_IMPORT_API void SetAlphaFunction(AlphaFunction func); + DALI_IMPORT_API virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const = 0; /** - * @brief Retrieve the alpha function used when applying constraints + * Retrieve the extension for this layout. * - * @return The alpha function. + * @return The extension if available, NULL otherwise */ - DALI_IMPORT_API AlphaFunction GetAlphaFunction() const; + virtual Extension* GetExtension() + { + return NULL; + } protected: @@ -441,12 +350,27 @@ protected: */ DALI_IMPORT_API ItemLayout(); +private: + + /** + * Don't allow copy constructor + */ + ItemLayout( const ItemLayout& handle ); + + /** + * Don't allow copy operator + */ + ItemLayout& operator=( const ItemLayout& handle ); + protected: - ControlOrientation::Type mOrientation; ///< the orientation of the layout. - AlphaFunction mAlphaFunction; ///