Updates following Button API changes
[platform/core/uifw/dali-demo.git] / examples / text-memory-profiling / text-memory-profiling-example.cpp
index 09e6f69..2fb3d2d 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.
@@ -23,7 +23,6 @@
 // EXTERNAL INCLUDES
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 #include <dali-toolkit/devel-api/controls/navigation-view/navigation-view.h>
 
 // INTERNAL INCLUDES
@@ -45,6 +44,7 @@ enum TextType
   MULTI_COLOR_TEXT_WITH_STYLE,
   MULTI_COLOR_TEXT_WITH_EMOJI,
   MULTI_COLOR_TEXT_WITH_STYLE_EMOJI,
+  SMALL_TEXT_IN_LARGE_TEXT_LABEL,
   NUMBER_OF_TYPES
 };
 
@@ -57,7 +57,8 @@ std::string TEXT_TYPE_STRING[ NUMBER_OF_TYPES ] =
   "Multi color text",
   "Multi color text with style",
   "Multi color text with emoji",
-  "Multi color text with style and emoji"
+  "Multi color text with style and emoji",
+  "Small text in large Text Label"
 };
 
 const int NUMBER_OF_LABELS = 500;
@@ -100,7 +101,9 @@ public:
     label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
     label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
     label.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f );
-    label.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::YELLOW );
+    Property::Map shadowMap;
+    shadowMap.Insert( "color", Color::YELLOW );
+    label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
     label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
 
     Vector2 stageSize = Stage::GetCurrent().GetSize();
@@ -111,49 +114,74 @@ public:
       case SINGLE_COLOR_TEXT:
       {
         label.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
         break;
       }
       case SINGLE_COLOR_TEXT_WITH_STYLE:
       {
         label.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
         break;
       }
       case SINGLE_COLOR_TEXT_WITH_EMOJI:
       {
         label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 A Quick Brown Fox Jumps Over The Lazy Dog" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
         break;
       }
       case SINGLE_COLOR_TEXT_WITH_STYLE_EMOJI:
       {
         label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 A Quick Brown Fox Jumps Over The Lazy Dog" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
         break;
       }
       case MULTI_COLOR_TEXT:
       {
         label.SetProperty( TextLabel::Property::TEXT, "A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
         break;
       }
       case MULTI_COLOR_TEXT_WITH_STYLE:
       {
         label.SetProperty( TextLabel::Property::TEXT, "A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
         break;
       }
       case MULTI_COLOR_TEXT_WITH_EMOJI:
       {
         label.SetProperty( TextLabel::Property::TEXT, " \xF0\x9F\x98\x81 A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
         break;
       }
       case MULTI_COLOR_TEXT_WITH_STYLE_EMOJI:
       {
         label.SetProperty( TextLabel::Property::TEXT, " \xF0\x9F\x98\x81 A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
-        label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+        shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
+        break;
+      }
+      case SMALL_TEXT_IN_LARGE_TEXT_LABEL:
+      {
+        label.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
+
+        shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+        label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
+        label.SetSize(stageSize.x, stageSize.y * 0.25f); // Set the text label in larger size
         break;
       }
       default:
@@ -300,8 +328,8 @@ public:
 
     // Create a back button in the left of toolbar
     PushButton backButton = PushButton::New();
-    backButton.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BACK_IMAGE );
-    backButton.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BACK_IMAGE_SELECTED );
+    backButton.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, BACK_IMAGE );
+    backButton.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, BACK_IMAGE_SELECTED );
     backButton.ClickedSignal().Connect( this, &TextMemoryProfilingExample::OnBackButtonPressed );
     backButton.SetLeaveRequired( true );
     mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );