/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
-#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
using namespace Dali;
using namespace Toolkit;
* param[in] releasePolicy Which ReleasePolicy to use
* param[in] synchronousLoading If the Image should be loaded synchronously
* param[in] imageFilenameId Which image to load, referring to the array of filenames for this example.
+ * return An ImageView with the required set up
*/
- ImageView CreateImageView( bool correctionEnabled, DevelImageVisual::LoadPolicy::Type loadPolicy, DevelImageVisual::ReleasePolicy::Type releasePolicy, bool synchronousLoading, unsigned int imageFilenameId )
+ ImageView CreateImageView( bool correctionEnabled, ImageVisual::LoadPolicy::Type loadPolicy, ImageVisual::ReleasePolicy::Type releasePolicy, bool synchronousLoading, unsigned int imageFilenameId )
{
ImageView imageView = ImageView::New( );
Property::Map imagePropertyMap;
imagePropertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
imagePropertyMap.Insert( ImageVisual::Property::URL, IMAGE_PATH[imageFilenameId ] );
- imagePropertyMap.Insert( DevelImageVisual::Property::ORIENTATION_CORRECTION, correctionEnabled );
- imagePropertyMap.Insert( DevelImageVisual::Property::LOAD_POLICY, loadPolicy );
- imagePropertyMap.Insert( DevelImageVisual::Property::RELEASE_POLICY, releasePolicy );
+ imagePropertyMap.Insert( ImageVisual::Property::ORIENTATION_CORRECTION, correctionEnabled );
+ imagePropertyMap.Insert( ImageVisual::Property::LOAD_POLICY, loadPolicy );
+ imagePropertyMap.Insert( ImageVisual::Property::RELEASE_POLICY, releasePolicy );
if( synchronousLoading )
{
imagePropertyMap.Insert( DevelImageVisual::Property::SYNCHRONOUS_LOADING, true );
}
imageView.SetProperty(ImageView::Property::IMAGE , imagePropertyMap );
- imageView.SetParentOrigin( ParentOrigin::CENTER );
- imageView.SetAnchorPoint( AnchorPoint::CENTER );
+ imageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ imageView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
imageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
return imageView;
}
+
/**
* To prevent the next button being pressed before an Image has loaded the Button can br disabled.
* This function will disable the next button.
mInstructions.SetProperty( TextLabel::Property::TEXT, "Orientation Correction not applied");
mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
DisableButtonWhilstLoading();
- ImageView imageView01 = CreateImageView( false, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView01 = CreateImageView( false, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
mTable.AddChild( imageView01, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
mInstructions.SetProperty( TextLabel::Property::TEXT, "Orientation Correction applied based on Exif data, now shown in landscape");
mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
DisableButtonWhilstLoading();
- ImageView imageView01 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView01 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
mTable.AddChild( imageView01, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
}
mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
mInstructions.SetProperty( TextLabel::Property::TEXT, "Loading Image before staging, press next to see it in right column");
TableView dualImageViewTable = TableView::New( 1, 2 );
- dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
- dualImageViewTable.SetName("dualTable");
- dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ dualImageViewTable.SetProperty( Dali::Actor::Property::NAME,"dualTable");
+ dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
TextLabel attached = TextLabel::New("ATTACHED loaded image \nWill appear here");
dualImageViewTable.AddChild( immediate, TableView::CellPosition( 0, 1 ) );
mTable.AddChild( dualImageViewTable, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
- mPersistantImageView = CreateImageView( true, DevelImageVisual::LoadPolicy::IMMEDIATE, DevelImageVisual::ReleasePolicy::DESTROYED, false, 4 );
+ DisableButtonWhilstLoading();
+ mPersistantImageView = CreateImageView( true, ImageVisual::LoadPolicy::IMMEDIATE, ImageVisual::ReleasePolicy::DESTROYED, false, 4 );
+ mPersistantImageView.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
}
/**
mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
TableView dualImageViewTable = TableView::New( 2, 2 );
- dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
- dualImageViewTable.SetName("dualTable");
- dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ dualImageViewTable.SetProperty( Dali::Actor::Property::NAME,"dualTable");
+ dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
mTable.AddChild( dualImageViewTable, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
- ImageView imageView02 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView02 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView02.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
dualImageViewTable.AddChild( imageView02, TableView::CellPosition( 0, 0 ) );
dualImageViewTable.AddChild( mPersistantImageView, TableView::CellPosition( 0, 1 ) );
mInstructions.SetProperty( TextLabel::Property::TEXT, "ReleasePolicy::DESTROYED shown in first column, press next to destroy it.");
DisableButtonWhilstLoading();
TableView dualImageViewTable = TableView::New( 1, 2 );
- dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
- dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
mTable.AddChild( dualImageViewTable, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
- ImageView imageView01 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView01 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
dualImageViewTable.AddChild( imageView01, TableView::CellPosition( 0, 0 ) );
mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
DisableButtonWhilstLoading();
TableView dualImageViewTable = TableView::New( 1, 2 );
- dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
- dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
mTable.AddChild( dualImageViewTable, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
- ImageView imageView01 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView01 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
dualImageViewTable.AddChild( imageView01, TableView::CellPosition( 0, 1 ) );
mInstructions.SetProperty( TextLabel::Property::TEXT, "Image with ReleasePolicy::DESTROYED shown in first column, Image will be detached, reusing it will be fast");
DisableButtonWhilstLoading();
TableView dualImageViewTable = TableView::New( 1, 2 );
- dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
- dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
mTable.AddChild( dualImageViewTable, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
- ImageView imageView01 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView01 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
dualImageViewTable.AddChild( imageView01, TableView::CellPosition( 0, 0 ) );
ImageView imageViewDetached = ImageView::DownCast( dualImageViewTable.GetChildAt( TableView::CellPosition( 0, 0 ) ) );
dualImageViewTable.RemoveChildAt( TableView::CellPosition( 0, 0 ) );
- ImageView imageView01 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView01 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
dualImageViewTable.AddChild( imageView01, TableView::CellPosition( 0, 1 ) );
mInstructions.SetProperty( TextLabel::Property::TEXT, "Image with ReleasePolicy::DETACHED shown in first column, will be detached and reloaded");
DisableButtonWhilstLoading();
TableView dualImageViewTable = TableView::New( 1, 2 );
- dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
- dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
mTable.AddChild( dualImageViewTable, TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
- ImageView imageView01 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DETACHED, false, 3 );
+ ImageView imageView01 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DETACHED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
dualImageViewTable.AddChild( imageView01, TableView::CellPosition( 0, 0 ) );
ImageView imageViewDetached = ImageView::DownCast( dualImageViewTable.GetChildAt( TableView::CellPosition( 0, 0 ) ) );
dualImageViewTable.RemoveChildAt( TableView::CellPosition( 0, 0 ) );
- ImageView imageView01 = CreateImageView( true, DevelImageVisual::LoadPolicy::ATTACHED, DevelImageVisual::ReleasePolicy::DESTROYED, false, 3 );
+ ImageView imageView01 = CreateImageView( true, ImageVisual::LoadPolicy::ATTACHED, ImageVisual::ReleasePolicy::DESTROYED, false, 3 );
imageView01.ResourceReadySignal().Connect( this, &ImagePolicies::ResourceReadySignal );
dualImageViewTable.AddChild( imageView01, TableView::CellPosition( 0, 1 ) );
// Create default View.
Toolkit::Control view = Toolkit::Control::New();
- view.SetAnchorPoint( Dali::AnchorPoint::CENTER );
- view.SetParentOrigin( Dali::ParentOrigin::CENTER );
+ view.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, Dali::ParentOrigin::CENTER );
view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
view.SetProperty( Toolkit::Control::Property::BACKGROUND , gradientBackground );
stage.Add( view );
// Create a table view to show a pair of buttons above each image.
mTable = TableView::New( TableRowPlacement::NUMBER_OF_ROWS, 1 );
- mTable.SetAnchorPoint( AnchorPoint::CENTER );
- mTable.SetParentOrigin( ParentOrigin::CENTER );
+ mTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mTable.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
Vector3 offset( 0.9f, 0.90f, 0.0f );
- mTable.SetSizeModeFactor( offset );
+ mTable.SetProperty( Actor::Property::SIZE_MODE_FACTOR, offset );
mTable.SetFitHeight( TableRowPlacement::NEXT_BUTTON );
mTable.SetFitHeight( TableRowPlacement::LOADING_STATUS );
view.Add( mTable );
Property::Map imagePropertyMap;
imagePropertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
imagePropertyMap.Insert( ImageVisual::Property::URL, NEXT_BUTTON_IMAGE );
- mNextButton.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, imagePropertyMap );
+ mNextButton.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, imagePropertyMap );
imagePropertyMap.Clear();
imagePropertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
imagePropertyMap.Insert( ImageVisual::Property::URL, NEXT_BUTTON_PRESSED_IMAGE );
- mNextButton.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, imagePropertyMap );
- mNextButton.SetProperty( DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, LOADING_IMAGE );
- mNextButton.SetProperty( DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, NEXT_BUTTON_DISABLED_IMAGE );
- mNextButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
- mNextButton.SetY( -50.0f );
- mNextButton.SetSize( 100.0f, 100.0f );
+ mNextButton.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, imagePropertyMap );
+ mNextButton.SetProperty( Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, LOADING_IMAGE );
+ mNextButton.SetProperty( Button::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, NEXT_BUTTON_DISABLED_IMAGE );
+ mNextButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
+ mNextButton.SetProperty( Actor::Property::POSITION_Y, -50.0f );
+ mNextButton.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
mNextButton.ClickedSignal().Connect( this, &ImagePolicies::ChangeImageClicked );
mTable.AddChild( mNextButton, TableView::CellPosition( TableRowPlacement::NEXT_BUTTON, 0 ) );
mTable.SetCellPadding( Vector2( 2.0f, 2.0f ) );
{
ReleasePolicyDestroyedExample06();
// Change Next button to complete button ( will quit app once pressed )
- button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
- button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
+ button.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
+ button.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
break;
}
default: