TextLabel to update font when system font changes
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / image-view / image-view.h
1 #ifndef __DALI_TOOLKIT_IMAGE_VIEW_H__
2 #define __DALI_TOOLKIT_IMAGE_VIEW_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class ImageView;
33 }
34
35 /**
36  *
37  * @brief ImageView is a class for displaying an Image.
38  */
39 class DALI_IMPORT_API ImageView : public Control
40 {
41 public:
42   /**
43    * @brief The start and end property ranges for this control.
44    */
45   enum PropertyRange
46   {
47     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
48     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
49   };
50
51   /**
52    * @brief An enumeration of properties belonging to the ImageView class.
53    */
54   struct Property
55   {
56     enum
57     {
58       RESOURCE_URL = PROPERTY_START_INDEX, ///< name "resource-url", @see SetImage(), type string
59     };
60   };
61
62 public:
63
64   /**
65    * @brief Create an uninitialized ImageView.
66    */
67   ImageView();
68
69   /**
70    * @brief Create an initialized ImageView.
71    *
72    * @return A handle to a newly allocated Dali ImageView.
73    */
74   static ImageView New();
75
76   /**
77    * @brief Create an initialized ImageView from an Image.
78    *
79    * If the handle is empty, ImageView will display nothing
80    * @param[in] image The Image to display.
81    * @return A handle to a newly allocated ImageView.
82    */
83   static ImageView New( Image image );
84
85   /**
86    * @brief Create an initialized ImageView from an Image resource url
87    *
88    * If the string is empty, ImageView will display nothing
89    * @param[in] url The url of the image resource to display.
90    * @return A handle to a newly allocated ImageView.
91    */
92   static ImageView New( const std::string& url );
93
94   /**
95    * @brief Destructor
96    *
97    * This is non-virtual since derived Handle types must not contain data or virtual methods.
98    */
99   ~ImageView();
100
101   /**
102    * @brief Copy constructor.
103    *
104    * @param[in] imageView ImageView to copy. The copied ImageView will point at the same implementation
105    */
106   ImageView( const ImageView& imageView );
107
108   /**
109    * @brief Assignment operator.
110    *
111    * @param[in] imageView The ImageView to assign from.
112    * @return The updated ImageView.
113    */
114   ImageView& operator=( const ImageView& imageView );
115
116   /**
117    * @brief Downcast an Object handle to ImageView.
118    *
119    * If handle points to a ImageView the downcast produces valid
120    * handle. If not the returned handle is left uninitialized.
121    *
122    * @param[in] handle Handle to an object
123    * @return handle to a ImageView or an uninitialized handle
124    */
125   static ImageView DownCast( BaseHandle handle );
126
127   /**
128    * @brief Sets this ImageView from an Image
129    *
130    * If the handle is empty, ImageView will display nothing
131    * @param[in] image The Image to display.
132    */
133   void SetImage( Image image );
134
135   /**
136    * @brief Gets the Image
137    *
138    * @return The Image currently set to this ImageView
139    */
140   Image GetImage() const;
141
142 public: // Not intended for application developers
143
144   /**
145    * @brief Creates a handle using the Toolkit::Internal implementation.
146    *
147    * @param[in]  implementation  The ImageView implementation.
148    */
149   DALI_INTERNAL ImageView( Internal::ImageView& implementation );
150
151   /**
152    * @brief Allows the creation of this ImageView from an Internal::CustomActor pointer.
153    *
154    * @param[in]  internal  A pointer to the internal CustomActor.
155    */
156   DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
157
158 };
159
160 } // namespace Toolkit
161
162 } // namespace Dali
163
164 #endif // __DALI_TOOLKIT_IMAGE_VIEW_H__