/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
float value;
};
-const float STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE = 0.9f;
-const float BUTTON_SIZE_RATIO_TO_STAGE = 0.1f;
+const float STYLE_BUTTON_POSTION_RELATIVE_TO_WINDOW = 0.9f;
+const float BUTTON_SIZE_RATIO_TO_WINDOW = 0.1f;
const float OUTLINE_WIDTH = 2.0f;
const Vector2 SHADOW_OFFSET = Vector2( 2.0f, 2.0f );
const int GAP_BETWEEN_BUTTONS = 3;
void SetUpExpandingStyleButtons( Vector2 position )
{
mExpandingButtons = Demo::ExpandingButtons::New();
- mExpandingButtons.SetProperty( Actor::Property::POSITION, Vector2( mButtonSize.width, mStageSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE ));
+ mExpandingButtons.SetProperty( Actor::Property::POSITION, Vector2( mButtonSize.width, mWindowSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_WINDOW ));
mExpandingButtons.CollapsingSignal().Connect( this, &TextLabelExample::OnExpandingButtonCollapsing );
mExpandingButtons.SetProperty( Actor::Property::SIZE, mButtonSize );
// Creates the buttons to be expanded
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
- mStageSize = stage.GetSize();
- mButtonSize = Size( mStageSize.height * 0.1, mStageSize.height * 0.1 ); // Button size 1/10 of stage height
+ window.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
+ mWindowSize = window.GetSize();
+ mButtonSize = Size( mWindowSize.height * 0.1, mWindowSize.height * 0.1 ); // Button size 1/10 of window height
mContainer = Control::New();
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);
+ mLayoutSize = Vector2(mWindowSize.width*0.6f, mWindowSize.width*0.6f);
mContainer.SetProperty( Actor::Property::SIZE, mLayoutSize );
- stage.Add( mContainer );
+ window.Add( mContainer );
// Resize the center layout when the corner is grabbed
mGrabCorner = ImageView::New( BACKGROUND_IMAGE );
mContainer.Add( mLabel );
// Clicking ExpandingButton shows the Registered Style buttons, clicking again hides them.
- Vector2 expandingButtonPosition( mButtonSize.width, mStageSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE );
+ Vector2 expandingButtonPosition( mButtonSize.width, mWindowSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_WINDOW );
SetUpExpandingStyleButtons( expandingButtonPosition );
- stage.Add( mExpandingButtons );
+ window.Add( mExpandingButtons );
// Add a border for the container so you can see the container is being resized while grabbing the handle.
mBorder = Control::New();
mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f );
Renderer bgRenderer = mLabel.GetRendererAt(0);
- mOverrideMixColorIndex = DevelHandle::GetPropertyIndex( bgRenderer, ColorVisual::Property::MIX_COLOR );
+ mOverrideMixColorIndex = bgRenderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
Constraint constraint = Constraint::New<Vector3>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f));
constraint.AddSource( Source( mLabel, mHueAngleIndex ) );
- constraint.SetRemoveAction( Constraint::Discard );
+ constraint.SetRemoveAction( Constraint::DISCARD );
constraint.Apply();
Animation anim = Animation::New(50.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].SetProperty( DevelActor::Property::OPACITY,0.5f);
+ mColorButtons[index].SetProperty( Actor::Property::OPACITY,0.5f);
mColorButtons[index].SetProperty( Toolkit::Button::Property::LABEL,
Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::TEXT )
void OnPan( Actor actor, const PanGesture& gesture )
{
// Reset mLayoutSize when the pan starts
- if( gesture.state == Gesture::Started )
+ GestureState state = gesture.GetState();
+ if( state == GestureState::STARTED )
{
if( mLayoutSize.x < 2.0f )
{
HideStyleAndColorButtons();
}
- mLayoutSize.x += gesture.displacement.x * 2.0f;
- mLayoutSize.y += gesture.displacement.y * 2.0f;
+ const Vector2& displacement = gesture.GetDisplacement();
+ mLayoutSize.x += displacement.x * 2.0f;
+ mLayoutSize.y += displacement.y * 2.0f;
if( mLayoutSize.x >= 2.0f ||
mLayoutSize.y >= 2.0f )
{
- mLayoutSize.x = std::min ( mLayoutSize.x, mStageSize.width );
- mLayoutSize.y = std::min ( mLayoutSize.y, mStageSize.height*.9f );
+ mLayoutSize.x = std::min ( mLayoutSize.x, mWindowSize.width );
+ mLayoutSize.y = std::min ( mLayoutSize.y, mWindowSize.height*.9f );
// Avoid pixel mis-alignment issue
Vector2 clampedSize = Vector2( std::max( ConvertToEven( static_cast<int>( mLayoutSize.x )), 2 ),
mContainer.SetProperty( Actor::Property::SIZE, clampedSize );
}
- if( gesture.state == Gesture::Cancelled || gesture.state == Gesture::Finished )
+ if( state == GestureState::CANCELLED || state == GestureState::FINISHED )
{
// Resize the text label to match the container size when panning is finished
mLabel.SetProperty( Actor::Property::SIZE, mLayoutSize );
*/
void OnKeyEvent(const KeyEvent& event)
{
- if(event.state == KeyEvent::Down)
+ if(event.GetState() == KeyEvent::DOWN)
{
if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
{
}
else if( event.IsCtrlModifier() )
{
- switch( event.keyCode )
+ switch( event.GetKeyCode() )
{
// Select rendering back-end
case KEY_ZERO: // fall through
case KEY_ONE:
{
- mLabel.SetProperty( TextLabel::Property::RENDERING_BACKEND, event.keyCode - 10 );
+ mLabel.SetProperty( DevelTextLabel::Property::RENDERING_BACKEND, event.GetKeyCode() - 10 );
break;
}
case KEY_A: // Animate text colour
Animation mColorButtonsAnimation;
- Size mStageSize;
+ Size mWindowSize;
Size mButtonSize;
unsigned int mLanguageId;