Commit d40e848d230c9823d7b97f0205ff74a921dde353

Authored by Paul Wisbey
1 parent 6ebeb640

Replace TextView with TextLabel

Change-Id: I5932f0191f358e986fcaace820fb2ecb43b9812b
demo/dali-table-view.cpp
... ... @@ -530,6 +530,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit
530 530 label.SetProperty( TextLabel::Property::TEXT, title );
531 531 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
532 532 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
  533 + label.SetResizePolicy( FILL_TO_PARENT, HEIGHT );
533 534 label.SetColor( TABLE_TEXT_STYLE_COLOR );
534 535 content.Add( label );
535 536  
... ...
examples/builder/examples.cpp
... ... @@ -241,7 +241,14 @@ public:
241 241  
242 242 void SetTitle(const std::string& title)
243 243 {
244   - // TODO
  244 + if(!mTitleActor)
  245 + {
  246 + mTitleActor = TextLabel::New();
  247 + // Add title to the tool bar.
  248 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
  249 + }
  250 +
  251 + mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
245 252 }
246 253  
247 254 bool OnToolSelectLayout( Toolkit::Button button )
... ... @@ -386,7 +393,18 @@ public:
386 393  
387 394 Actor MenuItem(const std::string& text)
388 395 {
389   - return Actor();
  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() );
  402 + label.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  403 +
  404 + // Hook up tap detector
  405 + mTapDetector.Attach( label );
  406 +
  407 + return label;
390 408 }
391 409  
392 410 bool OnTimer()
... ... @@ -579,6 +597,7 @@ private:
579 597 unsigned int mOrientation;
580 598  
581 599 Toolkit::ToolBar mToolBar;
  600 + TextLabel mTitleActor; ///< The Toolbar's Title.
582 601  
583 602 Layer mBuilderLayer;
584 603  
... ...
examples/buttons/buttons-example.cpp
... ... @@ -238,6 +238,9 @@ class ButtonsController: public ConnectionTracker
238 238 tableView.SetPreferredSize( Vector2( DP(260), 0.0f ) );
239 239 tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
240 240  
  241 + Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( "Select enabled" );
  242 + tableView.AddChild( textLabel, Toolkit::TableView::CellPosition( 0, 0 ) );
  243 +
241 244 ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) );
242 245 imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
243 246 imageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
... ... @@ -421,6 +424,42 @@ class ButtonsController: public ConnectionTracker
421 424  
422 425 bool OnCheckBoxesSelected( Toolkit::Button button )
423 426 {
  427 + if( button.GetName() == "checkbox1" )
  428 + {
  429 + if( button.IsSelected() )
  430 + {
  431 + button.SetLabel("CheckBox1 is selected");
  432 + }
  433 + else
  434 + {
  435 + button.SetLabel("CheckBox1 is unselected");
  436 + }
  437 + }
  438 +
  439 + if( button.GetName() == "checkbox2" )
  440 + {
  441 + if( button.IsSelected() )
  442 + {
  443 + button.SetLabel("CheckBox2 is selected");
  444 + }
  445 + else
  446 + {
  447 + button.SetLabel("CheckBox2 is unselected");
  448 + }
  449 + }
  450 +
  451 + if( button.GetName() == "checkbox3" )
  452 + {
  453 + if( button.IsSelected() )
  454 + {
  455 + button.SetLabel("CheckBox3 is selected");
  456 + }
  457 + else
  458 + {
  459 + button.SetLabel("CheckBox3 is unselected");
  460 + }
  461 + }
  462 +
424 463 return true;
425 464 }
426 465  
... ...
examples/cluster/cluster-example.cpp
... ... @@ -825,7 +825,15 @@ public:
825 825 */
826 826 void SetTitle(const std::string& title)
827 827 {
828   - // TODO
  828 + if(!mTitleActor)
  829 + {
  830 + mTitleActor = DemoHelper::CreateToolBarLabel( "" );
  831 +
  832 + // Add title to the tool bar.
  833 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
  834 + }
  835 +
  836 + mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
829 837 }
830 838  
831 839 /**
... ... @@ -847,6 +855,7 @@ private:
847 855 Application& mApplication; ///< Application instance
848 856 Toolkit::View mView; ///< The View instance.
849 857 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  858 + TextLabel mTitleActor; ///< The Toolbar's Title.
850 859  
851 860 Layer mContentLayer; ///< Content layer (scrolling cluster content)
852 861  
... ...
examples/cube-transition-effect/cube-transition-effect-example.cpp
... ... @@ -26,6 +26,8 @@
26 26  
27 27 using namespace Dali;
28 28  
  29 +using Dali::Toolkit::TextLabel;
  30 +
29 31 // LOCAL STUFF
30 32 namespace
31 33 {
... ... @@ -173,6 +175,7 @@ private:
173 175 Toolkit::View mView;
174 176 Toolkit::ToolBar mToolBar;
175 177 Layer mContent;
  178 + Toolkit::TextLabel mTitleActor;
176 179 Actor mParent;
177 180  
178 181 Vector2 mViewSize;
... ... @@ -235,6 +238,10 @@ void CubeTransitionApp::OnInit( Application&amp; application )
235 238 mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
236 239 mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
237 240  
  241 + // Add title to the tool bar.
  242 + mTitleActor = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_WAVE );
  243 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
  244 +
238 245 //Add an slideshow icon on the right of the title
239 246 mIconSlideshowStart = ResourceImage::New( SLIDE_SHOW_START_ICON );
240 247 mIconSlideshowStop = ResourceImage::New( SLIDE_SHOW_STOP_ICON );
... ... @@ -351,17 +358,20 @@ bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button )
351 358 if(mCurrentEffect == mCubeWaveEffect)
352 359 {
353 360 mCurrentEffect = mCubeCrossEffect;
  361 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) );
354 362 mEffectChangeButton.SetBackgroundImage(mImageCross);
355 363  
356 364 }
357 365 else if(mCurrentEffect == mCubeCrossEffect)
358 366 {
359 367 mCurrentEffect = mCubeFoldEffect;
  368 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) );
360 369 mEffectChangeButton.SetBackgroundImage(mImageFold);
361 370 }
362 371 else
363 372 {
364 373 mCurrentEffect = mCubeWaveEffect;
  374 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) );
365 375 mEffectChangeButton.SetBackgroundImage(mImageWave);
366 376 }
367 377  
... ...
examples/dissolve-effect/dissolve-effect-example.cpp
... ... @@ -26,6 +26,8 @@
26 26  
27 27 using namespace Dali;
28 28  
  29 +using Dali::Toolkit::TextLabel;
  30 +
29 31 // LOCAL STUFF
30 32 namespace
31 33 {
... ... @@ -157,6 +159,7 @@ private:
157 159 Toolkit::View mView;
158 160 Toolkit::ToolBar mToolBar;
159 161 Layer mContent;
  162 + Toolkit::TextLabel mTitleActor;
160 163 Actor mParent;
161 164  
162 165 ImageActor mCurrentImage;
... ... @@ -219,7 +222,8 @@ void DissolveEffectApp::OnInit( Application&amp; application )
219 222 mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
220 223  
221 224 // Add title to the tool bar.
222   - // TODO
  225 + mTitleActor = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_HIGHP );
  226 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
223 227  
224 228 // Add an slide-show button on the right of the title
225 229 mIconPlay = ResourceImage::New( PLAY_ICON );
... ... @@ -335,6 +339,7 @@ bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button )
335 339 mCurrentImageEffect = Toolkit::DissolveEffect::New(mUseHighPrecision);
336 340 if(mUseHighPrecision)
337 341 {
  342 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) );
338 343 mEffectChangeButton.SetBackgroundImage(mIconHighP);
339 344 }
340 345 else
... ...
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
... ... @@ -537,7 +537,12 @@ public:
537 537 */
538 538 void SetTitle(const std::string& title)
539 539 {
540   - // TODO
  540 + if(!mTitleActor)
  541 + {
  542 + mTitleActor = TextLabel::New();
  543 + // Add title to the tool bar.
  544 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
  545 + }
541 546 }
542 547  
543 548 /**
... ... @@ -566,6 +571,7 @@ private:
566 571 Layer mContentLayer; ///< The content layer (contains non gui chrome actors)
567 572 Toolkit::View mView; ///< The View instance.
568 573 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  574 + TextLabel mTitleActor; ///< The Toolbar's Title.
569 575 Actor mGridActor; ///< The container for the grid of images
570 576 ScrollView mScrollView; ///< ScrollView UI Component
571 577 bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary)
... ...
examples/item-view/item-view-example.cpp
... ... @@ -109,9 +109,9 @@ AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear,
109 109  
110 110 const unsigned int NUM_ALPHA_FUNCTIONS = sizeof(ALPHA_FUNCTIONS) / sizeof(AlphaFunction);
111 111  
112   -//const char* ALPHA_FUNCTIONS_TEXT[] = { "Linear",
113   -// "EaseIn",
114   -// "EaseOut" };
  112 +const char* ALPHA_FUNCTIONS_TEXT[] = { "Linear",
  113 + "EaseIn",
  114 + "EaseOut" };
115 115  
116 116 const char* BACKGROUND_IMAGE( "" );
117 117 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
... ... @@ -160,10 +160,6 @@ const float BUTTON_BORDER = -10.0f;
160 160 const float MENU_OPTION_HEIGHT(140.0f);
161 161 const float LABEL_TEXT_SIZE_Y = 20.0f;
162 162  
163   -//const char* DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue");
164   -//const char* DEFAULT_TEXT_STYLE_FONT_STYLE("Regular");
165   -//const Vector4 DEFAULT_TEXT_STYLE_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
166   -
167 163 const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f );
168 164  
169 165 static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth)
... ... @@ -972,7 +968,12 @@ private:
972 968 */
973 969 void SetTitle(const std::string& title)
974 970 {
975   - // TODO
  971 + if(!mTitleActor)
  972 + {
  973 + mTitleActor = TextLabel::New();
  974 + // Add title to the tool bar.
  975 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
  976 + }
976 977 }
977 978  
978 979 void ShowMenu()
... ... @@ -1001,6 +1002,36 @@ private:
1001 1002 slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );
1002 1003 tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );
1003 1004  
  1005 + TextLabel text = TextLabel::New( "Duration" );
  1006 + text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
  1007 + text.SetParentOrigin( ParentOrigin::TOP_LEFT );
  1008 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1009 + text.SetResizePolicy( FIXED, HEIGHT );
  1010 + text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
  1011 + slider.Add( text );
  1012 +
  1013 + Actor textContainer = Actor::New();
  1014 + textContainer.SetRelayoutEnabled( true );
  1015 + textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  1016 + mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
  1017 + mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER );
  1018 + mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER );
  1019 + textContainer.Add( mAlphaFunctionText );
  1020 + tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) );
  1021 +
  1022 + mTapDetector = TapGestureDetector::New();
  1023 + mTapDetector.Attach(mAlphaFunctionText);
  1024 + mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ChangeAlphaFunctionOnTap );
  1025 +
  1026 + text = TextLabel::New( "Alpha Function" );
  1027 + text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
  1028 + text.SetParentOrigin( ParentOrigin::TOP_LEFT );
  1029 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1030 + text.SetResizePolicy( FIXED, HEIGHT );
  1031 + text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
  1032 + textContainer.Add( text );
  1033 +
  1034 + mMenu.MarkDirtyForRelayout();
1004 1035 mMenu.Show();
1005 1036 mMenuShown = true;
1006 1037 }
... ... @@ -1019,6 +1050,11 @@ private:
1019 1050 mAlphaFuncIndex = 0;
1020 1051 }
1021 1052  
  1053 + if( mAlphaFunctionText )
  1054 + {
  1055 + mAlphaFunctionText.SetProperty( TextLabel::Property::TEXT, std::string(ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex]) );
  1056 + }
  1057 +
1022 1058 if( mItemView )
1023 1059 {
1024 1060 mItemView.GetActiveLayout()->SetAlphaFunction( ALPHA_FUNCTIONS[mAlphaFuncIndex] );
... ... @@ -1080,6 +1116,7 @@ private:
1080 1116 unsigned int mOrientation;
1081 1117  
1082 1118 Toolkit::ToolBar mToolBar;
  1119 + TextLabel mTitleActor; ///< The Toolbar's Title.
1083 1120  
1084 1121 ItemView mItemView;
1085 1122 Image mBorderImage;
... ... @@ -1100,6 +1137,7 @@ private:
1100 1137 Toolkit::PushButton mReplaceButton;
1101 1138  
1102 1139 unsigned int mAlphaFuncIndex;
  1140 + TextLabel mAlphaFunctionText;
1103 1141 BufferImage mWhiteImage;
1104 1142 };
1105 1143  
... ...
examples/logging/logging-example.cpp
... ... @@ -196,6 +196,16 @@ class LoggingController: public ConnectionTracker
196 196 radioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_RADIO_GROUP_HEIGHT) );
197 197 mContentLayer.Add( radioGroupBackground );
198 198  
  199 + // Label
  200 + {
  201 + Toolkit::TextLabel label = Toolkit::TextLabel::New( LOGGER_TEXT );
  202 + label.SetParentOrigin( ParentOrigin::TOP_LEFT );
  203 + label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  204 + label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
  205 +
  206 + radioGroupBackground.Add( label );
  207 + }
  208 +
199 209 // Radio group
200 210 Actor radioButtonsGroup = Actor::New();
201 211 radioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT );
... ... @@ -419,6 +429,16 @@ class LoggingController: public ConnectionTracker
419 429 frequencyRadioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(groupHeight) );
420 430 mContentLayer.Add( frequencyRadioGroupBackground );
421 431  
  432 + // Label
  433 + {
  434 + Toolkit::TextLabel label = Toolkit::TextLabel::New( FREQUENCY_TEXT );
  435 + label.SetParentOrigin( ParentOrigin::TOP_LEFT );
  436 + label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  437 + label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
  438 +
  439 + frequencyRadioGroupBackground.Add( label );
  440 + }
  441 +
422 442 // Radio group
423 443 Actor frequencyRadioButtonsGroup = Actor::New();
424 444 frequencyRadioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT );
... ... @@ -514,7 +534,17 @@ class LoggingController: public ConnectionTracker
514 534  
515 535 void WriteConsole()
516 536 {
517   - // TODO
  537 + for( unsigned int i = 0; i < NUM_LOGGERS; ++i)
  538 + {
  539 + std::stringstream ss;
  540 + ss << (i + 1) << ") " << ((mPerformanceLoggers[i]) ? "Created" : "Deleted")
  541 + << ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped")
  542 + << ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled");
  543 +
  544 + Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( ss.str() );
  545 +
  546 + mLogRadioButtons[i].SetLabel( textLabel );
  547 + }
518 548 }
519 549  
520 550 bool LoggingRadioSelect( Toolkit::Button button )
... ...
examples/new-window/new-window-example.cpp
... ... @@ -80,6 +80,7 @@ public:
80 80 private:
81 81 Application mApplication;
82 82 Actor mCastingLight;
  83 + TextLabel mTextActor;
83 84 ImageActor mImageActor;
84 85 ImageActor mBlendActor;
85 86 Image mEffectImage;
... ... @@ -89,6 +90,7 @@ private:
89 90  
90 91 Toolkit::View mView; ///< The View instance.
91 92 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  93 + TextLabel mTitleActor; ///< The Toolbar's Title.
92 94 Layer mContentLayer; ///< Content layer (scrolling cluster content)
93 95 Toolkit::PushButton mLoseContextButton;
94 96 Vector3 mHSVDelta;
... ... @@ -174,6 +176,7 @@ void NewWindowController::Create( Application&amp; app )
174 176  
175 177 void NewWindowController::Destroy( Application& app )
176 178 {
  179 + UnparentAndReset(mTextActor);
177 180 }
178 181  
179 182 bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button )
... ... @@ -376,7 +379,11 @@ void NewWindowController::CreateBlending()
376 379  
377 380 void NewWindowController::CreateText()
378 381 {
379   - // TODO
  382 + mTextActor = TextLabel::New("Some text");
  383 + mTextActor.SetParentOrigin(ParentOrigin::CENTER);
  384 + mTextActor.SetColor(Color::RED);
  385 + mTextActor.SetName("PushMe text");
  386 + mContentLayer.Add( mTextActor );
380 387 }
381 388  
382 389 Mesh NewWindowController::CreateMesh(bool hasColor, Material material)
... ...
examples/path-animation/path-animation.cpp
... ... @@ -34,6 +34,7 @@ namespace
34 34 const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" );
35 35 const char* ACTOR_IMAGE( DALI_IMAGE_DIR "dali-logo.png" );
36 36 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
  37 +const char* APPLICATION_TITLE( "Path Animation Example" );
37 38 }; //Unnamed namespace
38 39  
39 40 /**
... ... @@ -63,7 +64,31 @@ public:
63 64 */
64 65 Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Slider,float) )
65 66 {
66   - return Actor();
  67 + TextLabel text = TextLabel::New(label);
  68 + text.SetColor( Vector4(0.0f,0.0f,0.0f,1.0f));
  69 +
  70 + Slider slider = Slider::New();
  71 + slider.SetRelayoutEnabled( false );
  72 + slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT);
  73 + slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT);
  74 + slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f );
  75 + slider.SetProperty(Slider::Property::UPPER_BOUND, 1.0f );
  76 +
  77 + Property::Array marks;
  78 + float mark = -1.0f;
  79 + for(unsigned short i(0); i<21; ++i )
  80 + {
  81 + marks.push_back( mark );
  82 + mark += 0.1f;
  83 + }
  84 +
  85 + slider.SetProperty(Slider::Property::MARKS, marks);
  86 + slider.SetProperty(Slider::Property::SNAP_TO_MARKS, true );
  87 + slider.SetSize(size);
  88 + slider.SetScale( 0.5f );
  89 + slider.ValueChangedSignal().Connect(this,callback);
  90 + text.Add( slider );
  91 + return text;
67 92 }
68 93  
69 94 /**
... ... @@ -351,6 +376,11 @@ public:
351 376 return true;
352 377 }
353 378  
  379 + /**
  380 + * Callback called when user changes slider Y
  381 + * @param[in] slider The slider that has generated the signal
  382 + * @param[in] value The new value
  383 + */
354 384 bool OnSliderYValueChange( Slider s, float value)
355 385 {
356 386 if( fabs( value ) - Math::MACHINE_EPSILON_1000 < 0.0f )
... ... @@ -366,7 +396,9 @@ public:
366 396 }
367 397  
368 398 /**
369   - * Create the path animation.
  399 + * Callback called when user changes slider Z
  400 + * @param[in] slider The slider that has generated the signal
  401 + * @param[in] value The new value
370 402 */
371 403 bool OnSliderZValueChange( Slider s, float value)
372 404 {
... ... @@ -422,6 +454,10 @@ public:
422 454  
423 455 mContentLayer.TouchedSignal().Connect(this, &PathController::OnTouchLayer);
424 456  
  457 + //Title
  458 + TextLabel title = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE );
  459 + toolBar.AddControl( title, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
  460 +
425 461 //Path
426 462 mPath = Dali::Path::New();
427 463 mPath.AddPoint( Vector3( 10.0f, stage.GetSize().y*0.5f, 0.0f ));
... ...
examples/scripting/launcher.cpp
... ... @@ -26,6 +26,7 @@
26 26  
27 27  
28 28 using namespace Dali;
  29 +using namespace Dali::Toolkit;
29 30  
30 31 #define TOKEN_STRING(x) #x
31 32  
... ... @@ -55,9 +56,19 @@ Launcher::~Launcher()
55 56  
56 57 void Launcher::Create( Dali::Application& application )
57 58 {
  59 + TextLabel textActor = TextLabel::New( "JSON & JavaScript Launcher..." );
  60 +
  61 + // Reposition the actor
  62 + textActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
  63 + textActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  64 + textActor.SetPosition( 20, 0 );
  65 +
58 66 // Get a handle to the stage
59 67 Stage stage = Stage::GetCurrent();
60 68  
  69 + // Display the actor on the stage
  70 + stage.Add( textActor );
  71 +
61 72 // change the background color to purple
62 73 Stage::GetCurrent().SetBackgroundColor( Vector4(0.2,0.2,0.4,1.0) );
63 74  
... ...
examples/scroll-view/scroll-view-example.cpp
... ... @@ -638,6 +638,14 @@ private:
638 638 */
639 639 void SetTitle(const std::string& title)
640 640 {
  641 + if(!mTitleActor)
  642 + {
  643 + mTitleActor = DemoHelper::CreateToolBarLabel( "" );
  644 + // Add title to the tool bar.
  645 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
  646 + }
  647 +
  648 + mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, title );
641 649 }
642 650  
643 651 /**
... ... @@ -659,6 +667,7 @@ private:
659 667 Application& mApplication; ///< Application instance
660 668 Toolkit::View mView; ///< The View instance.
661 669 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  670 + TextLabel mTitleActor; ///< The Toolbar's Title.
662 671 Layer mContentLayer; ///< The content layer (contains game actors)
663 672 ScrollView mScrollView; ///< ScrollView UI Component
664 673 bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary)
... ...
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
... ... @@ -32,10 +32,10 @@ namespace
32 32 const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" );
33 33 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
34 34  
35   -//const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" );
36   -//const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Pan Object" );
37   -//const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" );
38   -//const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" );
  35 +const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" );
  36 +const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Pan Object" );
  37 +const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" );
  38 +const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" );
39 39 const char* CHANGE_EFFECT_IMAGE( DALI_IMAGE_DIR "icon-change.png" );
40 40 const char* RESET_ICON( DALI_IMAGE_DIR "icon-reset.png" );
41 41  
... ... @@ -170,7 +170,11 @@ public:
170 170 toolBar.AddControl( effectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
171 171  
172 172 // Add title to the tool bar.
173   - // TODO
  173 + mTitleActor = DemoHelper::CreateToolBarLabel( "" );
  174 + toolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
  175 +
  176 + // Set Title text
  177 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) );
174 178  
175 179 //Add a reset button
176 180 Image resetImage = ResourceImage::New( RESET_ICON );
... ... @@ -239,9 +243,14 @@ public:
239 243 mCastingLight.SetAnchorPoint(AnchorPoint::CENTER);
240 244 mCastingLight.SetPosition( Vector3( 0.0f, 0.0f, 800.0f ) * scaleFactor );
241 245  
  246 + TextLabel text = TextLabel::New( "Light" );
  247 + text.SetColor( Color::BLUE );
  248 +
  249 + mCastingLight.Add(text);
242 250 mLightAnchor.Add(mCastingLight);
243 251 mShadowPlaneBg.Add(mLightAnchor);
244 252  
  253 + text.SetParentOrigin(ParentOrigin::CENTER);
245 254 mShadowView.SetPointLight(mCastingLight);
246 255 }
247 256  
... ... @@ -404,6 +413,28 @@ public:
404 413  
405 414 bool OnEffectButtonClicked( Toolkit::Button button )
406 415 {
  416 + switch(mPanState)
  417 + {
  418 + case PAN_SCENE:
  419 + mPanState = ROTATE_SCENE;
  420 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_SCENE) );
  421 + break;
  422 + case ROTATE_SCENE:
  423 + mPanState = PAN_LIGHT;
  424 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) );
  425 + break;
  426 + case PAN_LIGHT:
  427 + mPanState = PAN_OBJECT;
  428 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_OBJECT) );
  429 + break;
  430 + case PAN_OBJECT:
  431 + mPanState = PAN_SCENE;
  432 + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) );
  433 + break;
  434 + default:
  435 + break;
  436 + }
  437 +
407 438 return true;
408 439 }
409 440  
... ... @@ -453,6 +484,8 @@ private:
453 484 Property::Index mAngle1Index;
454 485 Property::Index mAngle3Index;
455 486  
  487 + Toolkit::TextLabel mTitleActor;
  488 +
456 489 enum PanState
457 490 {
458 491 PAN_SCENE,
... ...
examples/size-negotiation/size-negotiation-example.cpp
... ... @@ -21,6 +21,8 @@
21 21  
22 22 using namespace Dali;
23 23  
  24 +using Dali::Toolkit::TextLabel;
  25 +
24 26 // Define this so that it is interchangeable
25 27 // "DP" stands for Device independent Pixels
26 28 #define DP(x) DemoHelper::ScalePointSize(x)
... ... @@ -169,8 +171,7 @@ public:
169 171 TOOLBAR_IMAGE,
170 172 std::string("") );
171 173  
172   - mTitleActor = Dali::Toolkit::TextLabel::New(); // FIXME
173   - mTitleActor.SetName( "CUSTOM_TOOLBAR_TITLE" );
  174 + mTitleActor = DemoHelper::CreateToolBarLabel( "CUSTOM_TOOLBAR_TITLE" );
174 175  
175 176 SetTitle();
176 177  
... ... @@ -437,7 +438,15 @@ public:
437 438 {
438 439 mPopup = CreatePopup();
439 440  
440   - // FIXME - Add text
  441 + TextLabel text = TextLabel::New( CONTENT_TEXT );
  442 + text.SetName( "POPUP_CONTENT_TEXT" );
  443 + text.SetProperty( TextLabel::Property::MULTI_LINE, true );
  444 + text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  445 + text.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
  446 + text.SetResizePolicy( FILL_TO_PARENT, Dali::HEIGHT );
  447 + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  448 +
  449 + mPopup.Add( text );
441 450  
442 451 // The popup is not yet on the stage so needs to be flaged as dirty
443 452 mPopup.MarkDirtyForRelayout();
... ... @@ -521,7 +530,13 @@ public:
521 530 mPopup = CreatePopup();
522 531 mPopup.SetTitle( "Popup!" );
523 532  
524   - // FIXME - Add text
  533 + Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
  534 + text.SetName( "POPUP_CONTENT_TEXT" );
  535 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  536 + text.SetDimensionDependency( HEIGHT, WIDTH );
  537 + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  538 +
  539 + mPopup.Add( text );
525 540  
526 541 // The popup is not yet on the stage so needs to be flaged as dirty
527 542 mPopup.MarkDirtyForRelayout();
... ... @@ -533,7 +548,13 @@ public:
533 548 mPopup = CreatePopup();
534 549 mPopup.SetTitle( "Popup!" );
535 550  
536   - // FIXME - Add text
  551 + Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
  552 + text.SetName( "POPUP_CONTENT_TEXT" );
  553 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  554 + text.SetDimensionDependency( HEIGHT, WIDTH );
  555 + text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
  556 +
  557 + mPopup.Add( text );
537 558  
538 559 Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
539 560 cancelButton.SetName( CANCEL_BUTTON_ID );
... ... @@ -576,8 +597,9 @@ public:
576 597  
577 598 // Text
578 599 {
579   - Toolkit::TextLabel text = Toolkit::TextLabel::New();
580   - // FIXME
  600 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Do you really want to quit?" );
  601 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  602 + text.SetDimensionDependency( HEIGHT, WIDTH );
581 603  
582 604 content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
583 605 }
... ... @@ -612,7 +634,6 @@ public:
612 634 root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
613 635  
614 636 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Don't show again" );
615   - // FIXME
616 637 Actor textActor = text;
617 638 textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
618 639  
... ...
shared/view.h
... ... @@ -97,12 +97,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar,
97 97 {
98 98 Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New();
99 99 label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT );
100   - label.SetSize( stage.GetSize().width, style.mToolBarHeight );
101 100 label.SetDrawMode( Dali::DrawMode::OVERLAY );
102 101 label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" );
103 102 label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title );
104 103 label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
105 104 label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
  105 + label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT );
106 106 label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
107 107 toolBarLayer.Add( label );
108 108 }
... ... @@ -160,6 +160,19 @@ Dali::Layer CreateView( Dali::Application&amp; application,
160 160 return contentLayer;
161 161 }
162 162  
  163 +Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text )
  164 +{
  165 + Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New( text );
  166 + label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" );
  167 + label.SetDrawMode( Dali::DrawMode::OVERLAY );
  168 + label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  169 + label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
  170 + label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT );
  171 + label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
  172 +
  173 + return label;
  174 +}
  175 +
163 176 } // DemoHelper
164 177  
165 178 #endif // __DALI_DEMO_HELPER_VIEW_H__
... ...