Removed OnButton virtual functions and simplified RadioButton logic 94/98194/13
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Tue, 15 Nov 2016 16:54:49 +0000 (16:54 +0000)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Tue, 13 Dec 2016 13:20:49 +0000 (13:20 +0000)
OnButtonUp replaced with ToggleReleased, allows RadioButton to override part of OnButtonUp behaviour, still sends signals.
Comments updated after review comments.
Remove unused code including Virtual internal functions from Buttons

Change-Id: Ia0937aedd01405d1b66265e4f8bdbf613c98dd0a

automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.h
dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
dali-toolkit/internal/controls/buttons/check-box-button-impl.h
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.h
dali-toolkit/internal/controls/buttons/radio-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.h
dali-toolkit/public-api/controls/buttons/button.h

index 235d8ab..031e997 100644 (file)
@@ -1077,7 +1077,6 @@ int UtcDaliPushButtonSetSelectedVisualN(void)
   const int BROKEN_VISUAL_TYPE = 999999999;
 
   colorMap.Insert(Visual::Property::TYPE,  BROKEN_VISUAL_TYPE);
   const int BROKEN_VISUAL_TYPE = 999999999;
 
   colorMap.Insert(Visual::Property::TYPE,  BROKEN_VISUAL_TYPE);
-  //colorMap.Insert(Visual::Property::TYPE,  Visual::COLOR);
   colorMap.Insert(BorderVisual::Property::COLOR,  Color::BLUE);
   colorMap.Insert(BorderVisual::Property::SIZE,  5.f);
   pushButton.SetProperty( Toolkit::Button::Property::UNSELECTED_VISUAL, colorMap );
   colorMap.Insert(BorderVisual::Property::COLOR,  Color::BLUE);
   colorMap.Insert(BorderVisual::Property::SIZE,  5.f);
   pushButton.SetProperty( Toolkit::Button::Property::UNSELECTED_VISUAL, colorMap );
index 53f89ca..61a5705 100644 (file)
@@ -87,7 +87,6 @@ DALI_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedBackgroundVisual",
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedBackgroundVisual",           MAP,     SELECTED_BACKGROUND_VISUAL            )
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedBackgroundVisual", MAP,     DISABLED_UNSELECTED_BACKGROUND_VISUAL )
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedBackgroundVisual",   MAP,     DISABLED_SELECTED_BACKGROUND_VISUAL   )
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedBackgroundVisual",           MAP,     SELECTED_BACKGROUND_VISUAL            )
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedBackgroundVisual", MAP,     DISABLED_UNSELECTED_BACKGROUND_VISUAL )
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedBackgroundVisual",   MAP,     DISABLED_SELECTED_BACKGROUND_VISUAL   )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "labelStrutLength",                   INTEGER, LABEL_STRUT_LENGTH                    )
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "labelRelativeAlignment",             STRING,  LABEL_RELATIVE_ALIGNMENT              )
 
 // Signals:
 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "labelRelativeAlignment",             STRING,  LABEL_RELATIVE_ALIGNMENT              )
 
 // Signals:
@@ -131,7 +130,6 @@ const Property::Index GET_VISUAL_INDEX_FOR_STATE[][Button::STATE_COUNT] =
 Button::Button()
 : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
   mAutoRepeatingTimer(),
 Button::Button()
 : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
   mAutoRepeatingTimer(),
-  mForeGroundToLabelStrutLength( 0.0f ),
   mTextLabelAlignment( END ),
   mAutoRepeating( false ),
   mTogglableButton( false ),
   mTextLabelAlignment( END ),
   mAutoRepeating( false ),
   mTogglableButton( false ),
@@ -280,8 +278,10 @@ bool Button::ValidateState( State requestedState )
 
 void Button::PerformFunctionOnVisualsInState( void(Button::*functionPtr)( Property::Index visualIndex), State state )
 {
 
 void Button::PerformFunctionOnVisualsInState( void(Button::*functionPtr)( Property::Index visualIndex), State state )
 {
-  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::PerformFunctionOnVisualsInState BACKROUND visual(%d) for state (%d)\n", GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND], state );
-  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::PerformFunctionOnVisualsInState FOREGROUND visuals(%d)  for state (%d)\n", GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND], state );
+  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::PerformFunctionOnVisualsInState BACKROUND visual(%d) for state (%d)\n",
+                 GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND], state );
+  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::PerformFunctionOnVisualsInState FOREGROUND visuals(%d)  for state (%d)\n",
+                 GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND], state );
 
   (this->*functionPtr)( GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND] );
   (this->*functionPtr)( GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND] );
 
   (this->*functionPtr)( GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND] );
   (this->*functionPtr)( GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND] );
@@ -306,13 +306,9 @@ void Button::ChangeState( State requestedState )
 
   if ( Self().OnStage() )
   {
 
   if ( Self().OnStage() )
   {
-    // Clear existing animation and remove visual being transitioned out before starting a new transition of visuals. ClearTransitionAnimation();
     OnStateChange( mButtonState ); // Notify derived buttons
     OnStateChange( mButtonState ); // Notify derived buttons
-    //// When animations enabled PerformFunctionOnVisualsInState( &Button::TransitionButtonVisualOut, mPreviousButtonState );
     PerformFunctionOnVisualsInState( &Button::SelectRequiredVisual, mButtonState );
     PerformFunctionOnVisualsInState( &Button::SelectRequiredVisual, mButtonState );
-    // When animations enabled then call PerformFunctionOnVisualsInState( &Button::TransitionButtonVisualIn, mButtonState );
-    // then StartTransitionAnimation();
-    // and ClearTransitionAnimation();
+    // If animation supported then visual removal should be performed after any transition animation has completed.
     PerformFunctionOnVisualsInState( &Button::OnButtonVisualRemoval, mPreviousButtonState ); // Derived button can override OnButtonVisualRemoval
   }
 
     PerformFunctionOnVisualsInState( &Button::OnButtonVisualRemoval, mPreviousButtonState ); // Derived button can override OnButtonVisualRemoval
   }
 
@@ -327,16 +323,6 @@ bool Button::IsSelected() const
   return mTogglableButton && selected;
 }
 
   return mTogglableButton && selected;
 }
 
-void Button::SetAnimationTime( float animationTime )
-{
-  mAnimationTime = animationTime;
-}
-
-float Button::GetAnimationTime() const
-{
-  return mAnimationTime;
-}
-
 void Button::SetLabelText( const std::string& label )
 {
   Property::Map labelProperty;
 void Button::SetLabelText( const std::string& label )
 {
   Property::Map labelProperty;
@@ -403,28 +389,15 @@ void Button::SetupLabel( const Property::Map& properties )
     }
   }
 
     }
   }
 
-  // Notify derived button classes of the change.
-  OnLabelSet( false );
-
   RelayoutRequest();
 }
 
   RelayoutRequest();
 }
 
-void Button::SetLabelStrutLength( unsigned int length )
-{
-  mForeGroundToLabelStrutLength = length;
-}
-
 void Button::SetLabelAlignment( Button::Align labelAlignment)
 {
   mTextLabelAlignment = labelAlignment;
   RelayoutRequest();
 }
 
 void Button::SetLabelAlignment( Button::Align labelAlignment)
 {
   mTextLabelAlignment = labelAlignment;
   RelayoutRequest();
 }
 
-float Button::GetLabelStrutLength()
-{
-  return mForeGroundToLabelStrutLength;
-}
-
 Button::Align Button::GetLabelAlignment()
 {
   return mTextLabelAlignment;
 Button::Align Button::GetLabelAlignment()
 {
   return mTextLabelAlignment;
@@ -470,35 +443,6 @@ void Button::CreateVisualsForComponent( Property::Index index, const Property::V
   }
 }
 
   }
 }
 
