X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fnpatch%2Fnpatch-visual.h;h=07918ee7621801b7f878e5d4105736d83ffe4e19;hp=498bcc26469f334b1930a7bd851f2a15f1fdc30c;hb=c211a7d84885dca19c90b4656055002865e6fce2;hpb=d46f6a3bf122f36f36e9c4e8ab048f9482984dfe diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.h b/dali-toolkit/internal/visuals/npatch/npatch-visual.h index 498bcc2..07918ee 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.h +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.h @@ -18,17 +18,18 @@ * */ -// INTERNAL INCLUDES -#include - // EXTERNAL INCLUDES +#include #include #include -#include +#include #include #include #include +// INTERNAL INCLUDES +#include + namespace Dali { @@ -38,6 +39,9 @@ namespace Toolkit namespace Internal { +class NPatchVisual; +typedef IntrusivePtr< NPatchVisual > NPatchVisualPtr; + /** * The visual which renders an 9 patch image to the control's quad * @@ -54,64 +58,84 @@ class NPatchVisual: public Visual::Base public: /** - * @brief Constructor. + * @brief Create a new n-patch visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @return A smart-pointer to the newly allocated visual. */ - NPatchVisual( VisualFactoryCache& factoryCache ); + static NPatchVisualPtr New( VisualFactoryCache& factoryCache ); /** - * @brief A reference counted object may only be deleted by calling Unreference(). + * @brief Create an N-patch visual using an image URL. + * + * The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] imageUrl The URL to 9 patch image resource to use + * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border + */ + static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly = false ); + + /** + * @brief Create an N-patch visual with a NinePatchImage resource. + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] image The NinePatchImage to use + * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border */ - ~NPatchVisual(); + static NPatchVisualPtr New( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly = false ); public: // from Visual /** - * @copydoc Visual::GetNaturalSize + * @copydoc Visual::Base::GetNaturalSize */ virtual void GetNaturalSize( Vector2& naturalSize ) const; /** - * @copydoc Visual::CreatePropertyMap + * @copydoc Visual::Base::CreatePropertyMap */ virtual void DoCreatePropertyMap( Property::Map& map ) const; -protected: + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); /** - * @copydoc Visual::DoInitialize + * @copydoc Visual::Base::DoGetProperty */ - virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap ); + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + +protected: /** - * @copydoc Visual::DoSetOnStage + * @brief Constructor. + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border */ - virtual void DoSetOnStage( Actor& actor ); + NPatchVisual( VisualFactoryCache& factoryCache, bool borderOnly = false ); /** - * @copydoc Visual::DoSetOffStage + * @brief A reference counted object may only be deleted by calling Unreference(). */ - virtual void DoSetOffStage( Actor& actor ); + virtual ~NPatchVisual(); -public: + /** + * @copydoc Visual::Base::DoInitialize + */ + virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap ); /** - * @brief Sets the 9 patch image of this visual to the resource at imageUrl - * The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage - * - * @param[in] imageUrl The URL to 9 patch image resource to use - * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border + * @copydoc Visual::Base::DoSetOnStage */ - void SetImage( const std::string& imageUrl, bool borderOnly = false ); + virtual void DoSetOnStage( Actor& actor ); /** - * @brief Sets the 9 patch image of this viusal to the 9 patch image - * - * @param[in] image The NinePatchImage to use - * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border + * @copydoc Visual::Base::DoSetOffStage */ - void SetImage( NinePatchImage image, bool borderOnly = false ); + virtual void DoSetOffStage( Actor& actor ); private: