Fix for TextLabel demo styling 75/37675/4
authorPaul Wisbey <p.wisbey@samsung.com>
Thu, 2 Apr 2015 09:56:48 +0000 (10:56 +0100)
committerPaul Wisbey <p.wisbey@samsung.com>
Thu, 2 Apr 2015 12:28:55 +0000 (05:28 -0700)
Change-Id: I2844fd73a4bb49389d3df8dc287785ed415d2823

29 files changed:
demo/dali-table-view.cpp
examples/animated-shapes/animated-shapes-example.cpp
examples/blocks/blocks-example.cpp
examples/bubble-effect/bubble-effect-example.cpp
examples/builder/examples.cpp
examples/buttons/buttons-example.cpp
examples/cluster/cluster-example.cpp
examples/cube-transition-effect/cube-transition-effect-example.cpp
examples/dissolve-effect/dissolve-effect-example.cpp
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
examples/item-view/item-view-example.cpp
examples/logging/logging-example.cpp
examples/magnifier/magnifier-example.cpp
examples/motion-stretch/motion-stretch-example.cpp
examples/new-window/new-window-example.cpp
examples/page-turn-view/page-turn-view-example.cpp
examples/path-animation/path-animation.cpp
examples/radial-menu/radial-menu-example.cpp
examples/refraction-effect/refraction-effect-example.cpp
examples/scripting/launcher.cpp
examples/scroll-view/scroll-view-example.cpp
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
examples/size-negotiation/size-negotiation-example.cpp
examples/text-field/text-field-example.cpp
examples/text-label-multi-language/text-label-multi-language-example.cpp
examples/text-label/text-label-example.cpp
resources/style/demo-theme.json
resources/style/mobile/demo-theme.json
shared/view.h

index 5d4610bb93c292e5d86b1eb00e4774394b332225..9871c6133f1b4322f8b700ed7fd30dfe45b600d6 100644 (file)
@@ -22,7 +22,6 @@
 #include <algorithm>
 #include <sstream>
 #include <unistd.h>
-#include <dali-toolkit/public-api/styling/style-manager.h>
 
 // INTERNAL INCLUDES
 #include "shared/view.h"
@@ -216,9 +215,7 @@ void DaliTableView::SortAlphabetically( bool sortAlphabetically )
 
 void DaliTableView::Initialize( Application& application )
 {
-  // Provide the stylesheet
-  StyleManager styleManager = StyleManager::Get();
-  styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH );
+  DemoHelper::RequestThemeChange();
 
   Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent );
 
index f73c79676c9ab30496c7e9d580bc02e26921abcd..40b058e8eab65a0f9853e7d7e209cb7481042342 100644 (file)
@@ -18,6 +18,8 @@
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
 
+#include "shared/view.h"
+
 using namespace Dali;
 
 namespace
