- Stage stage = Stage::GetCurrent();
-
- // Creates a default view with a default tool-bar.
- // The view is added to the stage.
- Toolkit::ToolBar toolBar;
- Layer toolBarLayer = DemoHelper::CreateView( application, mView, toolBar, BACKGROUND_IMAGE, TOOLBAR_IMAGE, APPLICATION_TITLE );
- stage.Add( toolBarLayer );
+ Window window = application.GetWindow();
+
+ // Use a gradient visual to render the background gradient.
+ Toolkit::Control background = Dali::Toolkit::Control::New();
+ background.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER );
+ background.SetProperty( Actor::Property::PARENT_ORIGIN, Dali::ParentOrigin::CENTER );
+ background.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
+
+ // Set up the background gradient.
+ Property::Array stopOffsets;
+ stopOffsets.PushBack( 0.0f );
+ stopOffsets.PushBack( 1.0f );
+ Property::Array stopColors;
+ stopColors.PushBack( Vector4( 0.17f, 0.24f, 0.35f, 1.0f ) ); // Dark, medium saturated blue ( top of screen)
+ stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue (bottom of screen)
+ const float percentageWindowHeight = window.GetSize().GetHeight() * 0.7f;
+
+ background.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
+ .Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT )
+ .Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets )
+ .Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors )
+ .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageWindowHeight ) )
+ .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageWindowHeight ) )
+ .Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) );
+
+ window.Add( background );
+
+ // Create a TextLabel for the application title.
+ Toolkit::TextLabel label = Toolkit::TextLabel::New( APPLICATION_TITLE );
+ label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
+ // Set the parent origin to a small percentage below the top (so the demo will scale for different resolutions).
+ label.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 0.03f, 0.5f ) );
+ label.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ label.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, TEXT_COLOR );
+ window.Add( label );