Replace TextView with TextLabel 02/37602/9
authorPaul Wisbey <p.wisbey@samsung.com>
Tue, 31 Mar 2015 17:19:09 +0000 (18:19 +0100)
committerPaul Wisbey <p.wisbey@samsung.com>
Wed, 1 Apr 2015 12:39:23 +0000 (13:39 +0100)
Change-Id: I5932f0191f358e986fcaace820fb2ecb43b9812b

16 files changed:
demo/dali-table-view.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/new-window/new-window-example.cpp
examples/path-animation/path-animation.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
shared/view.h

index 928b5e8..5d4610b 100644 (file)
@@ -530,6 +530,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit
   label.SetProperty( TextLabel::Property::TEXT, title );
   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
   label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+  label.SetResizePolicy( FILL_TO_PARENT, HEIGHT );
   label.SetColor( TABLE_TEXT_STYLE_COLOR );
   content.Add( label );
 
index bc5f16a..2fb6fda 100644 (file)
@@ -241,7 +241,14 @@ public:
 
   void SetTitle(const std::string& title)
   {
-    // TODO
+    if(!mTitleActor)
+    {
+      mTitleActor = TextLabel::New();
+      // Add title to the tool bar.
+      mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
+    }
+
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
   }
 
   bool OnToolSelectLayout( Toolkit::Button button )
@@ -386,7 +393,18 @@ public:
 
   Actor MenuItem(const std::string& text)
   {
-    return Actor();
+    int size = static_cast<int>(DemoHelper::ScalePointSize(6));
+
+    std::ostringstream fontString;
+    fontString << "<font size="<< size <<">"<<  ShortName( text ) << "</font>";
+
+    TextLabel label = TextLabel::New( fontString.str() );
+    label.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+
+    // Hook up tap detector
+    mTapDetector.Attach( label );
+
+    return label;
   }
 
   bool OnTimer()
@@ -579,6 +597,7 @@ private:
   unsigned int mOrientation;
 
   Toolkit::ToolBar mToolBar;
+  TextLabel mTitleActor;             ///< The Toolbar's Title.
 
   Layer mBuilderLayer;
 
index df4cfa1..ad35087 100644 (file)
@@ -238,6 +238,9 @@ class ButtonsController: public ConnectionTracker
       tableView.SetPreferredSize( Vector2( DP(260), 0.0f ) );
       tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
 
+      Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( "Select enabled" );
+      tableView.AddChild( textLabel, Toolkit::TableView::CellPosition( 0, 0 ) );
+
       ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) );
       imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
       imageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
@@ -421,6 +424,42 @@ class ButtonsController: public ConnectionTracker
 
   bool OnCheckBoxesSelected( Toolkit::Button button )
   {
+    if( button.GetName() == "checkbox1" )
+    {
+      if( button.IsSelected() )
+      {
+        button.SetLabel("CheckBox1 is selected");
+      }
+      else
+      {
+        button.SetLabel("CheckBox1 is unselected");
+      }
+    }
+
+    if( button.GetName() == "checkbox2" )
+    {
+      if( button.IsSelected() )
+      {
+        button.SetLabel("CheckBox2 is selected");
+      }
+      else
+      {
+        button.SetLabel("CheckBox2 is unselected");
+      }
+    }
+
+    if( button.GetName() == "checkbox3" )
+    {
+      if( button.IsSelected() )
+      {
+        button.SetLabel("CheckBox3 is selected");
+      }
+      else
+      {
+        button.SetLabel("CheckBox3 is unselected");
+      }
+    }
+
     return true;
   }
 
index fcbe721..8dce935 100644 (file)
@@ -825,7 +825,15 @@ public:
    */
   void SetTitle(const std::string& title)
   {
-    // TODO
+    if(!mTitleActor)
+    {
+      mTitleActor = DemoHelper::CreateToolBarLabel( "" );
+
+      // Add title to the tool bar.
+      mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
+    }
+
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
   }
 
   /**
@@ -847,6 +855,7 @@ private:
   Application&               mApplication;                       ///< Application instance
   Toolkit::View              mView;                              ///< The View instance.
   Toolkit::ToolBar           mToolBar;                           ///< The View's Toolbar.
+  TextLabel                   mTitleActor;                        ///< The Toolbar's Title.
 
   Layer                      mContentLayer;                      ///< Content layer (scrolling cluster content)
 
index 6bcbd83..219f659 100644 (file)
@@ -26,6 +26,8 @@
 
 using namespace Dali;
 
+using Dali::Toolkit::TextLabel;
+
 // LOCAL STUFF
 namespace
 {
@@ -173,6 +175,7 @@ private:
   Toolkit::View                   mView;
   Toolkit::ToolBar                mToolBar;
   Layer                           mContent;
+  Toolkit::TextLabel              mTitleActor;
   Actor                           mParent;
 
   Vector2                         mViewSize;
@@ -235,6 +238,10 @@ void CubeTransitionApp::OnInit( Application& application )
   mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
   mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
 
+  // Add title to the tool bar.
+  mTitleActor = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_WAVE );
+  mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
+
   //Add an slideshow icon on the right of the title
   mIconSlideshowStart = ResourceImage::New( SLIDE_SHOW_START_ICON );
   mIconSlideshowStop = ResourceImage::New( SLIDE_SHOW_STOP_ICON );
@@ -351,17 +358,20 @@ bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button )
   if(mCurrentEffect == mCubeWaveEffect)
   {
     mCurrentEffect = mCubeCrossEffect;
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) );
     mEffectChangeButton.SetBackgroundImage(mImageCross);
 
   }
   else if(mCurrentEffect == mCubeCrossEffect)
   {
     mCurrentEffect = mCubeFoldEffect;
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) );
     mEffectChangeButton.SetBackgroundImage(mImageFold);
   }
   else
   {
     mCurrentEffect = mCubeWaveEffect;
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) );
     mEffectChangeButton.SetBackgroundImage(mImageWave);
   }
 
index 3bd1dc7..6108f2b 100644 (file)
@@ -26,6 +26,8 @@
 
 using namespace Dali;
 
+using Dali::Toolkit::TextLabel;
+
 // LOCAL STUFF
 namespace
 {
@@ -157,6 +159,7 @@ private:
   Toolkit::View                   mView;
   Toolkit::ToolBar                mToolBar;
   Layer                           mContent;
+  Toolkit::TextLabel              mTitleActor;
   Actor                           mParent;
 
   ImageActor                      mCurrentImage;
@@ -219,7 +222,8 @@ void DissolveEffectApp::OnInit( Application& application )
   mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
 
   // Add title to the tool bar.
-  // TODO
+  mTitleActor = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_HIGHP );
+  mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
 
   // Add an slide-show button on the right of the title
   mIconPlay = ResourceImage::New( PLAY_ICON );
@@ -335,6 +339,7 @@ bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button )
   mCurrentImageEffect = Toolkit::DissolveEffect::New(mUseHighPrecision);
   if(mUseHighPrecision)
   {
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) );
     mEffectChangeButton.SetBackgroundImage(mIconHighP);
   }
   else
index 709e17a..09de0e5 100644 (file)
@@ -537,7 +537,12 @@ public:
    */
   void SetTitle(const std::string& title)
   {
-    // TODO
+    if(!mTitleActor)
+    {
+      mTitleActor = TextLabel::New();
+      // Add title to the tool bar.
+      mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
+    }
   }
 
   /**
@@ -566,6 +571,7 @@ private:
   Layer mContentLayer;                ///< The content layer (contains non gui chrome actors)
   Toolkit::View mView;                ///< The View instance.
   Toolkit::ToolBar mToolBar;          ///< The View's Toolbar.
+  TextLabel mTitleActor;               ///< The Toolbar's Title.
   Actor mGridActor;                   ///< The container for the grid of images
   ScrollView mScrollView;             ///< ScrollView UI Component
   bool mScrolling;                    ///< ScrollView scrolling state (true = scrolling, false = stationary)
index 4c82499..3893c48 100644 (file)
@@ -109,9 +109,9 @@ AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear,
 
 const unsigned int NUM_ALPHA_FUNCTIONS = sizeof(ALPHA_FUNCTIONS) / sizeof(AlphaFunction);
 
-//const char* ALPHA_FUNCTIONS_TEXT[] = { "Linear",
-//                                       "EaseIn",
-//                                       "EaseOut" };
+const char* ALPHA_FUNCTIONS_TEXT[] = { "Linear",
+                                       "EaseIn",
+                                       "EaseOut" };
 
 const char* BACKGROUND_IMAGE( "" );
 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
@@ -160,10 +160,6 @@ const float BUTTON_BORDER = -10.0f;
 const float MENU_OPTION_HEIGHT(140.0f);
 const float LABEL_TEXT_SIZE_Y = 20.0f;
 
-//const char*             DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue");
-//const char*             DEFAULT_TEXT_STYLE_FONT_STYLE("Regular");
-//const Vector4           DEFAULT_TEXT_STYLE_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
-
 const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f );
 
 static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth)
@@ -972,7 +968,12 @@ private:
    */
   void SetTitle(const std::string& title)
   {
-    // TODO
+    if(!mTitleActor)
+    {
+      mTitleActor = TextLabel::New();
+      // Add title to the tool bar.
+      mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
+    }
   }
 
   void ShowMenu()
