ImageView example code correction
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / image-view / image-view.h
index bc401f1..ac2befa 100644 (file)
@@ -44,6 +44,32 @@ class ImageView;
  *
  * An instance of ImageView can be created using a URL or an Image instance.
  *
  *
  * An instance of ImageView can be created using a URL or an Image instance.
  *
+ * Some resources can be loaded before the ImageView is staged ( already cached ), in these cases if the connection to
+ * ResouceReadySignal is done after the resource is set then signal will be missed.
+ *
+ * To protect against this, IsResourceReady() can be checked before connecting to ResourceReadySignal,
+ * or the signal connection can be done before setting the resource"
+ *
+ * @code
+ *    auto myImageView = ImageView::New( resourceUrl );
+ *    if ( myImageView.IsResourceReady() )
+ *    {
+ *       // do something
+ *    }
+ *    else
+ *    {
+ *      myImageView.ResourceReadySignal.Connect( .... )
+ *    }
+ * @endcode
+ *
+ * OR Connect to signal before setting resource
+ *
+ * @code
+ *    auto myImageView = ImageView::New();
+ *    myImageView.ResourceReadySignal.Connect( .... )
+ *    myImageView.SetProperty( ImageView::Property::IMAGE, resourceUrl );
+ * @endcode
+ *
  * @SINCE_1_0.0
  *
  */
  * @SINCE_1_0.0
  *
  */
@@ -52,7 +78,7 @@ class DALI_IMPORT_API ImageView : public Control
 public:
 
   /**
 public:
 
   /**
-   * @brief The start and end property ranges for this control.
+   * @brief Enumeration for the start and end property ranges for this control.
    * @SINCE_1_0.0
    */
   enum PropertyRange
    * @SINCE_1_0.0
    */
   enum PropertyRange
