Commit 74177c1264be054639ac4bcd2a462e97129be516

Authored by Paul Wisbey
1 parent 22d0bd3f

Fix for TextLabel demo styling

Change-Id: I2844fd73a4bb49389d3df8dc287785ed415d2823
demo/dali-table-view.cpp
... ... @@ -22,7 +22,6 @@
22 22 #include <algorithm>
23 23 #include <sstream>
24 24 #include <unistd.h>
25   -#include <dali-toolkit/public-api/styling/style-manager.h>
26 25  
27 26 // INTERNAL INCLUDES
28 27 #include "shared/view.h"
... ... @@ -216,9 +215,7 @@ void DaliTableView::SortAlphabetically( bool sortAlphabetically )
216 215  
217 216 void DaliTableView::Initialize( Application& application )
218 217 {
219   - // Provide the stylesheet
220   - StyleManager styleManager = StyleManager::Get();
221   - styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH );
  218 + DemoHelper::RequestThemeChange();
222 219  
223 220 Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent );
224 221  
... ...
examples/animated-shapes/animated-shapes-example.cpp
... ... @@ -18,6 +18,8 @@
18 18 #include <dali/dali.h>
19 19 #include <dali-toolkit/dali-toolkit.h>
20 20  
  21 +#include "shared/view.h"
  22 +
