[AT-SPI] Remove SetAccessibilityConstructor()
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / push-button-impl.h
index f1925a3..21a4d01 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
-#define __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
+#ifndef DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H
+#define DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Internal
 {
-
 /**
  * PushButton implementation class.
  *
@@ -42,7 +39,6 @@ namespace Internal
 class PushButton : public Button
 {
 public:
-
   /**
    * Create a new PushButton.
    * @return A smart-pointer to the newly allocated PushButton.
@@ -50,7 +46,6 @@ public:
   static Dali::Toolkit::PushButton New();
 
 protected:
-
   /**
    * Construct a new PushButton.
    */
@@ -62,7 +57,6 @@ protected:
   virtual ~PushButton();
 
 public:
-
   // Properties
 
   /**
@@ -83,7 +77,7 @@ public:
    * @param[in] index The property index.
    * @param[in] value The new property value.
    */
-  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+  static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
 
   /**
    * Called to retrieve a property of an object of this type.
@@ -91,137 +85,26 @@ public:
    * @param[in] index The property index.
    * @return The current value of the property.
    */
-  static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+  static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
 
 private: // From Button
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
-   */
-  virtual void OnButtonInitialize();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnLabelSet()
-   */
-  virtual void OnLabelSet();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnButtonImageSet()
-   */
-  virtual void OnButtonImageSet();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnSelectedImageSet()
-   */
-  virtual void OnSelectedImageSet();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnBackgroundImage()
-   */
-  virtual void OnBackgroundImageSet();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet()
-   */
-  virtual void OnSelectedBackgroundImageSet();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnDisabledImageSet()
-   */
-  virtual void OnDisabledImageSet();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet()
-   */
-  virtual void OnDisabledSelectedImageSet();
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet()
-   */
-  virtual void OnDisabledBackgroundImageSet();
-
   /**
-   * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
+   * @copydoc Toolkit::Internal::Button::OnInitialize
    */
-  virtual void PrepareForTranstionIn( Actor actor );
+  void OnInitialize() override;
 
   /**
-   * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
+   * @copydoc Toolkit::Internal::Control::CreateAccessibleObject()
    */
-  virtual void PrepareForTranstionOut( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnTransitionIn( Actor actor )
-   */
-  virtual void OnTransitionIn( Actor actor );
-
-  /**
-   * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor )
-   */
-  virtual void OnTransitionOut( Actor actor );
-
-private: // From Control
-
-  /**
-   * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
-   */
-  virtual void OnSizeSet( const Vector3& targetSize );
-
-  /**
-   * @copydoc Toolkit::Control::GetNaturalSize
-   */
-  virtual Vector3 GetNaturalSize();
-
-  /**
-   * @copydoc Toolkit::Control::OnSetResizePolicy
-   */
-  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
+  DevelControl::ControlAccessible* CreateAccessibleObject() override;
 
 private:
-
-  /**
-   * It adds the actor to the root actor and to the fade in animation.
-   * @param[inout] actor The actor.
-   * @param[in] opacity The opacity to fade to
-   */
-  void FadeImageTo( Actor actor, float opacity );
-
-  /**
-   * @brief Custom configuration for size negotiation
-   */
-  void ConfigureSizeNegotiation();
-
-  /**
-   * @brief Configure size negotiation for a given dimension
-   *
-   * @param[in] dimension The dimension to configure
-   * @param[in] images The list of images to configure
-   * @param[in] label The text label to configure
-   */
-  void ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label );
-
-  /**
-   * @brief Sets either the selected or unselected icon.
-   *
-   * @param[in] state The icon state to set
-   * @param[in] iconFilename The filename of the icon
-   */
-  void SetIcon( DecorationState state, const std::string iconFilename );
-
-  /**
-   * @brief Gets either the selected or unselected icon.
-   *
-   * @param[in] state The icon state to get
-   * @return    The filename of the icon
-   */
-  std::string& GetIcon( DecorationState state );
-
   /**
    * @brief Sets the alignment mode to use to align the icon to the label.
    *
    * @param[in] iconAlignment The alignment mode to use
    */
-  void SetIconAlignment( const PushButton::IconAlignment iconAlignment );
+  void SetIconAlignment(const PushButton::IconAlignment iconAlignment);
 
   /**
    * @brief Gets the alignment mode used to align the icon to the label.
@@ -230,75 +113,55 @@ private:
    */
   const PushButton::IconAlignment GetIconAlignment() const;
 
-  /**
-   * @brief Sets the padding for the label.
-   *
-   * @param[in] padding The padding to set
-   */
-  void SetLabelPadding( const Vector4& padding );
-
-  /**
-   * @brief Gets the padding for the label.
-   *
-   * @return The label padding
-   */
-  Vector4 GetLabelPadding();
-
-  /**
-   * @brief Sets the padding for the icon.
-   *
-   * @param[in] padding The padding to set
-   */
-  void SetIconPadding( const Vector4& padding );
-
-  /**
-   * @brief Gets the padding for the icon.
-   *
-   * @return The icon padding
-   */
-  Vector4 GetIconPadding();
-
 private:
-
   // Undefined
-  PushButton( const PushButton& );
+  PushButton(const PushButton&);
 
   // Undefined
-  PushButton& operator=( const PushButton& );
+  PushButton& operator=(const PushButton&);
 
 private:
+  IconAlignment mIconAlignment; ///< The alignment of the icon against the label.
+
+protected:
+  class PushButtonAccessible : public Button::ButtonAccessible
+  {
+  public:
+    using Button::ButtonAccessible::ButtonAccessible;
+
+    /**
+     * @copydoc Dali::Toolkit::DevelControl::ControlAccessible::CalculateStates()
+     */
+    Dali::Accessibility::States CalculateStates() override;
+  };
 
-  std::string    mIconName[ DECORATION_STATES ]; ///< The original filenames for the icons.
-  Padding        mLabelPadding;                  ///< The padding around the label (if present).
-  Padding        mIconPadding;                   ///< The padding around the icon (if present).
-  IconAlignment  mIconAlignment;                 ///< The alignment of the icon against the label.
-  Vector3        mSize;                          ///< The button's size.
+  void OnStateChange(State newState) override;
 };
 
 } // namespace Internal
 
 // Helpers for public-api forwarding methods
 
-inline Toolkit::Internal::PushButton& GetImplementation( Toolkit::PushButton& button )
+inline Toolkit::Internal::PushButton& GetImplementation(Toolkit::PushButton& button)
 {
-  DALI_ASSERT_ALWAYS( button );
+  DALI_ASSERT_ALWAYS(button);
 
   Dali::RefObject& handle = button.GetImplementation();
 
-  return static_cast<Toolkit::Internal::PushButton&>( handle );
+  return static_cast<Toolkit::Internal::PushButton&>(handle);
 }
 
-inline const Toolkit::Internal::PushButton& GetImplementation( const Toolkit::PushButton& button )
+inline const Toolkit::Internal::PushButton& GetImplementation(const Toolkit::PushButton& button)
 {
-  DALI_ASSERT_ALWAYS( button );
+  DALI_ASSERT_ALWAYS(button);
 
   const Dali::RefObject& handle = button.GetImplementation();
 
-  return static_cast<const Toolkit::Internal::PushButton&>( handle );
+  return static_cast<const Toolkit::Internal::PushButton&>(handle);
 }
 
 } // namespace Toolkit
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
+#endif // DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H