@@ -1001,6 +1002,36 @@ private:
     slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );
     tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );
 
+    TextLabel text = TextLabel::New( "Duration" );
+    text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
+    text.SetParentOrigin( ParentOrigin::TOP_LEFT );
+    text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+    text.SetResizePolicy( FIXED, HEIGHT );
+    text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
+    slider.Add( text );
+
+    Actor textContainer = Actor::New();
+    textContainer.SetRelayoutEnabled( true );
+    textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
+    mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER );
+    mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER );
+    textContainer.Add( mAlphaFunctionText );
+    tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) );
+
+    mTapDetector = TapGestureDetector::New();
+    mTapDetector.Attach(mAlphaFunctionText);
+    mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ChangeAlphaFunctionOnTap );
+
+    text = TextLabel::New( "Alpha Function" );
+    text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
+    text.SetParentOrigin( ParentOrigin::TOP_LEFT );
+    text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+    text.SetResizePolicy( FIXED, HEIGHT );
+    text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
+    textContainer.Add( text );
+
+    mMenu.MarkDirtyForRelayout();
     mMenu.Show();
     mMenuShown = true;
   }
@@ -1019,6 +1050,11 @@ private:
       mAlphaFuncIndex = 0;
     }
 
+    if( mAlphaFunctionText )
+    {
+      mAlphaFunctionText.SetProperty( TextLabel::Property::TEXT, std::string(ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex]) );
+    }
+
     if( mItemView )
     {
       mItemView.GetActiveLayout()->SetAlphaFunction( ALPHA_FUNCTIONS[mAlphaFuncIndex] );
@@ -1080,6 +1116,7 @@ private:
   unsigned int mOrientation;
 
   Toolkit::ToolBar mToolBar;
+  TextLabel mTitleActor;             ///< The Toolbar's Title.
 
   ItemView mItemView;
   Image mBorderImage;
@@ -1100,6 +1137,7 @@ private:
   Toolkit::PushButton mReplaceButton;
 
   unsigned int mAlphaFuncIndex;
+  TextLabel mAlphaFunctionText;
   BufferImage mWhiteImage;
 };
 
index 17cf63f..889621a 100644 (file)
@@ -196,6 +196,16 @@ class LoggingController: public ConnectionTracker
     radioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_RADIO_GROUP_HEIGHT) );
     mContentLayer.Add( radioGroupBackground );
 
+    // Label
+    {
+      Toolkit::TextLabel label = Toolkit::TextLabel::New( LOGGER_TEXT );
+      label.SetParentOrigin( ParentOrigin::TOP_LEFT );
+      label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+      label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
+
+      radioGroupBackground.Add( label );
+    }
+
     // Radio group
     Actor radioButtonsGroup = Actor::New();
     radioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT );
@@ -419,6 +429,16 @@ class LoggingController: public ConnectionTracker
     frequencyRadioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(groupHeight) );
     mContentLayer.Add( frequencyRadioGroupBackground );
 