21 23 using namespace Dali;
22 24  
23 25 namespace
... ... @@ -47,6 +49,8 @@ public:
47 49 // The Init signal is received once (only) during the Application lifetime
48 50 void Create( Application& application )
49 51 {
  52 + DemoHelper::RequestThemeChange();
  53 +
50 54 // Get a handle to the stage
51 55 Stage stage = Stage::GetCurrent();
52 56  
... ...
examples/blocks/blocks-example.cpp
... ... @@ -289,6 +289,8 @@ public:
289 289 */
290 290 void Create(Application& application)
291 291 {
  292 + DemoHelper::RequestThemeChange();
  293 +
292 294 Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
293 295  
294 296 // Creates a default view with a default tool bar.
... ...
examples/bubble-effect/bubble-effect-example.cpp
... ... @@ -95,6 +95,8 @@ private:
95 95 // The Init signal is received once (only) during the Application lifetime
96 96 void Create(Application& app)
97 97 {
  98 + DemoHelper::RequestThemeChange();
  99 +
98 100 Stage stage = Stage::GetCurrent();
99 101 Vector2 stageSize = stage.GetSize();
100 102  
... ...
examples/builder/examples.cpp
... ... @@ -243,7 +243,7 @@ public:
243 243 {
244 244 if(!mTitleActor)
245 245 {
246   - mTitleActor = TextLabel::New();
  246 + mTitleActor = DemoHelper::CreateToolBarLabel( "" );
247 247 // Add title to the tool bar.
248 248 mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
249 249 }
... ... @@ -393,12 +393,8 @@ public:
393 393  
394 394 Actor MenuItem(const std::string& text)
395 395 {
396   - int size = static_cast<int>(DemoHelper::ScalePointSize(6));
397   -
398   - std::ostringstream fontString;
399   - fontString << "<font size="<< size <<">"<< ShortName( text ) << "</font>";
400   -
401   - TextLabel label = TextLabel::New( fontString.str() );
  396 + TextLabel label = TextLabel::New( ShortName( text ) );
  397 + label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "builderlabel" );
402 398 label.SetResizePolicy( FILL_TO_PARENT, WIDTH );
403 399  
404 400 // Hook up tap detector
... ... @@ -508,6 +504,8 @@ public:
508 504  
509 505 void Create(Application& app)
510 506 {
  507 + DemoHelper::RequestThemeChange();
  508 +
511 509 Stage stage = Stage::GetCurrent();
512 510  
513 511 Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
... ...
examples/buttons/buttons-example.cpp
... ... @@ -108,6 +108,8 @@ class ButtonsController: public ConnectionTracker
108 108 {
109 109 // The Init signal is received once (only) during the Application lifetime
110 110  
  111 + DemoHelper::RequestThemeChange();
  112 +
111 113 // Respond to key events
112 114 Stage::GetCurrent().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent);
113 115  
... ...
examples/cluster/cluster-example.cpp
... ... @@ -447,6 +447,8 @@ public:
447 447 */
448 448 void Create(Application& application)
449 449 {
  450 + DemoHelper::RequestThemeChange();
  451 +
450 452 Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent);
451 453  
452 454 Vector2 stageSize = Stage::GetCurrent().GetSize();
... ...
examples/cube-transition-effect/cube-transition-effect-example.cpp
... ... @@ -224,6 +224,8 @@ CubeTransitionApp::~CubeTransitionApp()
224 224  
225 225 void CubeTransitionApp::OnInit( Application& application )
226 226 {
  227 + DemoHelper::RequestThemeChange();
  228 +
227 229 Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);
228 230  
229 231 // Creates a default view with a default tool bar, the view is added to the stage.
... ...
examples/dissolve-effect/dissolve-effect-example.cpp
... ... @@ -208,6 +208,8 @@ DissolveEffectApp::~DissolveEffectApp()
208 208  
209 209 void DissolveEffectApp::OnInit( Application& application )
210 210 {
  211 + DemoHelper::RequestThemeChange();
  212 +
211 213 Stage::GetCurrent().KeyEventSignal().Connect(this, &DissolveEffectApp::OnKeyEvent);
212 214  
213 215 // Creates a default view with a default tool bar, the view is added to the stage.
... ...
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
... ... @@ -291,6 +291,8 @@ public:
291 291 {
292 292 std::cout << "ImageScalingScaleToFillController::Create" << std::endl;
293 293  
  294 + DemoHelper::RequestThemeChange();
  295 +
294 296 // Get a handle to the stage:
295 297 Stage stage = Stage::GetCurrent();
296 298  
... ...
examples/item-view/item-view-example.cpp
... ... @@ -234,6 +234,8 @@ public:
234 234 */
235 235 void OnInit(Application& app)
236 236 {
  237 + DemoHelper::RequestThemeChange();
  238 +
237 239 Stage stage = Dali::Stage::GetCurrent();
238 240 stage.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
239 241  
... ...
examples/logging/logging-example.cpp
... ... @@ -156,6 +156,8 @@ class LoggingController: public ConnectionTracker
156 156 {
157 157 // The Init signal is received once (only) during the Application lifetime
158 158  
  159 + DemoHelper::RequestThemeChange();
  160 +
159 161 mCurrentLogger = 0;
160 162 mPerformanceLoggers.reserve( NUM_LOGGERS );
161 163 mPerformanceLoggers.resize( NUM_LOGGERS );
... ...
examples/magnifier/magnifier-example.cpp
... ... @@ -203,6 +203,8 @@ public:
203 203 */
204 204 void Create( Application& application )
205 205 {
  206 + DemoHelper::RequestThemeChange();
  207 +
206 208 Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
207 209  
208 210 mStageSize = Stage::GetCurrent().GetSize();
... ...
examples/motion-stretch/motion-stretch-example.cpp
... ... @@ -124,6 +124,8 @@ public:
124 124 {
125 125 // The Init signal is received once (only) during the Application lifetime
126 126  
  127 + DemoHelper::RequestThemeChange();
  128 +
127 129 Stage::GetCurrent().KeyEventSignal().Connect(this, &MotionStretchExampleApp::OnKeyEvent);
128 130  
129 131 // Creates a default view with a default tool bar.
... ...
examples/new-window/new-window-example.cpp
... ... @@ -116,6 +116,8 @@ NewWindowController::NewWindowController( Application&amp; application )
116 116  
117 117 void NewWindowController::Create( Application& app )
118 118 {
  119 + DemoHelper::RequestThemeChange();
  120 +
119 121 Stage stage = Stage::GetCurrent();
120 122 stage.SetBackgroundColor(Color::YELLOW);
121 123  
... ...
examples/page-turn-view/page-turn-view-example.cpp
... ... @@ -22,6 +22,8 @@
22 22 #include <string.h>
23 23 #include <iostream>
24 24  
  25 +#include "shared/view.h"
  26 +
25 27 using namespace Dali;
26 28 using namespace Dali::Toolkit;
27 29  
... ... @@ -226,6 +228,8 @@ void PageTurnController::OnInit( Application&amp; app )
226 228 {
227 229 // The Init signal is received once ( only ) during the Application lifetime
228 230  
  231 + DemoHelper::RequestThemeChange();
  232 +
229 233 Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent);
230 234  
231 235 Stage stage = Stage::GetCurrent();
... ...
examples/path-animation/path-animation.cpp
... ... @@ -436,6 +436,8 @@ public:
436 436 */
437 437 void Create( Application& application )
438 438 {
  439 + DemoHelper::RequestThemeChange();
  440 +
439 441 // Get a handle to the stage:
440 442 Stage stage = Stage::GetCurrent();
441 443  
... ...
examples/radial-menu/radial-menu-example.cpp
... ... @@ -121,6 +121,8 @@ RadialMenuExample::~RadialMenuExample()
121 121  
122 122 void RadialMenuExample::OnInit(Application& app)
123 123 {
  124 + DemoHelper::RequestThemeChange();
  125 +
124 126 Stage stage = Dali::Stage::GetCurrent();
125 127  
126 128 // The Init signal is received once (only) during the Application lifetime
... ...
examples/refraction-effect/refraction-effect-example.cpp
... ... @@ -318,6 +318,8 @@ private:
318 318 // The Init signal is received once (only) during the Application lifetime
319 319 void Create(Application& application)
320 320 {
  321 + DemoHelper::RequestThemeChange();
  322 +
321 323 Stage stage = Stage::GetCurrent();
322 324 mStageHalfSize = stage.GetSize() * 0.5f;
323 325  
... ...
examples/scripting/launcher.cpp
... ... @@ -23,6 +23,8 @@
23 23 #include <sys/stat.h>
24 24 #include <dali/integration-api/debug.h>
25 25  
  26 +// INTERNAL INCLUDES
  27 +#include "shared/view.h"
26 28  
27 29  
28 30 using namespace Dali;
... ... @@ -56,6 +58,8 @@ Launcher::~Launcher()
56 58  
57 59 void Launcher::Create( Dali::Application& application )
58 60 {
  61 + DemoHelper::RequestThemeChange();
  62 +
59 63 TextLabel textActor = TextLabel::New( "JSON & JavaScript Launcher..." );
60 64  
61 65 // Reposition the actor
... ...
examples/scroll-view/scroll-view-example.cpp
... ... @@ -179,6 +179,8 @@ public:
179 179 */
180 180 void OnInit(Application& app)
181 181 {
  182 + DemoHelper::RequestThemeChange();
  183 +
182 184 Stage stage = Dali::Stage::GetCurrent();
183 185 stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
184 186  
... ...
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
... ... @@ -141,6 +141,8 @@ public:
141 141 */
142 142 void Create(Application& app)
143 143 {
  144 + DemoHelper::RequestThemeChange();
  145 +
144 146 srand(0); // Want repeatable path
145 147  
146 148 Stage::GetCurrent().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent);
... ...
examples/size-negotiation/size-negotiation-example.cpp
... ... @@ -157,6 +157,8 @@ public:
157 157 {
158 158 // The Init signal is received once (only) during the Application lifetime
159 159  
  160 + DemoHelper::RequestThemeChange();
  161 +
160 162 Stage stage = Stage::GetCurrent();
161 163  
162 164 // Respond to key events
... ...
examples/text-field/text-field-example.cpp
... ... @@ -24,6 +24,9 @@
24 24 #include <dali-toolkit/dali-toolkit.h>
25 25 #include <dali/public-api/text-abstraction/text-abstraction.h>
26 26  
  27 +// INTERNAL INCLUDES
  28 +#include "shared/view.h"
  29 +
27 30 using namespace Dali;
28 31 using namespace Dali::Toolkit;
29 32  
... ... @@ -60,6 +63,8 @@ public:
60 63 */
61 64 void Create( Application& application )
62 65 {
  66 + DemoHelper::RequestThemeChange();
  67 +
63 68 Stage stage = Stage::GetCurrent();
64 69  
65 70 stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent);
... ...
examples/text-label-multi-language/text-label-multi-language-example.cpp
... ... @@ -20,13 +20,14 @@
20 20 * @brief Basic usage of TextLabel control
21 21 */
22 22  
23   -// INTERNAL INCLUDES
24   -#include "shared/multi-language-strings.h"
25   -
26 23 // EXTERNAL INCLUDES
27 24 #include <dali-toolkit/dali-toolkit.h>
28 25 #include <dali/public-api/text-abstraction/text-abstraction.h>
29 26  
  27 +// INTERNAL INCLUDES
  28 +#include "shared/multi-language-strings.h"
  29 +#include "shared/view.h"
  30 +
30 31 using namespace Dali;
31 32 using namespace Dali::Toolkit;
32 33 using namespace MultiLanguageStrings;
... ... @@ -56,6 +57,8 @@ public:
56 57 */
57 58 void Create( Application& application )
58 59 {
  60 + DemoHelper::RequestThemeChange();
  61 +
59 62 Stage stage = Stage::GetCurrent();
60 63  
61 64 stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
... ...
examples/text-label/text-label-example.cpp
... ... @@ -26,6 +26,7 @@
26 26  
27 27 // INTERNAL INCLUDES
28 28 #include "shared/multi-language-strings.h"
  29 +#include "shared/view.h"
29 30  
30 31 using namespace Dali;
31 32 using namespace Dali::Toolkit;
... ... @@ -95,6 +96,8 @@ public:
95 96 */
96 97 void Create( Application& application )
97 98 {
  99 + DemoHelper::RequestThemeChange();
  100 +
98 101 Stage stage = Stage::GetCurrent();
99 102  
100 103 stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
... ...
resources/style/demo-theme.json
... ... @@ -25,7 +25,8 @@ distributing this software or its derivatives.
25 25 "textlabel":
26 26 {
27 27 "font-family":"HelveticaNeue",
28   - "font-style":"Regular"
  28 + "font-style":"Regular",
  29 + "point-size":18
29 30 },
30 31  
31 32 "launcherlabel":
... ... @@ -38,6 +39,11 @@ distributing this software or its derivatives.
38 39 "point-size":18
39 40 },
40 41  
  42 + "builderlabel":
  43 + {
  44 + "point-size":13
  45 + },
  46 +
41 47 "textfield":
42 48 {
43 49 "font-family":"HelveticaNeue",
... ...
resources/style/mobile/demo-theme.json
... ... @@ -59,6 +59,11 @@ distributing this software or its derivatives.
59 59 "point-size":10
60 60 },
61 61  
  62 + "builderlabel":
  63 + {
  64 + "point-size":10
  65 + },
  66 +
62 67 "textfield":
63 68 {
64 69 "font-family":"SamsungSans",
... ...
shared/view.h
... ... @@ -51,6 +51,13 @@ const Dali::Vector4 DEFAULT_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
51 51 const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f);
52 52 const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f);
53 53  
  54 +void RequestThemeChange()
  55 +{
  56 + // Provide the stylesheet
  57 + Dali::Toolkit::StyleManager styleManager = Dali::Toolkit::StyleManager::Get();
  58 + styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH );
  59 +}
  60 +
54 61 float ScalePointSize(int pointSize)
55 62 {
56 63 Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi();
... ...