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 static ImageView New();
84 * @brief Create an initialized ImageView from an Image.
86 * If the handle is empty, ImageView will display nothing
87 * @param[in] image The Image to display.
88 * @return A handle to a newly allocated ImageView.
90 static ImageView New( Image image );
93 * @brief Create an initialized ImageView from an Image resource url
95 * @note A valid size is preferable for efficiency.
96 * However, do not set size that is bigger than the actual image size, as the up-scaling is not available,
97 * the content of the area not covered by actual image is undefined, it will not be cleared.
99 * If the string is empty, ImageView will display nothing
100 * @param[in] url The url of the image resource to display.
101 * @param [in] size The width and height to fit the loaded image to.
102 * @return A handle to a newly allocated ImageView.
104 static ImageView New( const std::string& url,
105 ImageDimensions size = ImageDimensions() );
110 * This is non-virtual since derived Handle types must not contain data or virtual methods.
115 * @brief Copy constructor.
117 * @param[in] imageView ImageView to copy. The copied ImageView will point at the same implementation
119 ImageView( const ImageView& imageView );
122 * @brief Assignment operator.
124 * @param[in] imageView The ImageView to assign from.
125 * @return The updated ImageView.
127 ImageView& operator=( const ImageView& imageView );
130 * @brief Downcast an Object handle to ImageView.
132 * If handle points to a ImageView the downcast produces valid
133 * handle. If not the returned handle is left uninitialized.
135 * @param[in] handle Handle to an object
136 * @return handle to a ImageView or an uninitialized handle
138 static ImageView DownCast( BaseHandle handle );
141 * @brief Sets this ImageView from an Image
143 * If the handle is empty, ImageView will display nothing
144 * @param[in] image The Image to display.
146 void SetImage( Image image );
149 * @brief Sets this ImageView from an Image url
151 * If the handle is empty, ImageView will display nothing
155 * @param[in] url The Image resource to display.
156 * @param [in] size The width and height to fit the loaded image to.
158 void SetImage( const std::string& url,
159 ImageDimensions size = ImageDimensions() );
162 * @deprecated Gets the Image
164 * @return The Image currently set to this ImageView
166 Image GetImage() const;
168 public: // Not intended for application developers
171 * @brief Creates a handle using the Toolkit::Internal implementation.
173 * @param[in] implementation The ImageView implementation.
175 DALI_INTERNAL ImageView( Internal::ImageView& implementation );
178 * @brief Allows the creation of this ImageView from an Internal::CustomActor pointer.
180 * @param[in] internal A pointer to the internal CustomActor.
182 DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
189 } // namespace Toolkit
193 #endif // __DALI_TOOLKIT_IMAGE_VIEW_H__