Update demos to not use deprecated Button API 30/117030/3
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Thu, 2 Mar 2017 10:24:03 +0000 (10:24 +0000)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Mon, 6 Mar 2017 12:06:05 +0000 (04:06 -0800)
Change-Id: Iaf8e17feb02567a92f2ff83a050e8bc6652212a0

examples/video-view/video-view-example.cpp
examples/visual-transitions/transition-application.cpp

index 371c7a5..b13df4e 100644 (file)
@@ -143,13 +143,13 @@ class VideoViewController: public ConnectionTracker
     mMenu.Add( mForwardButton );
 
     mPauseButton.SetVisible( false );
-    mPauseButton.SetDisabled( true );
+    mPauseButton.SetProperty( Button::Property::DISABLED, true );
     mPlayButton.SetVisible( true );
-    mPlayButton.SetDisabled( false );
+    mPlayButton.SetProperty( Button::Property::DISABLED, false );
     mStopButton.SetVisible( true );
-    mStopButton.SetDisabled( false );
+    mStopButton.SetProperty( Button::Property::DISABLED, false );
     mResetButton.SetVisible( false );
-    mResetButton.SetDisabled( true );
+    mResetButton.SetProperty( Button::Property::DISABLED, true );
 
     mPlayButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_IMAGE );
     mPlayButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_IMAGE );
@@ -198,9 +198,9 @@ class VideoViewController: public ConnectionTracker
        if( mIsPlay )
       {
         mPauseButton.SetVisible( false );
-        mPauseButton.SetDisabled( true );
+        mPauseButton.SetProperty( Button::Property::DISABLED, true );
         mPlayButton.SetVisible( true );
-        mPlayButton.SetDisabled( false );
+        mPlayButton.SetProperty( Button::Property::DISABLED, false );
 
         mIsPlay = false;
         mVideoView.Pause();
@@ -214,9 +214,9 @@ class VideoViewController: public ConnectionTracker
       }
 
       mPauseButton.SetVisible( true );
-      mPauseButton.SetDisabled( false );
+      mPauseButton.SetProperty( Button::Property::DISABLED, false );
       mPlayButton.SetVisible( false );
-      mPlayButton.SetDisabled( true );
+      mPlayButton.SetProperty( Button::Property::DISABLED, true );
 
       mIsPlay = true;
       mVideoView.Play();
@@ -226,13 +226,13 @@ class VideoViewController: public ConnectionTracker
       if( mIsStop )
       {
         mPauseButton.SetVisible( true );
-        mPauseButton.SetDisabled( false );
+        mPauseButton.SetProperty( Button::Property::DISABLED, false );
         mPlayButton.SetVisible( false );
-        mPlayButton.SetDisabled( true );
+        mPlayButton.SetProperty( Button::Property::DISABLED, true );
         mResetButton.SetVisible( false );
-        mResetButton.SetDisabled( true );
+        mResetButton.SetProperty( Button::Property::DISABLED, true );
         mStopButton.SetVisible( true );
-        mStopButton.SetDisabled( false );
+        mStopButton.SetProperty( Button::Property::DISABLED, false );
 
         mIsStop = false;
         mIsPlay = true;
@@ -243,13 +243,13 @@ class VideoViewController: public ConnectionTracker
     else if( mStopButton.GetId() == button.GetId())
     {
       mPauseButton.SetVisible( false );
-      mPauseButton.SetDisabled( true );
+      mPauseButton.SetProperty( Button::Property::DISABLED, true );
       mPlayButton.SetVisible( true );
-      mPlayButton.SetDisabled( false );
+      mPlayButton.SetProperty( Button::Property::DISABLED, false );
       mResetButton.SetVisible( true );
-      mResetButton.SetDisabled( false );
+      mPlayButton.SetProperty( Button::Property::DISABLED, false );
       mStopButton.SetVisible( false );
-      mStopButton.SetDisabled( true );
+      mStopButton.SetProperty( Button::Property::DISABLED, true );
 
       mIsStop = true;
       mVideoView.Stop();
index fcb7c00..7094d14 100644 (file)
 using namespace Dali;
 using namespace Dali::Toolkit;
 
+namespace
+{
+
+void SetLabelText( Button button, const char* label )
+{
+  button.SetProperty( Toolkit::Button::Property::LABEL, label );
+}
+
+}
+
 namespace Demo
 {
 
@@ -43,7 +53,6 @@ const char* DALI_LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" );
 const char* DALI_ROBOT_MODEL_PATH( DEMO_MODEL_DIR "ToyRobot-Metal.obj" );
 const char* DALI_ROBOT_MATERIAL_PATH( DEMO_MODEL_DIR "ToyRobot-Metal.mtl" );
 
-
 TransitionApplication::TransitionApplication( Application& application )
 : mApplication( application ),
   mTitle(),
@@ -151,10 +160,11 @@ void TransitionApplication::Create( Application& application )
     mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked );
     actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) );
   }
-  mActionButtons[0].SetLabelText( "Bounce" );
-  mActionButtons[1].SetLabelText( "X" );
-  mActionButtons[2].SetLabelText( "Y" );
-  mActionButtons[3].SetLabelText( "Fade" );
+
+  SetLabelText( mActionButtons[0], "Bounce" );
+  SetLabelText( mActionButtons[1], "X" );
+  SetLabelText( mActionButtons[2], "Y" );
+  SetLabelText( mActionButtons[3], "Fade" );
 
   contentLayout.Add( actionButtonLayout );
   contentLayout.SetFitHeight(3);