-const Vector4 Button::GetUnselectedColor() const
-{
-  return mUnselectedColor;
-}
-
-const Vector4 Button::GetSelectedColor() const
-{
-  return mSelectedColor;
-}
-
-// Legacy code whilst Color can be set by direct Property setting ( deprecated ) instead of setting a Visual
-void Button::SetColor( const Vector4& color, Property::Index visualIndex )
-{
-  if ( visualIndex == Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL )
-  {
-    mSelectedColor = color;
-  }
-  else
-  {
-    mUnselectedColor = color;
-  }
-
-  Property::Map map;
-  map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
-  map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
-
-  CreateVisualsForComponent( visualIndex, map, DepthIndex::BACKGROUND );
-}
-
 bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
 {
   bool ret = false;
 bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
 {
   bool ret = false;
@@ -524,12 +468,12 @@ bool Button::DoClickAction( const Property::Map& attributes )
   if( !mClickActionPerforming )
   {
     mClickActionPerforming = true;
   if( !mClickActionPerforming )
   {
     mClickActionPerforming = true;
-    OnButtonDown();
+    ButtonDown();
     if ( !mTogglableButton )
     {
       mButtonPressedState = DEPRESSED;
     }
     if ( !mTogglableButton )
     {
       mButtonPressedState = DEPRESSED;
     }
-    OnButtonUp();
+    ButtonUp();
     mClickActionPerforming = false;
 
     return true;
     mClickActionPerforming = false;
 
     return true;
@@ -538,7 +482,7 @@ bool Button::DoClickAction( const Property::Map& attributes )
   return false;
 }
 
   return false;
 }
 
-void Button::OnButtonDown()
+void Button::ButtonDown()
 {
   if( mTogglableButton )
   {
 {
   if( mTogglableButton )
   {
@@ -567,34 +511,44 @@ void Button::OnButtonDown()
   mPressedSignal.Emit( handle );
 }
 
   mPressedSignal.Emit( handle );
 }
 
-void Button::OnButtonUp()
+void Button::ButtonUp()
 {
   if( DEPRESSED == mButtonPressedState )
   {
 {
   if( DEPRESSED == mButtonPressedState )
   {
-    if( mTogglableButton )
+    bool validButtonAction = false;
+
+    if( mTogglableButton ) // Button up will change state
     {
     {
-      if ( TOGGLE_DEPRESSED != mButtonPressedState )
-      {
-        SetSelected( !IsSelected() );
-        mButtonPressedState = UNPRESSED;
-      }
+      OnToggleReleased(); // Derived toggle buttons can override this to provide custom behaviour
     }
     else
     {
     }
     else
     {
-      Released();
+      Released(); // Button up will result in unselected state
       if( mAutoRepeating )
       {
         mAutoRepeatingTimer.Reset();
       }
       if( mAutoRepeating )
       {
         mAutoRepeatingTimer.Reset();
       }
+      validButtonAction = true;
     }
 
     }
 
-    // The clicked and released signals should be emitted regardless of toggle mode.
-    Toolkit::Button handle( GetOwner() );
-    mReleasedSignal.Emit( handle );
-    mClickedSignal.Emit( handle );
+    if ( validButtonAction )
+    {
+      // The clicked and released signals should be emitted regardless of toggle mode.
+      Toolkit::Button handle( GetOwner() );
+      mReleasedSignal.Emit( handle );
+      mClickedSignal.Emit( handle );
+    }
   }
 }
 
   }
 }
 
+bool Button::OnToggleReleased()
+{
+  SetSelected( !IsSelected() );
+  mButtonPressedState = UNPRESSED;
+  return true;
+}
+
+
 void Button::OnTouchPointLeave()
 {
   if( DEPRESSED == mButtonPressedState )
 void Button::OnTouchPointLeave()
 {
   if( DEPRESSED == mButtonPressedState )
@@ -706,12 +660,12 @@ bool Button::OnTouch( Actor actor, const TouchData& touch )
     {
       case PointState::DOWN:
       {
     {
       case PointState::DOWN:
       {
-        OnButtonDown();
+        ButtonDown();
         break;
       }
       case PointState::UP:
       {
         break;
       }
       case PointState::UP:
       {
-        OnButtonUp();
+        ButtonUp();
         break;
       }
       case PointState::INTERRUPTED:
         break;
       }
       case PointState::INTERRUPTED:
@@ -872,13 +826,6 @@ void Button::OnRelayout( const Vector2& size, RelayoutContainer& container )
 {
   DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout targetSize(%f,%f) ptr(%p) state[%d]\n", size.width, size.height, this, mButtonState );
 
 {
   DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout targetSize(%f,%f) ptr(%p) state[%d]\n", size.width, size.height, this, mButtonState );
 
-  PerformFunctionOnVisualsInState( &Button::SelectRequiredVisual, mButtonState );
-
-  ResizePolicy::Type widthResizePolicy = Self().GetResizePolicy(  Dimension::WIDTH );
-  ResizePolicy::Type heightResizePolicy = Self().GetResizePolicy(  Dimension::HEIGHT );
-
-  DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout resize policy: width:%d height:%d\n", heightResizePolicy, widthResizePolicy);
-
   Toolkit::Visual::Base currentVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][FOREGROUND] );
 
   Toolkit::Visual::Base currentBackGroundVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][BACKGROUND] );
   Toolkit::Visual::Base currentVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][FOREGROUND] );
 
   Toolkit::Visual::Base currentBackGroundVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][BACKGROUND] );
@@ -1050,7 +997,6 @@ void Button::Pressed()
 
   if( mButtonState == UNSELECTED_STATE )
   {
 
   if( mButtonState == UNSELECTED_STATE )
   {
-    ClearTransitionAnimation();
     ChangeState( SELECTED_STATE );
     OnPressed();  // Notifies the derived class the button has been pressed.
   }
     ChangeState( SELECTED_STATE );
     OnPressed();  // Notifies the derived class the button has been pressed.
   }
@@ -1062,23 +1008,12 @@ void Button::Released()
 
   if( mButtonState == SELECTED_STATE && !mTogglableButton )
   {
 
   if( mButtonState == SELECTED_STATE && !mTogglableButton )
   {
-    ClearTransitionAnimation();
     ChangeState( UNSELECTED_STATE );
     OnReleased(); //    // Notifies the derived class the button has been released.
   }
   mButtonPressedState = UNPRESSED;
 }
 
     ChangeState( UNSELECTED_STATE );
     OnReleased(); //    // Notifies the derived class the button has been released.
   }
   mButtonPressedState = UNPRESSED;
 }
 
