[dali_1.0.29] Merge branch 'tizen'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / push-button-impl.h
index b463513..1297fef 100644 (file)
@@ -1,27 +1,29 @@
 #ifndef __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
 #define __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/common/dali-vector.h>
 
+// INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
-
 #include "button-impl.h"
 
 namespace Dali
@@ -141,88 +143,88 @@ public:
   Actor GetBackgroundImage() const;
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetPressedImage( const Image image )
+   * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( const Image image )
    */
-  void SetPressedImage( Image image );
+  void SetSelectedImage( Image image );
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetPressedImage( Actor image )
+   * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image )
    */
-  void SetPressedImage( Actor image );
+  void SetSelectedImage( Actor image );
 
   /**
    * Used by the painter only.
-   * @return A reference to the pressed image.
+   * @return A reference to the selected image.
    */
-  Actor& GetPressedImage();
+  Actor& GetSelectedImage();
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::GetPressedImage()
+   * @copydoc Dali::Toolkit::PushButton::GetSelectedImage()
    */
-  Actor GetPressedImage() const;
+  Actor GetSelectedImage() const;
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetDimmedBackgroundImage( Image image )
+   * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Image image )
    */
-  void SetDimmedBackgroundImage( Image image );
+  void SetDisabledBackgroundImage( Image image );
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetDimmedBackgroundImage( Actor image )
+   * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image )
    */
-  void SetDimmedBackgroundImage( Actor image );
+  void SetDisabledBackgroundImage( Actor image );
 
   /**
    * Used by the painter only.
-   * @return A reference to the dimmed background image.
+   * @return A reference to the disabled background image.
    */
-  Actor& GetDimmedBackgroundImage();
+  Actor& GetDisabledBackgroundImage();
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::GetDimmedBackgroundImage()
+   * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage()
    */
-  Actor GetDimmedBackgroundImage() const;
+  Actor GetDisabledBackgroundImage() const;
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetDimmedImage( Image image )
+   * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Image image )
    */
-  void SetDimmedImage( Image image );
+  void SetDisabledImage( Image image );
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetDimmedImage( Actor image )
+   * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image )
    */
-  void SetDimmedImage( Actor image );
+  void SetDisabledImage( Actor image );
 
   /**
    * Used by the painter only.
-   * @return A reference to the dimmed button image.
+   * @return A reference to the disabled button image.
    */
-  Actor& GetDimmedImage();
+  Actor& GetDisabledImage();
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::GetDimmedImage()
+   * @copydoc Dali::Toolkit::PushButton::GetDisabledImage()
    */
-  Actor GetDimmedImage() const;
+  Actor GetDisabledImage() const;
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetLabelText( const std::string& text )
+   * @copydoc Dali::Toolkit::PushButton::SetLabel( const std::string& label )
    */
-  void SetLabelText( const std::string& text );
+  void SetLabel( const std::string& label );
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::SetLabelText( Actor text )
+   * @copydoc Dali::Toolkit::PushButton::SetLabel( Actor label )
    */
-  void SetLabelText( Actor text );
+  void SetLabel( Actor label );
 
   /**
-   * Used by the painter only.
-   * @return A reference to the label actor.
+   * @copydoc Dali::Toolkit::PushButton::GetLabel()
    */
-  Actor& GetLabel();
+  Actor GetLabel() const;
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::GetLabelText()
+   * Used by the painter only.
+   * @return A reference to the label actor.
    */
-  Actor GetLabelText() const;
+  Actor& GetLabel();
 
   /**
    * Used by the painter only.
@@ -241,19 +243,14 @@ public:
   // Signals
 
   /**
-   * @copydoc Dali::Toolkit::PushButton::ToggledSignal()
-   */
-  Toolkit::PushButton::ToggledSignalV2& ToggledSignal();
-
-  /**
    * @copydoc Dali::Toolkit::PushButton::PressedSignal()
    */
-  Toolkit::PushButton::PressedSignalV2& PressedSignal();
+  Toolkit::PushButton::PressedSignalType& PressedSignal();
 
   /**
    * @copydoc Dali::Toolkit::PushButton::ReleasedSignal()
    */
-  Toolkit::PushButton::ReleasedSignalV2& ReleasedSignal();
+  Toolkit::PushButton::ReleasedSignalType& ReleasedSignal();
 
   /**
    * Connects a callback function with the object's signals.
@@ -320,13 +317,23 @@ protected: // From Button
    */
   virtual float OnAnimationTimeRequested() const;
 
-protected: // From ControlImpl
+  /**
+   * This method is called when the button is removed from the stage.
+   */
+  virtual void OnButtonStageDisconnection();
+
+protected: // From Control
 
   /**
    * Respond the activate notification.
    */
   virtual void OnActivated();
 
+  /**
+   * @copydoc Control::GetNaturalSize()
+   */
+  virtual Vector3 GetNaturalSize();
+
 private:
 
   /**
@@ -344,7 +351,7 @@ public:
    * @param[in] attributes The attributes with which to perfrom this action.
    * @return true if action has been accepted by this control
    */
-  static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+  static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
 
   /**
    * Construct a new PushButton.
@@ -388,15 +395,14 @@ private:
   bool  mToggled;                   ///< Stores the toggle state.
 
   // Signals
-  Toolkit::PushButton::ToggledSignalV2 mToggledSignalV2;   ///< Signal emitted when the button is toggled.
-  Toolkit::PushButton::PressedSignalV2 mPressedSignalV2;   ///< Signal emitted when the button is pressed.
-  Toolkit::PushButton::ReleasedSignalV2 mReleasedSignalV2; ///< Signal emitted when the button is released.
+  Toolkit::PushButton::PressedSignalType mPressedSignal;   ///< Signal emitted when the button is pressed.
+  Toolkit::PushButton::ReleasedSignalType mReleasedSignal; ///< Signal emitted when the button is released.
 
-  Actor mButtonImage;               ///< Stores the released image.
+  Actor mButtonImage;               ///< Stores the unselected image.
   Actor mBackgroundImage;           ///< Stores the background image.
-  Actor mPressedImage;              ///< Stores the pressed image.
-  Actor mDimmedImage;               ///< Stores the dimmed image.
-  Actor mDimmedBackgroundImage;     ///< Stores the dimmed background image.
+  Actor mSelectedImage;             ///< Stores the selected image.
+  Actor mDisabledImage;             ///< Stores the disabled image.
+  Actor mDisabledBackgroundImage;   ///< Stores the disabled background image.
 
   Actor mLabel;                     ///< Stores the text label.