@@ -65,30 +91,34 @@ public:
   };
 
   /**
   };
 
   /**
-   * @brief An enumeration of properties belonging to the ImageView class.
+   * @brief Enumeration for the instance of properties belonging to the ImageView class.
    * @SINCE_1_0.0
    */
   struct Property
   {
    * @SINCE_1_0.0
    */
   struct Property
   {
+    /**
+     * @brief Enumeration for the instance of properties belonging to the ImageView class.
+     * @SINCE_1_0.0
+     */
     enum
     {
       // Event side properties
 
       /**
        * @DEPRECATED_1_1.16. Use IMAGE instead.
     enum
     {
       // Event side properties
 
       /**
        * @DEPRECATED_1_1.16. Use IMAGE instead.
-       * @brief name "resourceUrl", type string
+       * @brief name "resourceUrl", type string.
        * @SINCE_1_0.0
        */
       RESOURCE_URL = PROPERTY_START_INDEX,
 
       /**
        * @SINCE_1_0.0
        */
       RESOURCE_URL = PROPERTY_START_INDEX,
 
       /**
-       * @brief name "image", type string if it is a url, map otherwise
+       * @brief name "image", type string if it is a url, map otherwise.
        * @SINCE_1_0.0
        */
       IMAGE,
 
       /**
        * @SINCE_1_0.0
        */
       IMAGE,
 
       /**
-       * @brief name "preMultipliedAlpha", type Boolean
+       * @brief name "preMultipliedAlpha", type Boolean.
        * @SINCE_1_1.18
        * @pre image must be initialized.
        */
        * @SINCE_1_1.18
        * @pre image must be initialized.
        */
@@ -98,7 +128,7 @@ public:
       // Animatable properties
 
       /**
       // Animatable properties
 
       /**
-       * @brief name "pixelArea", type Vector4
+       * @brief name "pixelArea", type Vector4.
        * @details Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
        * @SINCE_1_1.18
        */
        * @details Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
        * @SINCE_1_1.18
        */
@@ -109,7 +139,7 @@ public:
 public:
 
   /**
 public:
 
   /**
-   * @brief Create an uninitialized ImageView.
+   * @brief Creates an uninitialized ImageView.
    * @SINCE_1_0.0
    */
   ImageView();
    * @SINCE_1_0.0
    */
   ImageView();
@@ -118,44 +148,49 @@ public:
    * @brief Create an initialized ImageView.
    *
    * @SINCE_1_0.0
    * @brief Create an initialized ImageView.
    *
    * @SINCE_1_0.0
-   * @return A handle to a newly allocated Dali ImageView.
+   * @return A handle to a newly allocated Dali ImageView
    *
    * @note ImageView will not display anything.
    */
   static ImageView New();
 
   /**
    *
    * @note ImageView will not display anything.
    */
   static ImageView New();
 
   /**
-   * @brief Create an initialized ImageView from an Image instance.
+   * @DEPRECATED_1_2_8, use New( const std::string& ) instead.
+   *
+   * @brief Creates an initialized ImageView from an Image instance.
    *
    * If the handle is empty, ImageView will not display anything.
    *
    * @SINCE_1_0.0
    *
    * If the handle is empty, ImageView will not display anything.
    *
    * @SINCE_1_0.0
-   * @param[in] image The Image instance to display.
-   * @return A handle to a newly allocated ImageView.
+   * @param[in] image The Image instance to display
+   * @return A handle to a newly allocated ImageView
    */
    */
-  static ImageView New( Image image );
+  static ImageView New( Image image ) DALI_DEPRECATED_API;
 
   /**
 
   /**
-   * @brief Create an initialized ImageView from an URL to an image resource.
+   * @brief Creates an initialized ImageView from an URL to an image resource.
    *
    * If the string is empty, ImageView will not display anything.
    *
    * @SINCE_1_0.0
    *
    * If the string is empty, ImageView will not display anything.
    *
    * @SINCE_1_0.0
-   * @param[in] url The url of the image resource to display.
-   * @return A handle to a newly allocated ImageView.
+   * @REMARK_INTERNET
+   * @REMARK_STORAGE
+   * @param[in] url The url of the image resource to display
+   * @return A handle to a newly allocated ImageView
    */
   static ImageView New( const std::string& url );
 
   /**
    */
   static ImageView New( const std::string& url );
 
   /**
-   * @brief Create an initialized ImageView from a URL to an image resource.
+   * @brief Creates an initialized ImageView from a URL to an image resource.
    *
    * If the string is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.10
    *
    * If the string is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.10
-   * @param[in] url The url of the image resource to display.
-   * @param [in] size The width and height to which to fit the loaded image.
-   * @return A handle to a newly allocated ImageView.
-   *
+   * @REMARK_INTERNET
+   * @REMARK_STORAGE
+   * @param[in] url The url of the image resource to display
+   * @param [in] size The width and height to which to fit the loaded image
+   * @return A handle to a newly allocated ImageView
    * @note A valid size is preferable for efficiency.
    *       However, do not set a size that is bigger than the actual image size, as up-scaling is not available.
    *       The content of the area not covered by the actual image is undefined and will not be cleared.
    * @note A valid size is preferable for efficiency.
    *       However, do not set a size that is bigger than the actual image size, as up-scaling is not available.
    *       The content of the area not covered by the actual image is undefined and will not be cleared.
@@ -163,7 +198,7 @@ public:
   static ImageView New( const std::string& url, ImageDimensions size );
 
   /**
   static ImageView New( const std::string& url, ImageDimensions size );
 
   /**
-   * @brief Destructor
+   * @brief Destructor.
    *
    * This is non-virtual since derived Handle types must not contain data or virtual methods.
    * @SINCE_1_0.0
    *
    * This is non-virtual since derived Handle types must not contain data or virtual methods.
    * @SINCE_1_0.0
@@ -182,31 +217,33 @@ public:
    * @brief Assignment operator.
    *
    * @SINCE_1_0.0
    * @brief Assignment operator.
    *
    * @SINCE_1_0.0
-   * @param[in] imageView The ImageView to assign from.
-   * @return The updated ImageView.
+   * @param[in] imageView The ImageView to assign from
+   * @return The updated ImageView
    */
   ImageView& operator=( const ImageView& imageView );
 
   /**
    */
   ImageView& operator=( const ImageView& imageView );
 
   /**
-   * @brief Downcast a handle to ImageView handle.
+   * @brief Downcasts a handle to ImageView handle.
    *
    *
-   * If handle points to a ImageView the downcast produces valid
-   * handle. If not the returned handle is left uninitialized.
+   * If handle points to a ImageView, the downcast produces valid handle.
+   * If not, the returned handle is left uninitialized.
    *
    * @SINCE_1_0.0
    * @param[in] handle Handle to an object
    *
    * @SINCE_1_0.0
    * @param[in] handle Handle to an object
-   * @return handle to a ImageView or an uninitialized handle
+   * @return Handle to a ImageView or an uninitialized handle
    */
   static ImageView DownCast( BaseHandle handle );
 
   /**
    */
   static ImageView DownCast( BaseHandle handle );
 
   /**
+   * @DEPRECATED_1_2_8, use SetImage( const std::string& ) instead.
+   *
    * @brief Sets this ImageView from an Image instance.
    *
    * If the handle is empty, ImageView will display nothing
    * @SINCE_1_0.0
    * @param[in] image The Image instance to display.
    */
    * @brief Sets this ImageView from an Image instance.
    *
    * If the handle is empty, ImageView will display nothing
    * @SINCE_1_0.0
    * @param[in] image The Image instance to display.
    */
-  void SetImage( Image image );
+  void SetImage( Image image ) DALI_DEPRECATED_API;
 
   /**
    * @brief Sets this ImageView from the given URL.
 
   /**
    * @brief Sets this ImageView from the given URL.
@@ -214,7 +251,9 @@ public:
    * If the URL is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.4
    * If the URL is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.4
-   * @param[in] url The URL to the image resource to display.
+   * @REMARK_INTERNET
+   * @REMARK_STORAGE
+   * @param[in] url The URL to the image resource to display
    */
   void SetImage( const std::string& url );
 
    */
   void SetImage( const std::string& url );
 
@@ -224,8 +263,10 @@ public:
    * If the URL is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.10
    * If the URL is empty, ImageView will not display anything.
    *
    * @SINCE_1_1.10
-   * @param[in] url The URL to the image resource to display.
-   * @param [in] size The width and height to fit the loaded image to.
+   * @REMARK_INTERNET
+   * @REMARK_STORAGE
+   * @param[in] url The URL to the image resource to display
+   * @param [in] size The width and height to fit the loaded image to
    */
   void SetImage( const std::string& url, ImageDimensions size );
 
    */
   void SetImage( const std::string& url, ImageDimensions size );
 
@@ -236,17 +277,18 @@ public:
    * A valid handle will be returned only if this instance was created with New(Image) or SetImage(Image) was called.
    *
    * @SINCE_1_0.0
    * A valid handle will be returned only if this instance was created with New(Image) or SetImage(Image) was called.
    *
    * @SINCE_1_0.0
-   * @return The Image instance currently used by the ImageView.
+   * @return The Image instance currently used by the ImageView
    */
    */
-  Image GetImage() const;
+  Image GetImage() const DALI_DEPRECATED_API;
 
 public: // Not intended for application developers
 
 
 public: // Not intended for application developers
 
+  /// @cond internal
   /**
    * @brief Creates a handle using the Toolkit::Internal implementation.
    *
    * @SINCE_1_0.0
   /**
    * @brief Creates a handle using the Toolkit::Internal implementation.
    *
    * @SINCE_1_0.0
-   * @param[in]  implementation  The ImageView implementation.
+   * @param[in] implementation The ImageView implementation
    */
   DALI_INTERNAL ImageView( Internal::ImageView& implementation );
 
    */
   DALI_INTERNAL ImageView( Internal::ImageView& implementation );
 
@@ -254,9 +296,10 @@ public: // Not intended for application developers
    * @brief Allows the creation of this ImageView from an Internal::CustomActor pointer.
    *
    * @SINCE_1_0.0
    * @brief Allows the creation of this ImageView from an Internal::CustomActor pointer.
    *
    * @SINCE_1_0.0
-   * @param[in]  internal  A pointer to the internal CustomActor.
+   * @param[in] internal A pointer to the internal CustomActor
    */
   DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
    */
   DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
+  /// @endcond
 
 };
 
 
 };