33332896cc2fba13183055067d83d83fa9972d2d
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / image-view / image-view.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/images/resource-image.h>
23 #include <dali/public-api/object/property-map.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 ImageView::ImageView()
35 {
36 }
37
38 ImageView::ImageView( const ImageView& imageView )
39 : Control( imageView )
40 {
41 }
42
43 ImageView& ImageView::operator=( const ImageView& imageView )
44 {
45   if( &imageView != this )
46   {
47     Control::operator=( imageView );
48   }
49   return *this;
50 }
51
52 ImageView::~ImageView()
53 {
54 }
55
56 ImageView ImageView::New()
57 {
58   return Internal::ImageView::New();
59 }
60
61 ImageView ImageView::New( Image image )
62 {
63   ImageView imageView = Internal::ImageView::New();
64   imageView.SetImage( image );
65   return imageView;
66 }
67
68 ImageView ImageView::New( const std::string& url )
69 {
70   ImageView imageView = Internal::ImageView::New();
71   imageView.SetImage( url, ImageDimensions() );
72   return imageView;
73 }
74
75 ImageView ImageView::New( const std::string& url, ImageDimensions size )
76 {
77   ImageView imageView = Internal::ImageView::New();
78   imageView.SetImage( url, size );
79   return imageView;
80 }
81
82 ImageView ImageView::DownCast( BaseHandle handle )
83 {
84   return Control::DownCast<ImageView, Internal::ImageView>( handle );
85 }
86
87 void ImageView::SetImage( Image image )
88 {
89   Dali::Toolkit::GetImpl( *this ).SetImage( image );
90 }
91
92 void ImageView::SetImage( const std::string& url )
93 {
94   Dali::Toolkit::GetImpl( *this ).SetImage( url, ImageDimensions() );
95 }
96
97 void ImageView::SetImage( const std::string& url, ImageDimensions size )
98 {
99   Dali::Toolkit::GetImpl( *this ).SetImage( url, size );
100 }
101
102 Image ImageView::GetImage() const
103 {
104   return Image();
105 }
106
107 ImageView::ImageView( Internal::ImageView& implementation )
108  : Control( implementation )
109 {
110 }
111
112 ImageView::ImageView( Dali::Internal::CustomActor* internal )
113  : Control( internal )
114 {
115   VerifyCustomActorPointer<Internal::ImageView>( internal );
116 }
117
118 } // namespace Toolkit
119
120 } // namespace Dali