+    // Label
+    {
+      Toolkit::TextLabel label = Toolkit::TextLabel::New( FREQUENCY_TEXT );
+      label.SetParentOrigin( ParentOrigin::TOP_LEFT );
+      label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+      label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
+
+      frequencyRadioGroupBackground.Add( label );
+    }
+
     // Radio group
     Actor frequencyRadioButtonsGroup = Actor::New();
     frequencyRadioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT );
@@ -514,7 +534,17 @@ class LoggingController: public ConnectionTracker
 
   void WriteConsole()
   {
-    // TODO
+    for( unsigned int i = 0; i < NUM_LOGGERS; ++i)
+    {
+      std::stringstream ss;
+      ss << (i + 1) << ") " << ((mPerformanceLoggers[i]) ? "Created" : "Deleted")
+         << ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped")
+         << ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled");
+
+      Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( ss.str() );
+
+      mLogRadioButtons[i].SetLabel( textLabel );
+    }
   }
 
   bool LoggingRadioSelect( Toolkit::Button button )
index 172da82..39b0db2 100644 (file)
@@ -80,6 +80,7 @@ public:
 private:
   Application                mApplication;
   Actor                      mCastingLight;
+  TextLabel                  mTextActor;
   ImageActor                 mImageActor;
   ImageActor                 mBlendActor;
   Image                      mEffectImage;
@@ -89,6 +90,7 @@ private:
 
   Toolkit::View              mView;                              ///< The View instance.
   Toolkit::ToolBar           mToolBar;                           ///< The View's Toolbar.
+  TextLabel                   mTitleActor;                        ///< The Toolbar's Title.
   Layer                      mContentLayer;                      ///< Content layer (scrolling cluster content)
   Toolkit::PushButton        mLoseContextButton;
   Vector3                    mHSVDelta;
@@ -174,6 +176,7 @@ void NewWindowController::Create( Application& app )
 
 void NewWindowController::Destroy( Application& app )
 {
+  UnparentAndReset(mTextActor);
 }
 
 bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button )
@@ -376,7 +379,11 @@ void NewWindowController::CreateBlending()
 
 void NewWindowController::CreateText()
 {
-  // TODO
+  mTextActor = TextLabel::New("Some text");
+  mTextActor.SetParentOrigin(ParentOrigin::CENTER);
+  mTextActor.SetColor(Color::RED);
+  mTextActor.SetName("PushMe text");
+  mContentLayer.Add( mTextActor );
 }
 
 Mesh NewWindowController::CreateMesh(bool hasColor, Material material)
index fc48484..5ee4f0a 100644 (file)
@@ -34,6 +34,7 @@ namespace
 const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" );
 const char* ACTOR_IMAGE( DALI_IMAGE_DIR "dali-logo.png" );
 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
