Ensure Text Scrolling Example works on targets with large screens
[platform/core/uifw/dali-demo.git] / examples / text-scrolling / text-scrolling-example.cpp
index 6b3f047..e886331 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
 
 // EXTERNAL INCLUDES
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
 
 namespace
 {
-const Vector2 DESKTOP_SIZE( Vector2( 1440.f, 1600.f ) );
+const float STAGE_HEIGHT_MULTIPLIER( 1.5f );
 const Vector2 BOX_SIZE( Vector2(330.0f, 80.0f ) );
 const Vector2 SCROLLING_BOX_SIZE( Vector2(330.0f, 40.0f ) );
 const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f;
@@ -136,7 +135,7 @@ public:
 
     mAnimation = Animation::New( 1.0f );
 
-    const Size mTargetActorSize( mStageSize.width, DESKTOP_SIZE.height );
+    const Size mTargetActorSize( mStageSize.width, mStageSize.height * STAGE_HEIGHT_MULTIPLIER );
 
     // Create Desktop
     Control desktop = Control::New();
@@ -174,15 +173,16 @@ public:
     scrollLargeButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedLarge );
     CreateLabel( mLargeLabel, "A Quick Brown Fox Jumps Over The Lazy Dog", boxB, false ,scrollLargeButton );
 
-
     CreateBox( "boxC", boxC, desktop, SCROLLING_BOX_SIZE );
     boxC.SetPosition( 0.0f, -300.0f, 1.0f );
     Toolkit::PushButton scrollSmallButton = Toolkit::PushButton::New();
     scrollSmallButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedSmall );
     CreateLabel( mSmallLabel, "Hello Text", boxC , true, scrollSmallButton );
     mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
-    mSmallLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
-    mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::CYAN );
+    Property::Map shadowMap;
+    shadowMap.Insert( "color", Color::CYAN );
+    shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
+    mSmallLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
 
     CreateBox( "boxD", boxD, desktop, SCROLLING_BOX_SIZE );
     boxD.SetPosition( 0.0f, -200.0f, 1.0f );
@@ -208,8 +208,8 @@ public:
 
     Toolkit::PushButton colorButton = Toolkit::PushButton::New();
     colorButton.SetProperty( Button::Property::TOGGLABLE, true );
-    colorButton.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, Property::Map().Add ( Toolkit::Visual::Property::TYPE, Visual::COLOR ).Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
-    colorButton.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, Property::Map().Add ( Toolkit::Visual::Property::TYPE, Visual::COLOR ).Add( ColorVisual::Property::MIX_COLOR, Color::BLACK ) );
+    colorButton.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, Property::Map().Add ( Toolkit::Visual::Property::TYPE, Visual::COLOR ).Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
+    colorButton.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, Property::Map().Add ( Toolkit::Visual::Property::TYPE, Visual::COLOR ).Add( ColorVisual::Property::MIX_COLOR, Color::BLACK ) );
     colorButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
     colorButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
     colorButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
@@ -320,7 +320,9 @@ public:
       mToggleColor = true;
     }
 
-    mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
+    Property::Map shadowMap;
+    shadowMap.Insert( "color", Color::BLACK );
+    mSmallLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
     mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
     mRtlLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
     mLargeLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );