-//
-// 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) 2020 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/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 ) = default;
-ImageView& ImageView::operator=( const ImageView& handle )
-{
- if( &handle != this )
- {
- Control::operator=( handle );
- }
- return *this;
-}
+ImageView::ImageView( ImageView&& rhs ) = default;
-ImageView::ImageView(Internal::ImageView& implementation)
-: Control(implementation)
-{
-}
+ImageView& ImageView::operator=( const ImageView& imageView ) = default;
-ImageView::ImageView( Dali::Internal::CustomActor* internal )
-: Control( internal )
+ImageView& ImageView::operator=( ImageView&& rhs ) = default;
+
+ImageView::~ImageView()
{
- VerifyCustomActorPointer<Internal::ImageView>(internal);
}
ImageView ImageView::New()
return Internal::ImageView::New();
}
-ImageView ImageView::DownCast( BaseHandle handle )
-{
- return Control::DownCast<ImageView, Internal::ImageView>( handle );
-}
-
-ImageView::~ImageView()
+ImageView ImageView::New( const std::string& url )
{
+ ImageView imageView = Internal::ImageView::New();
+ imageView.SetImage( url, ImageDimensions() );
+ return imageView;
}
-void ImageView::SetImage(const std::string& filename, ImageType type)
+ImageView ImageView::New( const std::string& url, ImageDimensions size )
{
- GetImpl(*this).SetImage( filename, type, DEFAULT_MINIMUM_DETAIL, DEFAULT_MAXIMUM_DETAIL );
+ ImageView imageView = Internal::ImageView::New();
+ imageView.SetImage( url, size );
+ return imageView;
}
-void ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
+ImageView ImageView::DownCast( BaseHandle handle )
{
- GetImpl(*this).SetImage( filename, type, min, max );
+ return Control::DownCast<ImageView, Internal::ImageView>( handle );
}
-void ImageView::SetImage(Image image)
+void ImageView::SetImage( const std::string& url )
{
- GetImpl(*this).SetImage( image );
+ Dali::Toolkit::GetImpl( *this ).SetImage( url, ImageDimensions() );
}
-void ImageView::SetCameraActor(CameraActor camera)
+void ImageView::SetImage( const std::string& url, ImageDimensions size )
{
- // 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::Toolkit::GetImpl( *this ).SetImage( url, size );
}
-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