/*
- * Copyright (c) 2018 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.
// EXTERNAL INCLUDES
#include <dali/devel-api/object/handle-devel.h>
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
#include <dali-toolkit/dali-toolkit.h>
void SetUpExpandingStyleButtons( Vector2 position )
{
mExpandingButtons = Demo::ExpandingButtons::New();
- mExpandingButtons.SetPosition( mButtonSize.width, mStageSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE );
+ mExpandingButtons.SetProperty( Actor::Property::POSITION, Vector2( mButtonSize.width, mStageSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE ));
mExpandingButtons.CollapsingSignal().Connect( this, &TextLabelExample::OnExpandingButtonCollapsing );
- mExpandingButtons.SetSize( mButtonSize );
+ mExpandingButtons.SetProperty( Actor::Property::SIZE, mButtonSize );
// Creates the buttons to be expanded
CreateStyleButtons();
mButtonSize = Size( mStageSize.height * 0.1, mStageSize.height * 0.1 ); // Button size 1/10 of stage height
mContainer = Control::New();
- mContainer.SetName( "Container" );
- mContainer.SetParentOrigin( ParentOrigin::CENTER );
+ mContainer.SetProperty( Dali::Actor::Property::NAME, "Container" );
+ mContainer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mLayoutSize = Vector2(mStageSize.width*0.6f, mStageSize.width*0.6f);
- mContainer.SetSize( mLayoutSize );
+ mContainer.SetProperty( Actor::Property::SIZE, mLayoutSize );
stage.Add( mContainer );
// Resize the center layout when the corner is grabbed
mGrabCorner = ImageView::New( BACKGROUND_IMAGE );
- mGrabCorner.SetName( "GrabCorner" );
- mGrabCorner.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
+ mGrabCorner.SetProperty( Dali::Actor::Property::NAME, "GrabCorner" );
+ mGrabCorner.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
+ mGrabCorner.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT );
mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mContainer.Add( mGrabCorner );
mLabel = TextLabel::New( "\xF0\x9F\x98\x89 A Quick Brown Fox Jumps Over The Lazy Dog" );
- mLabel.SetName( "TextLabel" );
- mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mLabel.SetSize(mLayoutSize);
+ mLabel.SetProperty( Dali::Actor::Property::NAME, "TextLabel" );
+ mLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ mLabel.SetProperty( Actor::Property::SIZE, mLayoutSize );
mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN );
mLabel.SetBackgroundColor( Color::WHITE );
// Add a border for the container so you can see the container is being resized while grabbing the handle.
mBorder = Control::New();
- mBorder.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mBorder.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
mBorder.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
mBorder.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
border.Insert( BorderVisual::Property::SIZE, 3.f );
mBorder.SetProperty( Control::Property::BACKGROUND, border );
mContainer.Add( mBorder );
- mBorder.SetVisible(false);
+ mBorder.SetProperty( Actor::Property::VISIBLE,false);
mGrabCorner.RaiseToTop();
mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f );
{
if ( mColorButtons[i] )
{
- mColorButtons[ i ].SetProperty( Toolkit::DevelButton::Property::SELECTED, true );
+ mColorButtons[ i ].SetProperty( Toolkit::Button::Property::SELECTED, true );
}
break;
}
if ( ! mColorButtons[index] )
{
mColorButtons[index] = RadioButton::New();
- mColorButtons[index].SetSize( mButtonSize );
+ mColorButtons[index].SetProperty( Actor::Property::SIZE, mButtonSize );
mColorButtons[index].ClickedSignal().Connect( this, &TextLabelExample::OnColorSelected );
mColorButtons[index].SetProperty( Button::Property::TOGGLABLE, true );
Property::Map propertyMap;
propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, AVAILABLE_COLORS[ index ]);
- mColorButtons[index].SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, propertyMap );
- mColorButtons[index].SetProperty( Toolkit::DevelButton::Property::UNSELECTED_VISUAL, propertyMap );
+ mColorButtons[index].SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, propertyMap );
+ mColorButtons[index].SetProperty( Toolkit::Button::Property::UNSELECTED_VISUAL, propertyMap );
mColorButtons[index].SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
mColorButtons[index].SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, AVAILABLE_COLORS[ index ]);
- mColorButtons[index].SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, propertyMap );
+ mColorButtons[index].SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, propertyMap );
- mColorButtons[index].SetProperty( Toolkit::DevelButton::Property::SELECTED_VISUAL,
+ mColorButtons[index].SetProperty( Toolkit::Button::Property::SELECTED_VISUAL,
Property::Map().Add( Visual::Property::TYPE, Visual::BORDER )
.Add( BorderVisual::Property::COLOR, Color::WHITE )
.Add( BorderVisual::Property::SIZE, 4.0f )
// Use a white button with 50% transparency as a clear color button
if ( Color::WHITE == AVAILABLE_COLORS[ index ] && styleButtonIndex != StyleType::TEXT_COLOR )
{
- mColorButtons[index].SetOpacity(0.5f);
+ mColorButtons[index].SetProperty( DevelActor::Property::OPACITY,0.5f);
mColorButtons[index].SetProperty( Toolkit::Button::Property::LABEL,
Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::TEXT )
mColorButtons[index].Lower();
// Position button using nice animation
- mColorButtons[index].SetY( -GAP_BETWEEN_BUTTONS );
+ mColorButtons[index].SetProperty( Actor::Property::POSITION_Y, -GAP_BETWEEN_BUTTONS );
float desiredPosition = -( mButtonSize.height + GAP_BETWEEN_BUTTONS ) * (index);
AlphaFunction focusedAlphaFunction = AlphaFunction( Vector2 ( 0.32f, 0.08f ), Vector2( 0.38f, 1.72f ) );
mColorButtonsAnimation.AnimateBy( Property( mColorButtons[index], Actor::Property::POSITION_Y ), desiredPosition, focusedAlphaFunction );
if ( ! mStyleButtons[index] )
{
mStyleButtons[index] = PushButton::New();
- mStyleButtons[index].SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_IMAGES[ index ] );
- mStyleButtons[index].SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STYLE_SELECTED_IMAGE );
+ mStyleButtons[index].SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_IMAGES[ index ] );
+ mStyleButtons[index].SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, STYLE_SELECTED_IMAGE );
mStyleButtons[index].SetProperty( Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- mStyleButtons[index].SetSize( mButtonSize );
+ mStyleButtons[index].SetProperty( Actor::Property::SIZE, mButtonSize );
mStyleButtons[index].ClickedSignal().Connect( this, &TextLabelExample::OnStyleButtonClicked );
}
}
}
// Only show the border during the panning
- mBorder.SetVisible(true);
+ mBorder.SetProperty( Actor::Property::VISIBLE,true);
HideStyleAndColorButtons();
}
Vector2 clampedSize = Vector2( std::max( ConvertToEven( static_cast<int>( mLayoutSize.x )), 2 ),
std::max( ConvertToEven( static_cast<int>( mLayoutSize.y )), 2 ) );
- mContainer.SetSize( clampedSize );
+ mContainer.SetProperty( Actor::Property::SIZE, clampedSize );
}
if( gesture.state == Gesture::Cancelled || gesture.state == Gesture::Finished )
{
// Resize the text label to match the container size when panning is finished
- mLabel.SetSize(mLayoutSize);
- mBorder.SetVisible(false);
+ mLabel.SetProperty( Actor::Property::SIZE, mLayoutSize );
+ mBorder.SetProperty( Actor::Property::VISIBLE,false);
}
}