1 #ifndef __DALI_TOOLKIT_IMAGE_VIEW_H__
2 #define __DALI_TOOLKIT_IMAGE_VIEW_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/public-api/controls/control.h>
25 #include <dali/public-api/images/image-operations.h>
33 namespace Internal DALI_INTERNAL
38 * @addtogroup dali_toolkit_controls_image_view
44 * @brief ImageView is a class for displaying an Image.
46 class DALI_IMPORT_API ImageView : public Control
50 * @brief The start and end property ranges for this control.
54 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
55 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
59 * @brief An enumeration of properties belonging to the ImageView class.
65 IMAGE = PROPERTY_START_INDEX, ///< name "image", @see SetImage(), type string if it is a url, map otherwise
72 * @brief Create an uninitialized ImageView.
77 * @brief Create an initialized ImageView.
79 * @return A handle to a newly allocated Dali ImageView.
81 * @note ImageView will not display anything.
83 static ImageView New();
86 * @brief Create an initialized ImageView from an Image.
88 * If the handle is empty, ImageView will not display anything.
90 * @param[in] image The Image to display.
91 * @return A handle to a newly allocated ImageView.
93 static ImageView New( Image image );
96 * @brief Create an initialized ImageView from an Image resource URL
98 * If the string is empty, ImageView will not display anything.
100 * @param[in] url The url of the image resource to display.
101 * @return A handle to a newly allocated ImageView.
103 static ImageView New( const std::string& url );
106 * @brief Create an initialized ImageView from an Image resource URL
108 * If the string is empty, ImageView will not display anything.
112 * @param[in] url The url of the image resource to display.
113 * @param [in] size The width and height to fit the loaded image to.
114 * @return A handle to a newly allocated ImageView.
116 * @note A valid size is preferable for efficiency.
117 * However, do not set a size that is bigger than the actual image size, as up-scaling is not available.
118 * The content of the area not covered by the actual image is undefined and will not be cleared.
120 static ImageView New( const std::string& url, ImageDimensions size );
125 * This is non-virtual since derived Handle types must not contain data or virtual methods.
130 * @brief Copy constructor.
132 * @param[in] imageView ImageView to copy. The copied ImageView will point at the same implementation
134 ImageView( const ImageView& imageView );
137 * @brief Assignment operator.
139 * @param[in] imageView The ImageView to assign from.
140 * @return The updated ImageView.
142 ImageView& operator=( const ImageView& imageView );
145 * @brief Downcast an Object handle to ImageView.
147 * If handle points to a ImageView the downcast produces valid
148 * handle. If not the returned handle is left uninitialized.
150 * @param[in] handle Handle to an object
151 * @return handle to a ImageView or an uninitialized handle
153 static ImageView DownCast( BaseHandle handle );
156 * @brief Sets this ImageView from an Image
158 * If the handle is empty, ImageView will display nothing
159 * @param[in] image The Image to display.
161 void SetImage( Image image );
164 * @brief Sets this ImageView from an Image URL
166 * If the URL is empty, ImageView will not display anything.
170 * @param[in] url The Image resource to display.
172 void SetImage( const std::string& url );
175 * @brief Sets this ImageView from an Image URL
177 * If the URL is empty, ImageView will not display anything.
181 * @param[in] url A URL to the image resource to display.
182 * @param [in] size The width and height to fit the loaded image to.
184 void SetImage( const std::string& url, ImageDimensions size );
187 * @deprecated Gets the Image
189 * @return The Image currently set to this ImageView
191 Image GetImage() const;
193 public: // Not intended for application developers
196 * @brief Creates a handle using the Toolkit::Internal implementation.
198 * @param[in] implementation The ImageView implementation.
200 DALI_INTERNAL ImageView( Internal::ImageView& implementation );
203 * @brief Allows the creation of this ImageView from an Internal::CustomActor pointer.
205 * @param[in] internal A pointer to the internal CustomActor.
207 DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
214 } // namespace Toolkit
218 #endif // __DALI_TOOLKIT_IMAGE_VIEW_H__