-Button::PressState Button::GetPressedState()
-{
-  return mButtonPressedState;
-}
-
-Button::State Button::GetButtonState()
-{
-  return mButtonState;
-}
-
 void Button::SelectRequiredVisual( Property::Index visualIndex )
 {
   DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SelectRequiredVisual index(%d) state(%d)\n", visualIndex, mButtonState );
 void Button::SelectRequiredVisual( Property::Index visualIndex )
 {
   DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SelectRequiredVisual index(%d) state(%d)\n", visualIndex, mButtonState );
@@ -1086,23 +1021,6 @@ void Button::SelectRequiredVisual( Property::Index visualIndex )
   EnableVisual( visualIndex, true );
 }
 
   EnableVisual( visualIndex, true );
 }
 
-void Button::TransitionButtonVisualOut( Property::Index visualIndex )
-{
-  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::TransitionButtonVisualOut index(%d)\n", visualIndex);
-
-  // PrepareForTranstionOut and OnTransitionOut needs to be called on visual instead of Actor once animating is possible
-}
-
-void Button::TransitionButtonVisualIn( Property::Index visualIndex )
-{
-  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::TransitionButtonVisualIn index(%d)\n", visualIndex );
-}
-
-void Button::OnTransitionIn( Actor actor )
-{
-  PerformFunctionOnVisualsInState( &Button::OnButtonVisualRemoval, mPreviousButtonState ); // Derived button can override OnButtonVisualRemoval
-}
-
 void Button::RemoveVisual( Property::Index visualIndex )
 {
   // Use OnButtonVisualRemoval if want button developer to have the option to override removal.
 void Button::RemoveVisual( Property::Index visualIndex )
 {
   // Use OnButtonVisualRemoval if want button developer to have the option to override removal.
@@ -1123,47 +1041,6 @@ void Button::OnButtonVisualRemoval( Property::Index visualIndex )
   RemoveVisual( visualIndex );
 }
 
   RemoveVisual( visualIndex );
 }
 
-void Button::StartTransitionAnimation()
-{
-  if( mTransitionAnimation )
-  {
-    DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::StartTransitionAnimation progress(%f) duration(%f) state(%d) \n",
-                   mTransitionAnimation.GetCurrentProgress(), mTransitionAnimation.GetDuration(),
-                   mTransitionAnimation.GetState());
-    mTransitionAnimation.Play();
-  }
-}
-
-void Button::ClearTransitionAnimation()
-{
-  if( mTransitionAnimation )
-  {
-    DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::ClearTransitionAnimation progress(%f) duration(%f) state(%d) \n",
-                   mTransitionAnimation.GetCurrentProgress(), mTransitionAnimation.GetDuration(),
-                   mTransitionAnimation.GetState());
-    mTransitionAnimation.Clear();
-    mTransitionAnimation.Reset();
-  }
-}
-
-Dali::Animation Button::GetTransitionAnimation()
-{
-  if( !mTransitionAnimation )
-  {
-    mTransitionAnimation = Dali::Animation::New( GetAnimationTime() );
-    mTransitionAnimation.FinishedSignal().Connect( this, &Button::TransitionAnimationFinished );
-  }
-
-  return mTransitionAnimation;
-}
-
-void Button::TransitionAnimationFinished( Dali::Animation& source )
-{
-  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::TransitionAnimationFinished\n" );
-  ClearTransitionAnimation();
-  PerformFunctionOnVisualsInState( &Button::OnButtonVisualRemoval, mPreviousButtonState ); // Derived button can override OnButtonVisualRemoval
-}
-
 void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 {
   Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) );
 void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 {
   Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) );
@@ -1277,12 +1154,6 @@ void Button::SetProperty( BaseObject* object, Property::Index index, const Prope
         break;
       }
 
         break;
       }
 
