Commit 7c0f7319c39be07c459ca0d24d9bc9e9ac86386e

Authored by Adeel Kazmi
Committed by Gerrit Code Review
2 parents efc4e3be 495f20af

Merge "(Layouting) Use gradient instead for background & fix change layout butto…

…n on target" into devel/master
examples/layouting/layouting-examples.cpp
1 /* 1 /*
2 - * Copyright (c) 2018 Samsung Electronics Co., Ltd. 2 + * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
@@ -37,8 +37,11 @@ using namespace Dali::Toolkit; @@ -37,8 +37,11 @@ using namespace Dali::Toolkit;
37 37
38 namespace 38 namespace
39 { 39 {
  40 +const Vector4 BACKGROUND_GRADIENT_1 = Vector4( 0.0f, 0.352941176f, 0.654901961f, 1.0f );
  41 +const Vector4 BACKGROUND_GRADIENT_2 = Vector4( 1.0f, 0.992156863f, 0.894117647f, 1.0f );
  42 +const Vector2 BACKGROUND_GRADIENT_START_POSITION( 0.0f, -0.5f );
  43 +const Vector2 BACKGROUND_GRADIENT_END_POSITION( 0.0f, 0.5f );
40 44
41 -const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "lake_front.jpg" );  
42 const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); 45 const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
43 46
44 typedef std::unique_ptr< Demo::Example > ExamplePointer; 47 typedef std::unique_ptr< Demo::Example > ExamplePointer;
@@ -78,8 +81,16 @@ private: @@ -78,8 +81,16 @@ private:
78 auto stage = Stage::GetCurrent(); 81 auto stage = Stage::GetCurrent();
79 stage.KeyEventSignal().Connect( this, &LayoutingExample::OnKeyEvent ); 82 stage.KeyEventSignal().Connect( this, &LayoutingExample::OnKeyEvent );
80 83
81 - auto bg = ImageView::New( BACKGROUND_IMAGE ); 84 + auto bg = Control::New();
82 bg.SetParentOrigin( ParentOrigin::CENTER ); 85 bg.SetParentOrigin( ParentOrigin::CENTER );
  86 + bg.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  87 + bg.SetProperty(
  88 + Control::Property::BACKGROUND,
  89 + Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT )
  90 + .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( BACKGROUND_GRADIENT_1 )
  91 + .Add( BACKGROUND_GRADIENT_2 ) )
  92 + .Add( GradientVisual::Property::START_POSITION, BACKGROUND_GRADIENT_START_POSITION )
  93 + .Add( GradientVisual::Property::END_POSITION, BACKGROUND_GRADIENT_END_POSITION ) );
83 stage.Add( bg ); 94 stage.Add( bg );
84 auto toolbar = ImageView::New( TOOLBAR_IMAGE ); 95 auto toolbar = ImageView::New( TOOLBAR_IMAGE );
85 toolbar.SetParentOrigin( ParentOrigin::TOP_CENTER ); 96 toolbar.SetParentOrigin( ParentOrigin::TOP_CENTER );
@@ -97,7 +108,8 @@ private: @@ -97,7 +108,8 @@ private:
97 toolbar.Add( mToolbarTitle ); 108 toolbar.Add( mToolbarTitle );
98 109
99 mNextLayout = PushButton::New(); 110 mNextLayout = PushButton::New();
100 - mNextLayout.SetProperty( Toolkit::Button::Property::LABEL, "change layout"); 111 + mNextLayout.SetStyleName( "ChangeLayoutButton" );
  112 + mNextLayout.SetProperty( Toolkit::Button::Property::LABEL, "Change Layout" );
101 mNextLayout.ClickedSignal().Connect( this, &LayoutingExample::ChangeLayout ); 113 mNextLayout.ClickedSignal().Connect( this, &LayoutingExample::ChangeLayout );
102 mNextLayout.SetParentOrigin( ParentOrigin::TOP_RIGHT ); 114 mNextLayout.SetParentOrigin( ParentOrigin::TOP_RIGHT );
103 mNextLayout.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); 115 mNextLayout.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
resources/style/mobile/demo-theme.json.in
@@ -194,6 +194,13 @@ @@ -194,6 +194,13 @@
194 "units": "USER_SPACE", 194 "units": "USER_SPACE",
195 "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] 195 "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]]
196 } 196 }
  197 + },
  198 +
  199 + "ChangeLayoutButton":
  200 + {
  201 + "label":{
  202 + "pointSize":5
  203 + }
197 } 204 }
198 } 205 }
199 } 206 }