X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fnpatch%2Fnpatch-visual.h;h=e178eb868a134fce0ee3e26a348aef3a011ab222;hb=e35b08ebd60473aef7500601706f665ac8cf7d39;hp=7f7402219b560b054f4410526a26df5dd320705d;hpb=1972f043026a3e1bdcaad71c17859a8f324d1e6d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.h b/dali-toolkit/internal/visuals/npatch/npatch-visual.h index 7f74022..e178eb8 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.h +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.h @@ -19,12 +19,12 @@ */ // INTERNAL INCLUDES -#include +#include // EXTERNAL INCLUDES #include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ namespace Internal { /** - * The renderer which renders an 9 patch image to the control's quad + * The visual which renders an 9 patch image to the control's quad * * The following properties are optional * @@ -49,7 +49,7 @@ namespace Internal * | borderOnly | BOOLEAN * */ -class NPatchVisual: public Visual +class NPatchVisual: public Visual::Base { public: @@ -61,6 +61,26 @@ public: NPatchVisual( VisualFactoryCache& factoryCache ); /** + * @brief Constructor which creates 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 + */ + NPatchVisual( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly = false ); + + /** + * @brief Constructor which creates an N-patch viusal 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( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly = false ); + + /** * @brief A reference counted object may only be deleted by calling Unreference(). */ ~NPatchVisual(); @@ -68,61 +88,42 @@ public: public: // from Visual /** - * @copydoc Visual::GetNaturalSize + * @copydoc Visual::Base::GetNaturalSize */ virtual void GetNaturalSize( Vector2& naturalSize ) const; /** - * @copydoc Visual::SetClipRect + * @copydoc Visual::Base::CreatePropertyMap */ - virtual void SetClipRect( const Rect& clipRect ); + virtual void DoCreatePropertyMap( Property::Map& map ) const; /** - * @copydoc Visual::SetOffset + * @copydoc Visual::Base::DoSetProperty */ - virtual void SetOffset( const Vector2& offset ); + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); /** - * @copydoc Visual::CreatePropertyMap + * @copydoc Visual::Base::DoGetProperty */ - virtual void DoCreatePropertyMap( Property::Map& map ) const; + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); protected: /** - * @copydoc Visual::DoInitialize + * @copydoc Visual::Base::DoInitialize */ virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap ); /** - * @copydoc Visual::DoSetOnStage + * @copydoc Visual::Base::DoSetOnStage */ virtual void DoSetOnStage( Actor& actor ); /** - * @copydoc Visual::DoSetOffStage + * @copydoc Visual::Base::DoSetOffStage */ virtual void DoSetOffStage( Actor& actor ); -public: - - /** - * @brief Sets the 9 patch image of this renderer to the resource at imageUrl - * The renderer 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 - */ - void SetImage( const std::string& imageUrl, bool borderOnly = false ); - - /** - * @brief Sets the 9 patch image of this renderer 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 - */ - void SetImage( NinePatchImage image, bool borderOnly = false ); - private: /** @@ -204,10 +205,10 @@ private: private: - NinePatchImage mImage; ///< The image to render if the renderer was set from an NinePatchImage, empty otherwise + NinePatchImage mImage; ///< The image to render if the visual was set from an NinePatchImage, empty otherwise Image mCroppedImage; - std::string mImageUrl; ///< The url to the image resource to render if the renderer was set from an image resource url, empty otherwise + std::string mImageUrl; ///< The url to the image resource to render if the visual was set from an image resource url, empty otherwise NinePatchImage::StretchRanges mStretchPixelsX; NinePatchImage::StretchRanges mStretchPixelsY; ImageDimensions mImageSize;