-      case Toolkit::Button::Property::LABEL_STRUT_LENGTH:
-      {
-        GetImplementation( button ).SetLabelStrutLength( value.Get< int >() );
-        break;
-      }
-
       case Toolkit::Button::Property::LABEL_RELATIVE_ALIGNMENT:
       {
         Button::Align labelAlignment(END);
       case Toolkit::Button::Property::LABEL_RELATIVE_ALIGNMENT:
       {
         Button::Align labelAlignment(END);
@@ -1437,6 +1308,47 @@ Padding Button::GetForegroundPadding()
 ////////////////////////////////////////////////////////////////////////
 // Legacy functions from Tizen 2.4 and 3.0
 
 ////////////////////////////////////////////////////////////////////////
 // Legacy functions from Tizen 2.4 and 3.0
 
+// Legacy code needed whilst Color can be set by direct Property setting ( deprecated ) instead of setting a Visual
+void Button::SetColor( const Vector4& color, Property::Index visualIndex )
+{
+  if ( visualIndex == Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL )
+  {
+    mSelectedColor = color;
+  }
+  else
+  {
+    mUnselectedColor = color;
+  }
+
+  Property::Map map;
+  map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
+  map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
+
+  CreateVisualsForComponent( visualIndex, map, DepthIndex::BACKGROUND );
+}
+
+const Vector4 Button::GetUnselectedColor() const
+{
+  return mUnselectedColor;
+}
+
+const Vector4 Button::GetSelectedColor() const
+{
+  return mSelectedColor;
+}
+
+void Button::SetAnimationTime( float animationTime )
+{
+  // Used by depreciated API
+  mAnimationTime = animationTime;
+}
+
+float Button::GetAnimationTime() const
+{
+  // Used by depreciated API
+  return mAnimationTime;
+}
+
 void Button::SetLabel( Actor label )
 {
   if ( label )
 void Button::SetLabel( Actor label )
 {
   if ( label )
index 96787dc..e5854d7 100644 (file)
@@ -316,8 +316,7 @@ protected:
 
   /**
    * Button press state which is not the same as the actual button's state.
 
   /**
    * Button press state which is not the same as the actual button's state.
-   * A button can be DEPRESSED but the until released the button state may have not changed,
-   * For example DEPRESSING a toggle button that is already in the SELECTED state will not change the button state untill released.
+   * For example An UNSELECTED button can be DEPRESSED, but until released, the actual button state doesn't change to SELECTED
    */
   enum PressState
   {
    */
   enum PressState
   {
@@ -360,57 +359,11 @@ private:
   bool DoClickAction( const Property::Map& attributes );
 
   /**
   bool DoClickAction( const Property::Map& attributes );
 
   /**
-   * This method is called when the label is set.
-   * @param[in] noPadding Used to bypass padding if the label is to be treated generically.
-   */
-  virtual void OnLabelSet( bool noPadding ) {}
-
-  /**
-   * This method is called when the unselected button image is set
-   */
-  virtual void OnUnselectedImageSet() {}
-
-  /**
-   * This method is called when the selected image is set
-   */
-  virtual void OnSelectedImageSet() {}
-
-  /**
-   * This method is called when the background image is set
-   */
-  virtual void OnBackgroundImageSet() {}
-
-  /**
-   * This method is called when the selected background image is set
-   */
-  virtual void OnSelectedBackgroundImageSet() {}
-
-  /**
-   * This method is called when the disabled button image is set
-   */
-  virtual void OnDisabledImageSet() {}
-
-  /**
-   * This method is called when the disabled selected image is set
-   */
-  virtual void OnDisabledSelectedImageSet() {}
-
-  /**
-   * This method is called when the disabled background image is set
-   */
-  virtual void OnDisabledBackgroundImageSet() {}
-
-  /**
-   * This method is called the button is down.
-   * Could be reimplemented in subclasses to provide specific behaviour.
-   */
-  virtual void OnButtonDown();
-
-  /**
-   * This method is called when the button is up.
+   * This method is called when the button is a Toggle button and released
    * Could be reimplemented in subclasses to provide specific behaviour.
    * Could be reimplemented in subclasses to provide specific behaviour.
+   * @return bool returns true if state changed.
    */
    */
-  virtual void OnButtonUp();
+  virtual bool OnToggleReleased();
 
   /**
    * This method is called when touch leaves the boundary of the button or several touch points are received.
 
   /**
    * This method is called when touch leaves the boundary of the button or several touch points are received.
@@ -571,6 +524,16 @@ private:
   void Pressed();
 
   /**
   void Pressed();
 
   /**
+   * This method is called the button is down.
+   */
+  void ButtonDown();
+
+  /**
+   * This method is called when the button is up.
+   */
+  void ButtonUp();
+
+  /**
    * Slot called when Dali::Timer::SignalTick signal. Resets the autorepeating timer.
    */
   bool AutoRepeatingSlot();
    * Slot called when Dali::Timer::SignalTick signal. Resets the autorepeating timer.
    */
   bool AutoRepeatingSlot();
@@ -591,12 +554,6 @@ private:
   void PerformFunctionOnVisualsInState( void(Button::*functionPtr)( Property::Index visualIndex), State state  );
 
   /**
   void PerformFunctionOnVisualsInState( void(Button::*functionPtr)( Property::Index visualIndex), State state  );
 
   /**
-   * Transition the visual in or out using the set animation
-   * @param[in] state State to transition in or out
-   */
-  void SetVisualsForTransition( State state );
-
-  /**
    * Changes the button state when an action occurs on it
    * @param[in] requestedState the state to change to
    */
    * Changes the button state when an action occurs on it
    * @param[in] requestedState the state to change to
    */
@@ -654,18 +611,6 @@ protected:
   Padding GetForegroundPadding();
 
   /**
   Padding GetForegroundPadding();
 
   /**
-   * @brief Get the pressed state of the button
-   * @return ButtonPressedState the state the button is in
-   */
-  PressState GetPressedState();
-
-  /**
-   * @brief Get the state of the button
-   * @return PaintState the state the button is in
-   */
-  State GetButtonState();
-
-  /**
    * @brief Setup the button components for example foregrounds and background
    * @param[in] index the index of the visual to set
    * @param[in] value the value to set on the component
    * @brief Setup the button components for example foregrounds and background
    * @param[in] index the index of the visual to set
    * @param[in] value the value to set on the component
@@ -680,58 +625,18 @@ protected:
   Dali::Animation GetTransitionAnimation();
 
   /**
   Dali::Animation GetTransitionAnimation();
 
   /**
-   * @brief Set distance between label and foreground/icon, if both present
-   * @param[in] length length of strut
-   */
-  void SetLabelStrutLength( unsigned int length );
-
-  /**
    * @brief Set the position of the label relative to foreground/icon, if both present
    * @param[in] labelAlignment given alignment setting
    */
   void SetLabelAlignment( Align labelAlignment);
 
   /**
    * @brief Set the position of the label relative to foreground/icon, if both present
    * @param[in] labelAlignment given alignment setting
    */
   void SetLabelAlignment( Align labelAlignment);
 
   /**
-   * @brief Get set distance between label and foreground/icon visual
-   * @return length of strut
-   */
-  float GetLabelStrutLength();
-
-  /**
    * @brief Get set alignment of label in relation to foreground/icon
    * @return Set alignment value
    */
   Align GetLabelAlignment();
 
   /**
    * @brief Get set alignment of label in relation to foreground/icon
    * @return Set alignment value
    */
   Align GetLabelAlignment();
 
   /**
-   * Prepares the actor to be transitioned in.
-   * @param[in]  actor  The actor that will be transitioned in.
-   */
-  virtual void PrepareForTransitionIn( Actor actor ) {}
-
-  /**
-   * Prepares the actor to be transitioned in.
-   * @param[in]  actor  The actor that will be transitioned out.
-   */
-  virtual void PrepareForTransitionOut( Actor actor ) {}
-
-  /**
-   * Transitions the actor in, allowing derived classes to configure
-   * the GetTransitionAnimation() animation ready.
-   * Button is in charge of calling Dali::Animation::Play and so derived classes
-   * only need to add the animation.
-   */
-  virtual void OnTransitionIn( Actor actor );
-
-  /**
-   * Transitions the actor out, allowing derived classes to configure
-   * the GetTransitionAnimation() animation ready.
-   * Button is in charge of calling Dali::Animation::Play and so derived classes
-   * only need to add the animation.
-   */
-  virtual void OnTransitionOut( Actor actor ) {}
-
-  /**
    * Removes the visual from the button (un-staged)
    * If the derived button does not want the visual removed then use this virtual function to
    * define the required behaviour.
    * Removes the visual from the button (un-staged)
    * If the derived button does not want the visual removed then use this virtual function to
    * define the required behaviour.
@@ -743,32 +648,6 @@ protected:
 private:
 
   /**
 private:
 
   /**
-   * Starts the transition animation.
-   * Button::TransitionFinished is called when the animation finishes.
-   */
-  void StartTransitionAnimation();
-
-  /**
-   * This method stops and clears animations
-   */
-  void ClearTransitionAnimation();
-
-  /**
-   * Called when the transition animation finishes.
-   */
-  void TransitionAnimationFinished( Dali::Animation& source );
-
-  /**
-   * Transition button visual using an animation before removal from Stage
-   */
-  void TransitionButtonVisualOut( Property::Index visualIndex );
-
-  /**
-   * Transition button visual using an animation before adding to Stage
-   */
-  void TransitionButtonVisualIn( Property::Index visualIndex );
-
-  /**
    * Removes the visual from the button and prepares it to be transitioned out
    * @param[in] visualIndex the visual to remove
    */
    * Removes the visual from the button and prepares it to be transitioned out
    * @param[in] visualIndex the visual to remove
    */
@@ -800,11 +679,8 @@ private:
   Padding          mLabelPadding;               ///< The padding around the label (if present).
   Padding          mForegroundPadding;          ///< The padding around the foreground/icon visual (if present).
 
   Padding          mLabelPadding;               ///< The padding around the label (if present).
   Padding          mForegroundPadding;          ///< The padding around the foreground/icon visual (if present).
 
-  unsigned int     mForeGroundToLabelStrutLength; ///< Distance between foreground/icon and label.
   Align            mTextLabelAlignment;           ///< Position of text label in relation to foreground/icon when both are present.
 
   Align            mTextLabelAlignment;           ///< Position of text label in relation to foreground/icon when both are present.
 
-  Animation        mTransitionAnimation;        ///< Used in the state transitions.
-
   TapGestureDetector mTapDetector;
 
   Vector4          mUnselectedColor;
   TapGestureDetector mTapDetector;
 
   Vector4          mUnselectedColor;
index b8907f0..9554ccb 100644 (file)
@@ -45,8 +45,6 @@ namespace Internal
 namespace
 {
 
 namespace
 {
 
-const float ANIMATION_TIME( 0.26f );  // EFL checkbox tick time - Will be replaced by stylable tranisitions
-
 BaseHandle Create()
 {
   return Toolkit::CheckBoxButton::New();
 BaseHandle Create()
 {
   return Toolkit::CheckBoxButton::New();
@@ -77,55 +75,17 @@ CheckBoxButton::CheckBoxButton()
 : Button()
 {
   SetTogglableButton( true );
 : Button()
 {
   SetTogglableButton( true );
-
-  SetAnimationTime( ANIMATION_TIME );
 }
 
 CheckBoxButton::~CheckBoxButton()
 {
 }
 
 }
 
 CheckBoxButton::~CheckBoxButton()
 {
 }
 
-void CheckBoxButton::FadeImageTo( Actor actor , float opacity )
-{
-  if( actor )
-  {
-    Dali::Animation transitionAnimation = GetTransitionAnimation();
-
-    if( transitionAnimation )
-    {
-      transitionAnimation.AnimateTo( Property( actor, Actor::Property::COLOR_ALPHA ), opacity );
-    }
-  }
-}
-
 void CheckBoxButton::OnInitialize()
 {
   Button::OnInitialize();
 }
 
 void CheckBoxButton::OnInitialize()
 {
   Button::OnInitialize();
 }
 
-void CheckBoxButton::PrepareForTransitionIn( Actor actor )
-{
-  // Set Toolkit::Button::Property::SELECTED_VISUAL and Toolkit::Button::Property::UNSELECTED_VISUAL to opacity 0
-  // Then get and start animation
-}
-
-void CheckBoxButton::PrepareForTransitionOut( Actor actor )
-{
-  // Set Toolkit::Button::Property::SELECTED_VISUAL and Toolkit::Button::Property::UNSELECTED_VISUAL to opacity 1
-  // Then get and start animation
-}
-
-void CheckBoxButton::OnTransitionIn( Actor actor )
-{
-  // Only transition selected and unselected visual, background doesn't change.
-  // Start Fade animation to 1
-}
-
-void CheckBoxButton::OnTransitionOut( Actor actor )
-{
-  // Only transition selected and unselected visual, background doesn't change.
-  // Start Fade animation to 0
-}
 
 } // namespace Internal
 
 
 } // namespace Internal
 
index c283392..daee597 100644 (file)
@@ -70,31 +70,6 @@ private: // From Button
    */
   virtual void OnInitialize();
 
    */
   virtual void OnInitialize();
 
-  /**
-   * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
-   */
-  virtual void PrepareForTransitionIn( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
-   */
-  virtual void PrepareForTransitionOut( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnTransitionInImage( Actor actor )
-   */
-  virtual void OnTransitionIn( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor )
-   */
-  virtual void OnTransitionOut( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnButtonVisualRemoval( Property::Index visualIndex )
-   */
- // virtual void OnButtonVisualRemoval( Property::Index visualIndex );
-
 private:
 
   // Undefined
 private:
 
   // Undefined
index cb5a747..4e96f14 100644 (file)
@@ -47,8 +47,6 @@ namespace Internal
 namespace
 {
 
 namespace
 {
 
-const float   ANIMATION_TIME( 0.2f );
-
 BaseHandle Create()
 {
   return Toolkit::PushButton::New();
 BaseHandle Create()
 {
   return Toolkit::PushButton::New();
@@ -102,7 +100,6 @@ PushButton::PushButton()
 : Button(),
   mIconAlignment( RIGHT )
 {
 : Button(),
   mIconAlignment( RIGHT )
 {
-  SetAnimationTime( ANIMATION_TIME );
 }
 
 PushButton::~PushButton()
 }
 
 PushButton::~PushButton()
@@ -245,46 +242,6 @@ Property::Value PushButton::GetProperty( BaseObject* object, Property::Index pro
   return value;
 }
 
   return value;
 }
 
-void PushButton::PrepareForTranstionIn( Actor actor )
-{
-  // Set Toolkit::Button::Property::SELECTED_VISUAL and Toolkit::Button::Property::UNSELECTED_VISUAL to opacity 0
-  // Then get and start animation
-}
-
-void PushButton::PrepareForTranstionOut( Actor actor )
-{
-  // Set Toolkit::Button::Property::SELECTED_VISUAL and Toolkit::Button::Property::UNSELECTED_VISUAL to opacity 1
-  // Then get and start animation
-}
-
-void PushButton::OnTransitionIn( Actor actor )
-{
-  // Only transition selected and unselected visual, background doesn't change.
-  // Start Fade animation to 1
-}
-
-void PushButton::OnTransitionOut( Actor actor )
-{
-  // Only transition selected and unselected visual, background doesn't change.
-  // Start Fade animation to 0
-}
-
-void PushButton::FadeImageTo( Actor actor , float opacity )
-{
-  if( actor )
-  {
-    Dali::Animation transitionAnimation = GetTransitionAnimation();
-    DALI_ASSERT_DEBUG( transitionAnimation );
-
-    if( transitionAnimation )
-    {
-      DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "PushButton::FadeImageTo(%f)\n", opacity );
-
-      transitionAnimation.AnimateTo( Property( actor, Actor::Property::COLOR_ALPHA ), opacity );
-    }
-  }
-}
-
 } // namespace Internal
 
 } // namespace Toolkit
 } // namespace Internal
 
 } // namespace Toolkit
index 990acf0..ecc7ac7 100644 (file)
@@ -100,27 +100,6 @@ private: // From Button
    */
   virtual void OnInitialize();
 
    */
   virtual void OnInitialize();
 
-  /**
-   * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
-   */
-  virtual void PrepareForTranstionIn( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
-   */
-  virtual void PrepareForTranstionOut( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnTransitionIn( Toolkit::Visual::Base& visual )
-   */
-  virtual void OnTransitionIn( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnTransitionOut( Toolkit::Visual::Base& visual )
-   */
-  virtual void OnTransitionOut( Actor actor );
-
-
 private:
 
   /**
 private:
 
   /**
index c20fe23..9dd7570 100644 (file)
@@ -78,15 +78,16 @@ void RadioButton::OnInitialize()
   Button::OnInitialize();
 }
 
   Button::OnInitialize();
 }
 
-void RadioButton::OnButtonUp()
+bool RadioButton::OnToggleReleased()
 {
 {
-  DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "RadioButton::OnStateChange selecting:%s\n", ( (!IsSelected())?"true":"false" ) );
-
-  // Don't allow un-selection on an already selected radio button, can only un-select by selecting a sibling radio button
+  // Radio button overrides toggle release (button up) as doesn't allow un-selection to be performed on it directly.
+  bool stateChanged = false;
   if( !IsSelected() )
   {
   if( !IsSelected() )
   {
-    SetSelected( !IsSelected() );
+    Button::SetSelected( true ); // Set button to selected as previously unselected
+    stateChanged = true;
   }
   }
+  return stateChanged;
 }
 
 void RadioButton::OnStateChange( State newState )
 }
 
 void RadioButton::OnStateChange( State newState )
index ca5ba20..1012196 100644 (file)
@@ -74,10 +74,9 @@ private: // From Button
   virtual void OnStateChange( State newState );
 
   /**
   virtual void OnStateChange( State newState );
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonUp
+   * @copydoc Toolkit::Internal::Button::OnToggleReleased
    */
    */
-  virtual void OnButtonUp();
-
+  virtual bool OnToggleReleased();
 
 private:
 
 
 private:
 
index 3b649d1..68b2567 100644 (file)
@@ -95,7 +95,6 @@ class Button;
  * | Property::SELECTED_BACKGROUND_VISUAL                  | selectedBackgroundVisual               |  MAP         | Y      | N        |
  * | Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL       | disabledUnselectedBackgroundVisual     |  MAP         | Y      | N        |
  * | Property::DISABLED_SELECTED_BACKGROUND_VISUAL         | disabledSelectedBackgroundVisual       |  MAP         | Y      | N        |
  * | Property::SELECTED_BACKGROUND_VISUAL                  | selectedBackgroundVisual               |  MAP         | Y      | N        |
  * | Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL       | disabledUnselectedBackgroundVisual     |  MAP         | Y      | N        |
  * | Property::DISABLED_SELECTED_BACKGROUND_VISUAL         | disabledSelectedBackgroundVisual       |  MAP         | Y      | N        |
- * | Property::LABEL_STRUT_LENGTH                          | labelStrutLength                       |  INTEGER     | Y      | N        |
  * | Property::LABEL_RELATIVE_ALIGNMENT                    | labelRelativeAlignment                 |  STRING      | Y      | N        |
  * -------------------------------------------------------------------------------------------------------------------------------------
  *
  * | Property::LABEL_RELATIVE_ALIGNMENT                    | labelRelativeAlignment                 |  STRING      | Y      | N        |
  * -------------------------------------------------------------------------------------------------------------------------------------
  *
@@ -291,13 +290,6 @@ public:
       DISABLED_SELECTED_BACKGROUND_VISUAL,
 
       /**
       DISABLED_SELECTED_BACKGROUND_VISUAL,
 
       /**
-       * @brief name "labelStrutLength", type INTEGER
-       * @details Sets the distance between the label and foreground/icon visual if both present
-       * @SINCE_1_2.XX
-       */
-      LABEL_STRUT_LENGTH,  // todo ????? remove
-
-      /**
        * @brief name "labelRelativeAlignment", type STRING
        * @details Sets the position of the the label in relation to the foreground/icon if both present
        * @SINCE_1_2.XX
        * @brief name "labelRelativeAlignment", type STRING
        * @details Sets the position of the the label in relation to the foreground/icon if both present
        * @SINCE_1_2.XX