Stop trying to find the URL parameter multiple times from property map
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / npatch / npatch-visual.h
index a993303..b3d2815 100644 (file)
  *
  */
 
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-
 // EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/images/image.h>
 #include <dali/public-api/images/image-operations.h>
-#include <dali/public-api/images/nine-patch-image.h>
+#include <dali/devel-api/images/nine-patch-image.h>
 #include <dali/public-api/rendering/geometry.h>
 #include <dali/public-api/rendering/sampler.h>
 #include <dali/public-api/rendering/shader.h>
 
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+
 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,16 +58,22 @@ class NPatchVisual: public Visual::Base
 public:
 
   /**
-   * @brief Constructor.
+   * @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
    */
-  NPatchVisual( VisualFactoryCache& factoryCache );
+  static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
 
   /**
-   * @brief A reference counted object may only be deleted by calling Unreference().
+   * @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
    */
-  ~NPatchVisual();
+  static NPatchVisualPtr New( VisualFactoryCache& factoryCache, NinePatchImage image );
 
 public:  // from Visual
 
@@ -77,41 +87,49 @@ public:  // from Visual
    */
   virtual void DoCreatePropertyMap( Property::Map& map ) const;
 
+  /**
+   * @copydoc Visual::Base::DoSetProperty
+   */
+  virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
+
+  /**
+   * @copydoc Visual::Base::DoGetProperty
+   */
+  virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
+
 protected:
 
   /**
-   * @copydoc Visual::Base::DoInitialize
+   * @brief Constructor.
+   *
+   * @param[in] factoryCache Reference to the VisualFactoryCache object
    */
-  virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+  NPatchVisual( VisualFactoryCache& factoryCache );
 
   /**
-   * @copydoc Visual::Base::DoSetOnStage
+   * @brief A reference counted object may only be deleted by calling Unreference().
    */
-  virtual void DoSetOnStage( Actor& actor );
+  virtual ~NPatchVisual();
 
   /**
-   * @copydoc Visual::Base::DoSetOffStage
+   * @copydoc Visual::Base::DoSetProperties
    */
-  virtual void DoSetOffStage( Actor& actor );
+  virtual void DoSetProperties( const Property::Map& propertyMap );
 
-public:
+  /**
+   * @copydoc Visual::Base::DoSetOnStage
+   */
+  virtual void DoSetOnStage( Actor& actor );
 
   /**
-   * @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::DoSetOffStage
    */
-  void SetImage( const std::string& imageUrl, bool borderOnly = false );
+  virtual void DoSetOffStage( 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::OnSetTransform
    */
-  void SetImage( NinePatchImage image, bool borderOnly = false );
+  virtual void OnSetTransform();
 
 private: