/*
- * 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.
// Create a control which will be used for the background and to clip the contents
mContactCard = Control::New();
mContactCard.SetProperty( Control::Property::BACKGROUND,
- Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
- .Add( ColorVisual::Property::MIX_COLOR, Color::WHITE ) );
+ Property::Map{ { Toolkit::Visual::Property::TYPE, Visual::COLOR },
+ { ColorVisual::Property::MIX_COLOR, Color::WHITE } } );
mContactCard.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
mContactCard.SetParentOrigin( ParentOrigin::TOP_LEFT );
mContactCard.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mHeader = Control::New();
mHeader.SetSize( mContactCardLayoutInfo.headerSize );
mHeader.SetProperty( Control::Property::BACKGROUND,
- Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
- .Add( ColorVisual::Property::MIX_COLOR, HEADER_COLOR ) );
+ Property::Map{ { Toolkit::Visual::Property::TYPE, Visual::COLOR },
+ { ColorVisual::Property::MIX_COLOR, HEADER_COLOR } } );
mHeader.SetParentOrigin( ParentOrigin::TOP_LEFT );
mHeader.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mHeader.SetPosition( mContactCardLayoutInfo.headerFoldedPosition.x, mContactCardLayoutInfo.headerFoldedPosition.y );
/*
- * 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.
Control maskedImage = ImageView::New();
maskedImage.SetProperty(
Toolkit::ImageView::Property::IMAGE,
- Property::Map().Add( Visual::Property::TYPE, Toolkit::Visual::Type::IMAGE )
- .Add( ImageVisual::Property::URL, imagePath )
- .Add( ImageVisual::Property::ALPHA_MASK_URL, IMAGE_MASK )
+ Property::Map{ { Visual::Property::TYPE, Toolkit::Visual::Type::IMAGE },
+ { ImageVisual::Property::URL, imagePath },
+ { ImageVisual::Property::ALPHA_MASK_URL, IMAGE_MASK } }
);
return maskedImage;
}
/*
- * 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.
Toolkit::ToggleButton effectChangeToggleButton = Toolkit::ToggleButton::ToggleButton::New();
effectChangeToggleButton.SetProperty( Toolkit::ToggleButton::Property::STATE_VISUALS,
- Property::Array().Add( EFFECT_WAVE_IMAGE )
- .Add( EFFECT_CROSS_IMAGE)
- .Add( EFFECT_FOLD_IMAGE )
+ Property::Array{ EFFECT_WAVE_IMAGE,
+ EFFECT_CROSS_IMAGE,
+ EFFECT_FOLD_IMAGE }
);
effectChangeToggleButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
namespace
{
-const Vector4 BACKGROUND_GRADIENT_1 = Vector4( 167.0f, 207.0f, 223.0f, 255.0f ) / 255.0f;
-const Vector4 BACKGROUND_GRADIENT_2 = Vector4( 0.0f, 64.0f, 137.0f, 255.0f ) / 255.0f;
-const Vector2 BACKGROUND_GRADIENT_START_POSITION( 0.0f, -0.5f );
-const Vector2 BACKGROUND_GRADIENT_END_POSITION( 0.0f, 0.5f );
+const Property::Value BACKGROUND
+{
+ { Toolkit::Visual::Property::TYPE, Visual::GRADIENT },
+ { GradientVisual::Property::STOP_COLOR, Property::Array{ Vector4( 167.0f, 207.0f, 223.0f, 255.0f ) / 255.0f,
+ Vector4( 0.0f, 64.0f, 137.0f, 255.0f ) / 255.0f } },
+ { GradientVisual::Property::START_POSITION, Vector2( 0.0f, -0.5f ) },
+ { GradientVisual::Property::END_POSITION, Vector2( 0.0f, 0.5f ) }
+};
-const Vector4 CONTROL_GRADIENT_1 = Vector4( 234.0f, 185.0f, 45.0f, 255.0f ) / 255.0f;
-const Vector4 CONTROL_GRADIENT_2 = Vector4( 199.0f, 152.0f, 16.0f, 255.0f ) / 255.0f;
-const Vector2 CONTROL_GRADIENT_CENTER( Vector2::ZERO );
-const float CONTROL_GRADIENT_RADIUS( 0.5f );
+const Property::Value CONTROL_BACKGROUND
+{
+ { Toolkit::Visual::Property::TYPE, Visual::GRADIENT },
+ { GradientVisual::Property::STOP_COLOR, Property::Array{ Vector4( 234.0f, 185.0f, 45.0f, 255.0f ) / 255.0f,
+ Vector4( 199.0f, 152.0f, 16.0f, 255.0f ) / 255.0f } },
+ { GradientVisual::Property::CENTER, Vector2::ZERO },
+ { GradientVisual::Property::RADIUS, 0.5f }
+};
const float HELP_ANIMATION_DURATION( 25.0f );
const float HELP_ANIMATION_SEGMENT_TIME( 5.0f );
const float SCALE_BACK_ANIMATION_DURATION( 0.25f );
/**
- * @brief Creates a background with a linear gradient which matches parent size & is placed in the center.
- */
-Actor CreateBackground()
-{
- Actor background = Control::New();
- background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- background.SetParentOrigin( ParentOrigin::CENTER );
- background.SetProperty(
- Control::Property::BACKGROUND,
- Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT )
- .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( BACKGROUND_GRADIENT_1 )
- .Add( BACKGROUND_GRADIENT_2 ) )
- .Add( GradientVisual::Property::START_POSITION, BACKGROUND_GRADIENT_START_POSITION )
- .Add( GradientVisual::Property::END_POSITION, BACKGROUND_GRADIENT_END_POSITION ) );
- return background;
-}
-
-/**
- * @brief Create a control with a circular gradient & a specific size & is placed in the center of its parent.
- *
- * @param[in] size The size we want the control to be.
- */
-Actor CreateTouchControl( const Vector2& size )
-{
- Actor touchControl = Control::New();
- touchControl.SetSize( size );
- touchControl.SetParentOrigin( ParentOrigin::CENTER );
- touchControl.SetProperty(
- Control::Property::BACKGROUND,
- Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT )
- .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( CONTROL_GRADIENT_1 )
- .Add( CONTROL_GRADIENT_2 ) )
- .Add( GradientVisual::Property::CENTER, CONTROL_GRADIENT_CENTER )
- .Add( GradientVisual::Property::RADIUS, CONTROL_GRADIENT_RADIUS )
- );
- return touchControl;
-}
-
-/**
* @brief Shows the given string between the given start and end times.
*
* Appropriately animates the string into and out of the scene.
Stage stage = Stage::GetCurrent();
stage.KeyEventSignal().Connect(this, &GestureExample::OnKeyEvent);
- // Create a background with a gradient
- Actor background = CreateBackground();
+ // Create a background with a linear gradient which matches parent size & is placed in the center.
+ Actor background = Control::New();
+ background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ background.SetParentOrigin( ParentOrigin::CENTER );
+ background.SetProperty( Control::Property::BACKGROUND, BACKGROUND );
stage.Add( background );
- // Create a control that we'll use for the gestures to be a quarter of the size of the stage
- Actor touchControl = CreateTouchControl( stage.GetSize() * 0.25f );
+ // Create a control with a circular gradient that we'll use for the gestures and be a quarter of the size of the stage.
+ Actor touchControl = Control::New();
+ touchControl.SetSize( stage.GetSize() * 0.25f );
+ touchControl.SetParentOrigin( ParentOrigin::CENTER );
+ touchControl.SetProperty( Control::Property::BACKGROUND, CONTROL_BACKGROUND );
background.Add( touchControl );
// Connect to the touch signal
namespace
{
-const Vector4 BACKGROUND_GRADIENT_1 = Vector4( 0.0f, 0.352941176f, 0.654901961f, 1.0f );
-const Vector4 BACKGROUND_GRADIENT_2 = Vector4( 1.0f, 0.992156863f, 0.894117647f, 1.0f );
-const Vector2 BACKGROUND_GRADIENT_START_POSITION( 0.0f, -0.5f );
-const Vector2 BACKGROUND_GRADIENT_END_POSITION( 0.0f, 0.5f );
+const Property::Value BACKGROUND
+{
+ { Toolkit::Visual::Property::TYPE, Visual::GRADIENT },
+ { GradientVisual::Property::STOP_COLOR, Property::Array{ Vector4( 0.0f, 0.352941176f, 0.654901961f, 1.0f ),
+ Vector4( 1.0f, 0.992156863f, 0.894117647f, 1.0f ) } },
+ { GradientVisual::Property::START_POSITION, Vector2( 0.0f, -0.5f ) },
+ { GradientVisual::Property::END_POSITION, Vector2( 0.0f, 0.5f ) }
+};
const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
auto bg = Control::New();
bg.SetParentOrigin( ParentOrigin::CENTER );
bg.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- bg.SetProperty(
- Control::Property::BACKGROUND,
- Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT )
- .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( BACKGROUND_GRADIENT_1 )
- .Add( BACKGROUND_GRADIENT_2 ) )
- .Add( GradientVisual::Property::START_POSITION, BACKGROUND_GRADIENT_START_POSITION )
- .Add( GradientVisual::Property::END_POSITION, BACKGROUND_GRADIENT_END_POSITION ) );
+ bg.SetProperty( Control::Property::BACKGROUND, BACKGROUND );
stage.Add( bg );
auto toolbar = ImageView::New( TOOLBAR_IMAGE );
toolbar.SetParentOrigin( ParentOrigin::TOP_CENTER );
/*
- * 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.
SetLabel( customFromCode, "Custom From Code" );
Layout( customFromCode, stageSize );
customFromCode.SetProperty( DevelControl::Property::TOOLTIP,
- Property::Map().Add( Tooltip::Property::CONTENT,
- Property::Array().Add( Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::IMAGE )
- .Add( ImageVisual::Property::URL, DEMO_IMAGE_DIR "Logo-for-demo.png" ) )
- .Add( Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::TEXT )
- .Add( TextVisual::Property::TEXT_COLOR, Color::WHITE )
- .Add( TextVisual::Property::TEXT, "Custom coded style\nat hover point" )
- .Add( TextVisual::Property::MULTI_LINE, true )
- .Add( TextVisual::Property::HORIZONTAL_ALIGNMENT, "CENTER" )
- .Add( TextVisual::Property::POINT_SIZE, 16 ) ) )
- .Add( Tooltip::Property::LAYOUT, Vector2( 2, 1 ) )
- .Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
- .Add( Tooltip::Property::BACKGROUND,
- Property::Map().Add( Tooltip::Background::Property::VISUAL, DEMO_IMAGE_DIR "tooltip.9.png" )
- .Add( Tooltip::Background::Property::BORDER, Rect< int >( 1, 5, 5, 1 ) ) )
- );
+ { { Tooltip::Property::CONTENT,
+ Property::Array{ { { { Toolkit::Visual::Property::TYPE, Visual::IMAGE },
+ { ImageVisual::Property::URL, DEMO_IMAGE_DIR "Logo-for-demo.png" } } },
+ { { { Toolkit::Visual::Property::TYPE, Visual::TEXT },
+ { TextVisual::Property::TEXT_COLOR, Color::WHITE },
+ { TextVisual::Property::TEXT, "Custom coded style\nat hover point" },
+ { TextVisual::Property::MULTI_LINE, true },
+ { TextVisual::Property::HORIZONTAL_ALIGNMENT, "CENTER" },
+ { TextVisual::Property::POINT_SIZE, 16 } } } } },
+ { Tooltip::Property::LAYOUT, Vector2( 2, 1 ) },
+ { Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT },
+ { Tooltip::Property::BACKGROUND,
+ { { Tooltip::Background::Property::VISUAL, DEMO_IMAGE_DIR "tooltip.9.png" },
+ { Tooltip::Background::Property::BORDER, Rect< int >( 1, 5, 5, 1 ) } } }
+ } );
stage.Add( customFromCode );
}