@@ -47,6 +49,8 @@ public:
   // The Init signal is received once (only) during the Application lifetime
   void Create( Application& application )
   {
+    DemoHelper::RequestThemeChange();
+
     // Get a handle to the stage
     Stage stage = Stage::GetCurrent();
 
index 5412b0d1bbffa46ce2768920924a6bd804422fcb..f8cce6f93e6a9df46a7b2b56c9811ee12dae1582 100644 (file)
@@ -289,6 +289,8 @@ public:
    */
   void Create(Application& application)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
 
     // Creates a default view with a default tool bar.
index f86daa44d0a10dc6ceb906603ada51389f633dca..db2a52e6e7a18bc4b4161a7c90bda4e74d1b147c 100644 (file)
@@ -95,6 +95,8 @@ private:
   // The Init signal is received once (only) during the Application lifetime
   void Create(Application& app)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
     Vector2 stageSize = stage.GetSize();
 
index 2fb6fdab449f8a2cf95e70bc0116fad2bfefa775..cd3940b51cdb8f174938d9a7d5c51336fc9aadaa 100644 (file)
@@ -243,7 +243,7 @@ public:
   {
     if(!mTitleActor)
     {
-      mTitleActor = TextLabel::New();
+      mTitleActor = DemoHelper::CreateToolBarLabel( "" );
       // Add title to the tool bar.
       mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
     }
@@ -393,12 +393,8 @@ public:
 
   Actor MenuItem(const std::string& text)
   {
-    int size = static_cast<int>(DemoHelper::ScalePointSize(6));
-
-    std::ostringstream fontString;
-    fontString << "<font size="<< size <<">"<<  ShortName( text ) << "</font>";
-
-    TextLabel label = TextLabel::New( fontString.str() );
+    TextLabel label = TextLabel::New( ShortName( text ) );
+    label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "builderlabel" );
     label.SetResizePolicy( FILL_TO_PARENT, WIDTH );
 
     // Hook up tap detector
@@ -508,6 +504,8 @@ public:
 
   void Create(Application& app)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
 
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
index ad35087c8b5539745b2706facba9a934e4e42f96..66e2293a478acaece5b33bf22724604cb02fd58f 100644 (file)
@@ -108,6 +108,8 @@ class ButtonsController: public ConnectionTracker
   {
     // The Init signal is received once (only) during the Application lifetime
 
+    DemoHelper::RequestThemeChange();
+
     // Respond to key events
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent);
 
index 8dce935bba7ad135eb0c867ed62d3f9600ba1e8c..cf52aa97def3da698d01aa30190ed112dc0969be 100644 (file)
@@ -447,6 +447,8 @@ public:
    */
   void Create(Application& application)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent);
 
     Vector2 stageSize = Stage::GetCurrent().GetSize();
index 219f659415b2732c287dbcbab5dc6ddf404c7ec0..656f6ee0e68dafd10f48e996da4ed2300d360ad1 100644 (file)
@@ -224,6 +224,8 @@ CubeTransitionApp::~CubeTransitionApp()
 
 void CubeTransitionApp::OnInit( Application& application )
 {
+  DemoHelper::RequestThemeChange();
+
   Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);
 
   // Creates a default view with a default tool bar, the view is added to the stage.
index 6108f2bbdfe465a8b193f8a47f19dc3956dcbef4..53d54dfc9d8ecf01de309baefd96f8ef12b33687 100644 (file)
@@ -208,6 +208,8 @@ DissolveEffectApp::~DissolveEffectApp()
 
 void DissolveEffectApp::OnInit( Application& application )
 {
+  DemoHelper::RequestThemeChange();
+
   Stage::GetCurrent().KeyEventSignal().Connect(this, &DissolveEffectApp::OnKeyEvent);
 
   // Creates a default view with a default tool bar, the view is added to the stage.
index 1482fa9bd64365ef0209bbd41117e0b36382a37d..68a409112164c28ebbefd2aaa4b257d9ff6e0347 100644 (file)
@@ -291,6 +291,8 @@ public:
   {
     std::cout << "ImageScalingScaleToFillController::Create" << std::endl;
 
+    DemoHelper::RequestThemeChange();
+
     // Get a handle to the stage:
     Stage stage = Stage::GetCurrent();
 
index 5a0acdc46f2309863b98aff73f971b3d2a026bf6..f14a2681f436497b703319e6434b746b742758d0 100644 (file)
@@ -234,6 +234,8 @@ public:
    */
   void OnInit(Application& app)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Dali::Stage::GetCurrent();
     stage.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
 
index 889621ad6d3f4bbe78039d7d0a12fcb8f0e8b484..184deb249c10a4bb51b921698378f21b65c35ce7 100644 (file)
@@ -156,6 +156,8 @@ class LoggingController: public ConnectionTracker
   {
     // The Init signal is received once (only) during the Application lifetime
 
+    DemoHelper::RequestThemeChange();
+
     mCurrentLogger = 0;
     mPerformanceLoggers.reserve( NUM_LOGGERS );
     mPerformanceLoggers.resize( NUM_LOGGERS );
index f28529b124beefcbc152858f99567a87483be056..632445ffb4a1cd6cdd769c9fe6c7f30d595a31ea 100644 (file)
@@ -203,6 +203,8 @@ public:
    */
   void Create( Application& application )
   {
+    DemoHelper::RequestThemeChange();
+
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
 
     mStageSize = Stage::GetCurrent().GetSize();
index 4bcf08f96b30a0ff2c1e460a8f14506ebe82a442..4535f4464ed5e155ef2903fbcbbddcd5f1962b4b 100644 (file)
@@ -124,6 +124,8 @@ public:
   {
     // The Init signal is received once (only) during the Application lifetime
 
+    DemoHelper::RequestThemeChange();
+
     Stage::GetCurrent().KeyEventSignal().Connect(this, &MotionStretchExampleApp::OnKeyEvent);
 
     // Creates a default view with a default tool bar.
index 39b0db2c59c6eda1fbd85d1b012ee4caa21324a7..877aa2d59338811fe476e908d185eb54213d6922 100644 (file)
@@ -116,6 +116,8 @@ NewWindowController::NewWindowController( Application& application )
 
 void NewWindowController::Create( Application& app )
 {
+  DemoHelper::RequestThemeChange();
+
   Stage stage = Stage::GetCurrent();
   stage.SetBackgroundColor(Color::YELLOW);
 
index 8f5d14772c675b63434e82693d8510c3e4f607bc..33498cd80585c4344259447e4344f9169092b986 100644 (file)
@@ -22,6 +22,8 @@
 #include <string.h>
 #include <iostream>
 
+#include "shared/view.h"
+
 using namespace Dali;
 using namespace Dali::Toolkit;
 
@@ -226,6 +228,8 @@ void PageTurnController::OnInit( Application& app )
 {
   // The Init signal is received once ( only ) during the Application lifetime
 
+  DemoHelper::RequestThemeChange();
+
   Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent);
 
   Stage stage = Stage::GetCurrent();
index 5ee4f0aec451d933757730ae4d617f158d5b5496..c1431740ead10e268d5f41c32378b74382ea9048 100644 (file)
@@ -436,6 +436,8 @@ public:
    */
   void Create( Application& application )
   {
+    DemoHelper::RequestThemeChange();
+
     // Get a handle to the stage:
     Stage stage = Stage::GetCurrent();
 
index f022eb079c75bcf0740d8c85b278a0ccb582daad..2ad18bbca321dd037b4ef88c04215ac05eb9dd1b 100644 (file)
@@ -121,6 +121,8 @@ RadialMenuExample::~RadialMenuExample()
 
 void RadialMenuExample::OnInit(Application& app)
 {
+  DemoHelper::RequestThemeChange();
+
   Stage stage = Dali::Stage::GetCurrent();
 
   // The Init signal is received once (only) during the Application lifetime
index 7a3a290d7dab77d4887cac9ff7d5f0f3d2315874..951bab3903629e3453bc7d95b594e3390e7a8870 100644 (file)
@@ -318,6 +318,8 @@ private:
   // The Init signal is received once (only) during the Application lifetime
   void Create(Application& application)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
     mStageHalfSize = stage.GetSize() * 0.5f;
 
index 3106aec80fb96c1c86fbcd8a314445917b6b9961..9c48b3f722197d110f535a289024dde8ea682afc 100644 (file)
@@ -23,6 +23,8 @@
 #include <sys/stat.h>
 #include <dali/integration-api/debug.h>
 
+// INTERNAL INCLUDES
+#include "shared/view.h"
 
 
 using namespace Dali;
@@ -56,6 +58,8 @@ Launcher::~Launcher()
 
 void Launcher::Create( Dali::Application& application )
 {
+  DemoHelper::RequestThemeChange();
+
   TextLabel textActor = TextLabel::New( "JSON & JavaScript Launcher..." );
 
   // Reposition the actor
index a1743c37f2bf33680db744b1d8d139db62623dc0..30d0a9070a75643c24ddfbc454348994d2ecb29a 100644 (file)
@@ -179,6 +179,8 @@ public:
    */
   void OnInit(Application& app)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Dali::Stage::GetCurrent();
     stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
 
index 9d42d6824f67e69eed1a4982f2c9d50979f6545f..36ccf4f6134150b9788ed0b70c92afc4ef66f1a0 100644 (file)
@@ -141,6 +141,8 @@ public:
    */
   void Create(Application& app)
   {
+    DemoHelper::RequestThemeChange();
+
     srand(0); // Want repeatable path
 
     Stage::GetCurrent().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent);
index 8a35da7bf6febbba6c90e724681d26d365094d22..54f9fa85d1d6a4317cef62022569f9f24d1b0a95 100644 (file)
@@ -157,6 +157,8 @@ public:
   {
     // The Init signal is received once (only) during the Application lifetime
 
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
 
     // Respond to key events
index a738b18414a4caf79123adbacbb337f54ee1aeee..65e672418c36efa2a480b506d9eb99ed3f1a5c43 100644 (file)
@@ -24,6 +24,9 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/public-api/text-abstraction/text-abstraction.h>
 
+// INTERNAL INCLUDES
+#include "shared/view.h"
+
 using namespace Dali;
 using namespace Dali::Toolkit;
 
@@ -60,6 +63,8 @@ public:
    */
   void Create( Application& application )
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
 
     stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent);
index c1f5e2d145ac049735a8058296303e6cc5aebec2..6efed447157b1bec1089b5fe38d97829ce5f0b0f 100644 (file)
  * @brief Basic usage of TextLabel control
  */
 
-// INTERNAL INCLUDES
-#include "shared/multi-language-strings.h"
-
 // EXTERNAL INCLUDES
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/public-api/text-abstraction/text-abstraction.h>
 
+// INTERNAL INCLUDES
+#include "shared/multi-language-strings.h"
+#include "shared/view.h"
+
 using namespace Dali;
 using namespace Dali::Toolkit;
 using namespace MultiLanguageStrings;
@@ -56,6 +57,8 @@ public:
    */
   void Create( Application& application )
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
 
     stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
index a8476bfcc3cd0fbb90bde299520483c7a1433e28..c19dbaac61b38197288b5eea8770eb3c85416eda 100644 (file)
@@ -26,6 +26,7 @@
 
 // INTERNAL INCLUDES
 #include "shared/multi-language-strings.h"
+#include "shared/view.h"
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -95,6 +96,8 @@ public:
    */
   void Create( Application& application )
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
 
     stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
index 47e0e3d43177a283fd49b76699ba46f130258c11..89650cea4c92963ee6bef8b56be03f88e7341d0d 100644 (file)
@@ -25,7 +25,8 @@ distributing this software or its derivatives.
     "textlabel":
     {
       "font-family":"HelveticaNeue",
-      "font-style":"Regular"
+      "font-style":"Regular",
+      "point-size":18
     },
 
     "launcherlabel":
@@ -38,6 +39,11 @@ distributing this software or its derivatives.
       "point-size":18
     },
 
+    "builderlabel":
+    {
+      "point-size":13
+    },
+
     "textfield":
     {
       "font-family":"HelveticaNeue",
index 88d2b675e66727d8ad6b89b2debaa16d12bb2af2..7ecff98b58c3ade6f26d8f0cab37a715fc85c8d8 100644 (file)
@@ -59,6 +59,11 @@ distributing this software or its derivatives.
       "point-size":10
     },
 
+    "builderlabel":
+    {
+      "point-size":10
+    },
+
     "textfield":
     {
       "font-family":"SamsungSans",
index 53c42182dafec30b868eb9b8e34c2c3145c0bdfe..091a595a459ea2e4db6b2e3f757a4cf4d717eb3d 100644 (file)
@@ -51,6 +51,13 @@ const Dali::Vector4           DEFAULT_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
 const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f);
 const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f);
 
+void RequestThemeChange()
+{
+  // Provide the stylesheet
+  Dali::Toolkit::StyleManager styleManager = Dali::Toolkit::StyleManager::Get();
+  styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH );
+}
+
 float ScalePointSize(int pointSize)
 {
   Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi();