-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
-#include <dali-toolkit/public-api/controls/buttons/button.h>
-using namespace Dali;
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/images/resource-image.h>
+#include <dali/public-api/object/property-map.h>
-namespace
-{
-const float DEFAULT_MINIMUM_DETAIL = 0.125f; ///< Default Minimum Detail level 12.5% of original size.
-const float DEFAULT_MAXIMUM_DETAIL = 1.0f; ///< Default Maximum Detail level 100% (original size)
-const float CAMERA_100_PCT_DISTANCE(1695.0f); ///< Based on Camera/Viewport/Projection settings at this distance object is 100% size.
-} // unnamed namespace
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
namespace Dali
{
namespace Toolkit
{
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// ImageView
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-const std::string ImageView::DETAIL_PROPERTY_NAME( "image-view-detail" );
-
ImageView::ImageView()
{
}
-ImageView::ImageView( const ImageView& handle )
-: Control( handle )
+ImageView::ImageView( const ImageView& imageView )
+: Control( imageView )
{
}
-ImageView& ImageView::operator=( const ImageView& handle )
+ImageView& ImageView::operator=( const ImageView& imageView )
{
- if( &handle != this )
+ if( &imageView != this )
{
- Control::operator=( handle );
+ Control::operator=( imageView );
}
return *this;
}
-ImageView::ImageView(Internal::ImageView& implementation)
-: Control(implementation)
+ImageView::~ImageView()
{
}
-ImageView::ImageView( Dali::Internal::CustomActor* internal )
-: Control( internal )
+ImageView ImageView::New()
{
- VerifyCustomActorPointer<Internal::ImageView>(internal);
+ return Internal::ImageView::New();
}
-ImageView ImageView::New()
+ImageView ImageView::New( Image image )
{
- return Internal::ImageView::New();
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: New() is deprecated and will be removed from next release. use New( const std::string& ) instead.\n" );
+
+ ImageView imageView = Internal::ImageView::New();
+ imageView.SetImage( image );
+ return imageView;
}
-ImageView ImageView::DownCast( BaseHandle handle )
+ImageView ImageView::New( const std::string& url )
{
- return Control::DownCast<ImageView, Internal::ImageView>( handle );
+ ImageView imageView = Internal::ImageView::New();
+ imageView.SetImage( url, ImageDimensions() );
+ return imageView;
}
-ImageView::~ImageView()
+ImageView ImageView::New( const std::string& url, ImageDimensions size )
+{
+ ImageView imageView = Internal::ImageView::New();
+ imageView.SetImage( url, size );
+ return imageView;
+}
+
+ImageView ImageView::DownCast( BaseHandle handle )
{
+ return Control::DownCast<ImageView, Internal::ImageView>( handle );
}
-void ImageView::SetImage(const std::string& filename, ImageType type)
+void ImageView::SetImage( Image image )
{
- GetImpl(*this).SetImage( filename, type, DEFAULT_MINIMUM_DETAIL, DEFAULT_MAXIMUM_DETAIL );
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetImage() is deprecated and will be removed from next release. Use SetImage( const std::string& ) instead.\n" );
+
+ Dali::Toolkit::GetImpl( *this ).SetImage( image );
}
-void ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
+void ImageView::SetImage( const std::string& url )
{
- GetImpl(*this).SetImage( filename, type, min, max );
+ Dali::Toolkit::GetImpl( *this ).SetImage( url, ImageDimensions() );
}
-void ImageView::SetImage(Image image)
+void ImageView::SetImage( const std::string& url, ImageDimensions size )
{
- GetImpl(*this).SetImage( image );
+ Dali::Toolkit::GetImpl( *this ).SetImage( url, size );
}
-void ImageView::SetCameraActor(CameraActor camera)
+Image ImageView::GetImage() const
{
- // TODO: Default detail factor should be calculated based on
- // current Camera's field of view/viewport/projection.
- // Ideal place would be inside the constraint, and have the Camera
- // settings as properties.
- GetImpl(*this).SetCameraActor( camera, CAMERA_100_PCT_DISTANCE );
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetImage() is deprecated and will be removed from next release.\n" );
+
+ return Dali::Toolkit::GetImpl( *this ).GetImage();
}
-void ImageView::SetCameraActor(CameraActor camera, float detailFactor)
+ImageView::ImageView( Internal::ImageView& implementation )
+ : Control( implementation )
{
- GetImpl(*this).SetCameraActor( camera, detailFactor );
}
-void ImageView::SetDetail(float detail)
+ImageView::ImageView( Dali::Internal::CustomActor* internal )
+ : Control( internal )
{
- GetImpl(*this).SetDetail( detail );
+ VerifyCustomActorPointer<Internal::ImageView>( internal );
}
} // namespace Toolkit