// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
namespace Dali
{
}
mVisual = Toolkit::VisualFactory::Get().CreateVisual( url, size );
- RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual );
-
- mVisual.SetSize( mSizeSet );
+ RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual );
RelayoutRequest();
}
}
}
-
-///////////////////////////////////////////////////////////
-//
-// Private methods
-//
-
-void ImageView::OnSizeSet( const Vector3& targetSize )
+void ImageView::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
- Control::OnSizeSet( targetSize );
- mSizeSet = targetSize;
+ Control::OnRelayout( size, container );
if( mVisual )
{
- Vector2 size( targetSize );
- mVisual.SetSize( size );
+ // Pass in an empty map which uses default transform values meaning our visual fills the control
+ // Should provide a transform that handles aspect ratio according to image size
+ mVisual.SetTransformAndSize( Property::Map(), size );
}
}
case Toolkit::ImageView::Property::IMAGE:
{
std::string imageUrl;
- Property::Map map;
+ Property::Map* map;
if( value.Get( imageUrl ) )
{
impl.SetImage( imageUrl, ImageDimensions() );
}
// if its not a string then get a Property::Map from the property if possible.
- else if( value.Get( map ) )
+ else
{
- Property::Value* shaderValue = map.Find( Toolkit::VisualProperty::SHADER, CUSTOM_SHADER );
- // set image only if property map contains image information other than custom shader
- if( map.Count() > 1u || !shaderValue )
- {
- impl.SetImage( map );
- }
- // the property map contains only the custom shader
- else if( impl.mVisual && map.Count() == 1u && shaderValue )
+ map = value.GetMap();
+ if( map )
{
- Property::Map shaderMap;
- if( shaderValue->Get( shaderMap ) )
+ Property::Value* shaderValue = map->Find( Toolkit::DevelVisual::Property::SHADER, CUSTOM_SHADER );
+ // set image only if property map contains image information other than custom shader
+ if( map->Count() > 1u || !shaderValue )
+ {
+ impl.SetImage( *map );
+ }
+ // the property map contains only the custom shader
+ else if( ( impl.mVisual )&&( map->Count() == 1u )&&( shaderValue ) )
{
- Internal::Visual::Base& visual = Toolkit::GetImplementation( impl.mVisual );
- visual.SetCustomShader( shaderMap );
- if( imageView.OnStage() )
+ Property::Map* shaderMap = shaderValue->GetMap();
+ if( shaderMap )
{
- // force to create new core renderer to use the newly set shader
- visual.SetOffStage( imageView );
- visual.SetOnStage( imageView );
+ Internal::Visual::Base& visual = Toolkit::GetImplementation( impl.mVisual );
+ visual.SetCustomShader( *shaderMap );
+ if( imageView.OnStage() )
+ {
+ // force to create new core renderer to use the newly set shader
+ visual.SetOffStage( imageView );
+ visual.SetOnStage( imageView );
+ }
}
}
}