Remove Unnecessary OnButton methods in the button implementations 76/65576/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 11 Apr 2016 11:23:29 +0000 (12:23 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 11 Apr 2016 11:23:29 +0000 (12:23 +0100)
Change-Id: I5fd0c0149513dd40c1eace72afa49ed47a9782cf

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

index b923295..6df5fcf 100644 (file)
@@ -823,22 +823,6 @@ bool Button::DoClickAction( const Property::Map& attributes )
   return false;
 }
 
-void Button::OnButtonStageDisconnection()
-{
-  if( ButtonDown == mState )
-  {
-    if( !mTogglableButton )
-    {
-      Released();
-
-      if( mAutoRepeating )
-      {
-        mAutoRepeatingTimer.Reset();
-      }
-    }
-  }
-}
-
 void Button::OnButtonDown()
 {
   if( !mTogglableButton )
@@ -1030,8 +1014,6 @@ void Button::OnInitialize()
   mTapDetector.Attach( self );
   mTapDetector.DetectedSignal().Connect(this, &Button::OnTap);
 
-  OnButtonInitialize();
-
   self.SetKeyboardFocusable( true );
 }
 
@@ -1051,7 +1033,19 @@ bool Button::OnKeyboardEnter()
 
 void Button::OnStageDisconnection()
 {
-  OnButtonStageDisconnection(); // Notification for derived classes.
+  if( ButtonDown == mState )
+  {
+    if( !mTogglableButton )
+    {
+      Released();
+
+      if( mAutoRepeating )
+      {
+        mAutoRepeatingTimer.Reset();
+      }
+    }
+  }
+
   mState = ButtonUp;
 
   Control::OnStageDisconnection();
index 2ff121d..6f1e313 100644 (file)
@@ -335,12 +335,6 @@ private:
   bool DoClickAction( const Property::Map& attributes );
 
   /**
-   * This method is called after the button initialization.
-   * Could be reimplemented in subclasses to provide specific behaviour.
-   */
-  virtual void OnButtonInitialize() { }
-
-  /**
    * This method is called when the label is set.
    * @param[in] noPadding Used to bypass padding if the label is to be treated generically.
    */
@@ -407,12 +401,6 @@ private:
   virtual void OnTouchPointInterrupted();
 
   /**
-   * This method is called when the button is removed from the stage.
-   * Could be reimplemented in subclasses to provide specific behaviour.
-   */
-  virtual void OnButtonStageDisconnection();
-
-  /**
    * This method is called when the \e selected property is changed.
    */
   virtual void OnSelected() {}
@@ -483,17 +471,16 @@ public:
    */
   static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
 
-protected: // From CustomActorImpl
+protected: // From Control
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnTouchEvent( const TouchEvent& event )
+   * @copydoc Dali::Control::OnTouchEvent( const TouchEvent& event )
    */
   virtual bool OnTouchEvent( const TouchEvent& event );
 
-private: // From Control
-
   /**
    * @copydoc Toolkit::Control::OnInitialize()
+   * @note If overridden by deriving button classes, then an up-call to Button::OnInitialize MUST be made at the start.
    */
   virtual void OnInitialize();
 
@@ -508,8 +495,8 @@ private: // From Control
   virtual bool OnKeyboardEnter();
 
   /**
-   * Callback received when the button is disconnected from the stage.
-   * It resets the button status.
+   * @copydoc Toolkit::Control::OnStageDisconnection()
+   * @note If overridden by deriving button classes, then an up-call to Button::OnStageDisconnection MUST be made at the end.
    */
   void OnStageDisconnection();
 
index 79ef935..6607c5c 100644 (file)
@@ -97,8 +97,10 @@ void CheckBoxButton::SetTickUVEffect()
   }
 }
 
-void CheckBoxButton::OnButtonInitialize()
+void CheckBoxButton::OnInitialize()
 {
+  Button::OnInitialize();
+
   // Wrap around all children
   Self().SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
 
index e80b838..7e9d314 100644 (file)
@@ -73,9 +73,9 @@ private: // From Button
 
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonInitialize
+   * @copydoc Toolkit::Internal::Button::OnInitialize
    */
-  virtual void OnButtonInitialize();
+  virtual void OnInitialize();
 
   /**
    * @copydoc Toolkit::Internal::Button::OnLabelSet
index 50d85e5..9a47206 100644 (file)
@@ -127,8 +127,10 @@ PushButton::~PushButton()
 {
 }
 
-void PushButton::OnButtonInitialize()
+void PushButton::OnInitialize()
 {
+  Button::OnInitialize();
+
   // Push button requires the Leave event.
   Actor self = Self();
   self.SetLeaveRequired( true );
index 44e447c..a003e6d 100644 (file)
@@ -96,9 +96,9 @@ public:
 private: // From Button
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonInitialize
+   * @copydoc Toolkit::Internal::Button::OnInitialize
    */
-  virtual void OnButtonInitialize();
+  virtual void OnInitialize();
 
   /**
    * @copydoc Toolkit::Internal::Button::OnLabelSet
index e980ec9..142dba1 100644 (file)
@@ -74,8 +74,10 @@ RadioButton::~RadioButton()
 {
 }
 
-void RadioButton::OnButtonInitialize()
+void RadioButton::OnInitialize()
 {
+  Button::OnInitialize();
+
   Actor self = Self();
 
   // Wrap size of radio button around all its children
index 34130ae..630e1a3 100644 (file)
@@ -64,9 +64,9 @@ private:
 private: // From Button
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonInitialize
+   * @copydoc Toolkit::Internal::Button::OnInitialize
    */
-  virtual void OnButtonInitialize();
+  virtual void OnInitialize();
 
   /**
    * @copydoc Toolkit::Internal::Button::OnButtonUp