+const char* APPLICATION_TITLE( "Path Animation Example" );
 }; //Unnamed namespace
 
 /**
@@ -63,7 +64,31 @@ public:
   */
   Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Slider,float) )
   {
-    return Actor();
+    TextLabel text = TextLabel::New(label);
+    text.SetColor( Vector4(0.0f,0.0f,0.0f,1.0f));
+
+    Slider slider = Slider::New();
+    slider.SetRelayoutEnabled( false );
+    slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT);
+    slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT);
+    slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f );
+    slider.SetProperty(Slider::Property::UPPER_BOUND, 1.0f );
+
+    Property::Array marks;
+    float mark = -1.0f;
+    for(unsigned short i(0); i<21; ++i )
+    {
+      marks.push_back( mark );
+      mark += 0.1f;
+    }
+
+    slider.SetProperty(Slider::Property::MARKS, marks);
+    slider.SetProperty(Slider::Property::SNAP_TO_MARKS, true );
+    slider.SetSize(size);
+    slider.SetScale( 0.5f );
+    slider.ValueChangedSignal().Connect(this,callback);
+    text.Add( slider );
+    return text;
   }
 
   /**
@@ -351,6 +376,11 @@ public:
     return true;
   }
 
+  /**
+   * Callback called when user changes slider Y
+   * @param[in] slider The slider that has generated the signal
+   * @param[in] value The new value
+   */
   bool OnSliderYValueChange( Slider s, float value)
   {
     if( fabs( value ) - Math::MACHINE_EPSILON_1000 < 0.0f )
@@ -366,7 +396,9 @@ public:
   }
 
   /**
-   * Create the path animation.
+   * Callback called when user changes slider Z
+   * @param[in] slider The slider that has generated the signal
+   * @param[in] value The new value
    */
   bool OnSliderZValueChange( Slider s, float value)
   {
@@ -422,6 +454,10 @@ public:
 
     mContentLayer.TouchedSignal().Connect(this, &PathController::OnTouchLayer);
 
+    //Title
+    TextLabel title = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE );
+    toolBar.AddControl( title, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
+
     //Path
     mPath = Dali::Path::New();
     mPath.AddPoint( Vector3( 10.0f, stage.GetSize().y*0.5f, 0.0f ));
index 2d31d2d..3106aec 100644 (file)
@@ -26,6 +26,7 @@
 
 
 using namespace Dali;
+using namespace Dali::Toolkit;
 
 #define TOKEN_STRING(x) #x
 
@@ -55,9 +56,19 @@ Launcher::~Launcher()
 
 void Launcher::Create( Dali::Application& application )
 {
+  TextLabel textActor = TextLabel::New( "JSON & JavaScript Launcher..." );
+
+  // Reposition the actor
+  textActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  textActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  textActor.SetPosition( 20, 0 );
+
   // Get a handle to the stage
   Stage stage = Stage::GetCurrent();
 
+  // Display the actor on the stage
+  stage.Add( textActor );
+
   // change the background color to purple
   Stage::GetCurrent().SetBackgroundColor( Vector4(0.2,0.2,0.4,1.0) );
 
index b48dd8f..a1743c3 100644 (file)
@@ -638,6 +638,14 @@ private:
    */
   void SetTitle(const std::string& title)
   {
+    if(!mTitleActor)
+    {
+      mTitleActor = DemoHelper::CreateToolBarLabel( "" );
+      // Add title to the tool bar.
+      mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
+    }
+
+    mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, title );
   }
 
   /**
@@ -659,6 +667,7 @@ private:
   Application& mApplication;                            ///< Application instance
   Toolkit::View mView;                                  ///< The View instance.
   Toolkit::ToolBar mToolBar;                            ///< The View's Toolbar.
+  TextLabel mTitleActor;                                ///< The Toolbar's Title.
   Layer mContentLayer;                                  ///< The content layer (contains game actors)
   ScrollView mScrollView;                               ///< ScrollView UI Component
   bool mScrolling;                                      ///< ScrollView scrolling state (true = scrolling, false = stationary)
index 64e6e95..9d42d68 100644 (file)
@@ -32,10 +32,10 @@ namespace
 const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" );
 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
 
-//const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" );
-//const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Pan Object" );
-//const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" );
-//const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" );
+const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" );
+const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Pan Object" );
+const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" );
+const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" );
 const char* CHANGE_EFFECT_IMAGE( DALI_IMAGE_DIR "icon-change.png" );
 const char* RESET_ICON( DALI_IMAGE_DIR "icon-reset.png" );
 
@@ -170,7 +170,11 @@ public:
     toolBar.AddControl( effectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
 
     // Add title to the tool bar.
-    // TODO
+    mTitleActor = DemoHelper::CreateToolBarLabel( "" );
+    toolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
+
+    // Set Title text
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) );
 
     //Add a reset button
     Image resetImage = ResourceImage::New( RESET_ICON );
@@ -239,9 +243,14 @@ public:
     mCastingLight.SetAnchorPoint(AnchorPoint::CENTER);
     mCastingLight.SetPosition( Vector3( 0.0f, 0.0f, 800.0f ) * scaleFactor );
 
+    TextLabel text = TextLabel::New( "Light" );
+    text.SetColor( Color::BLUE );
+
+    mCastingLight.Add(text);
     mLightAnchor.Add(mCastingLight);
     mShadowPlaneBg.Add(mLightAnchor);
 
+    text.SetParentOrigin(ParentOrigin::CENTER);
     mShadowView.SetPointLight(mCastingLight);
   }
 
@@ -404,6 +413,28 @@ public:
 
   bool OnEffectButtonClicked( Toolkit::Button button )
   {
+    switch(mPanState)
+    {
+      case PAN_SCENE:
+        mPanState = ROTATE_SCENE;
+        mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_SCENE) );
+        break;
+      case ROTATE_SCENE:
+        mPanState = PAN_LIGHT;
+        mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) );
+        break;
+      case PAN_LIGHT:
+        mPanState = PAN_OBJECT;
+        mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_OBJECT) );
+        break;
+      case PAN_OBJECT:
+        mPanState = PAN_SCENE;
+        mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) );
+        break;
+      default:
+        break;
+    }
+
     return true;
   }
 
@@ -453,6 +484,8 @@ private:
   Property::Index           mAngle1Index;
   Property::Index           mAngle3Index;
 
+  Toolkit::TextLabel         mTitleActor;
+
   enum PanState
   {
     PAN_SCENE,
index 41b6f29..8a35da7 100644 (file)
@@ -21,6 +21,8 @@
 
 using namespace Dali;
 
+using Dali::Toolkit::TextLabel;
+
 // Define this so that it is interchangeable
 // "DP" stands for Device independent Pixels
 #define DP(x) DemoHelper::ScalePointSize(x)
@@ -169,8 +171,7 @@ public:
                                             TOOLBAR_IMAGE,
                                             std::string("") );
 
-    mTitleActor = Dali::Toolkit::TextLabel::New(); // FIXME
-    mTitleActor.SetName( "CUSTOM_TOOLBAR_TITLE" );
+    mTitleActor = DemoHelper::CreateToolBarLabel( "CUSTOM_TOOLBAR_TITLE" );
 
     SetTitle();
 
@@ -437,7 +438,15 @@ public:
     {
       mPopup = CreatePopup();
 
-      // FIXME - Add text
+      TextLabel text = TextLabel::New( CONTENT_TEXT );
+      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetProperty( TextLabel::Property::MULTI_LINE, true );
+      text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+      text.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+      text.SetResizePolicy( FILL_TO_PARENT, Dali::HEIGHT );
+      text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+
+      mPopup.Add( text );
 
       // The popup is not yet on the stage so needs to be flaged as dirty
       mPopup.MarkDirtyForRelayout();
@@ -521,7 +530,13 @@ public:
       mPopup = CreatePopup();
       mPopup.SetTitle( "Popup!" );
 
-      // FIXME - Add text
+      Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
+      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+      text.SetDimensionDependency( HEIGHT, WIDTH );
+      text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+
+      mPopup.Add( text );
 
       // The popup is not yet on the stage so needs to be flaged as dirty
       mPopup.MarkDirtyForRelayout();
@@ -533,7 +548,13 @@ public:
       mPopup = CreatePopup();
       mPopup.SetTitle( "Popup!" );
 
-      // FIXME - Add text
+      Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
+      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+      text.SetDimensionDependency( HEIGHT, WIDTH );
+      text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
+
+      mPopup.Add( text );
 
       Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
       cancelButton.SetName( CANCEL_BUTTON_ID );
@@ -576,8 +597,9 @@ public:
 
       // Text
       {
-        Toolkit::TextLabel text = Toolkit::TextLabel::New();
-        // FIXME
+        Toolkit::TextLabel text = Toolkit::TextLabel::New( "Do you really want to quit?" );
+        text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+        text.SetDimensionDependency( HEIGHT, WIDTH );
 
         content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
       }
@@ -612,7 +634,6 @@ public:
         root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
 
         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Don't show again" );
-        // FIXME
         Actor textActor = text;
         textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
 
index f0e9ca1..53c4218 100644 (file)
@@ -97,12 +97,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar,
   {
     Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New();
     label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT );
-    label.SetSize( stage.GetSize().width, style.mToolBarHeight );
     label.SetDrawMode( Dali::DrawMode::OVERLAY );
     label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" );
     label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title );
     label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
     label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+    label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT );
     label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
     toolBarLayer.Add( label );
   }
@@ -160,6 +160,19 @@ Dali::Layer CreateView( Dali::Application& application,
   return contentLayer;
 }
 
+Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text )
+{
+  Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New( text );
+  label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" );
+  label.SetDrawMode( Dali::DrawMode::OVERLAY );
+  label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+  label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+  label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT );
+  label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
+
+  return label;
+}
+
 } // DemoHelper
 
 #endif // __DALI_DEMO_HELPER_VIEW_H__