X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fbutton-impl.h;h=ced51fde93a6bd4e1a95312d0865eb22d1656841;hb=b8da2e53925b9abb9fa362560069e8ca4aa62f81;hp=5197acadbd4a5002ca7453828d193346e6454558;hpb=cd7d41bc8e0a0816da28401207091344fbbe0b2c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/button-impl.h b/dali-toolkit/internal/controls/buttons/button-impl.h index 5197aca..ced51fd 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.h +++ b/dali-toolkit/internal/controls/buttons/button-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_BUTTON_H__ -#define __DALI_TOOLKIT_INTERNAL_BUTTON_H__ +#ifndef DALI_TOOLKIT_INTERNAL_BUTTON_H +#define DALI_TOOLKIT_INTERNAL_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. @@ -20,238 +20,105 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES -#include +#include +#include +#include #include namespace Dali { - namespace Toolkit { - class Button; namespace Internal { - /** + * @copydoc Toolkit::Button + * * Button is the base class implementation for all buttons. + * + * @note + * + * All Foreground/Icon visuals expected to be the same size. + * Background visuals will take the size of the control. + * Padding and struts take size precedence over visuals when available space is limited. + * Icon/Foreground visuals take size precedence over Labels when available space is limited. */ class Button : public Control { - -protected: - - /** - * Construct a new Button. - */ - Button(); - +public: /** - * A reference counted object may only be deleted by calling Unreference() + * Enum describing the position the text label can be in relation to the control (and foreground/icon) */ - virtual ~Button(); + enum Align + { + BEGIN, // At the start of the control before the foreground/icon + END, // At the end of the control after the foreground/icon + TOP, // At the top of the control above the foreground/icon + BOTTOM // At the bottom of the control below the foreground/icon + }; public: - /** - * @copydoc Dali::Toolkit::Button::SetDisabled( bool disabled ) + * @brief Sets the button as \e disabled. + * @param[in] disabled Disabled property */ - void SetDisabled( bool disabled ); + void SetDisabled(bool disabled); /** - * @copydoc Dali::Toolkit::Button::IsDisabled() const + * @brief Returns if the button is disabled. + * @return \e true if the button is \e disabled */ bool IsDisabled() const; /** - * @copydoc Dali::Toolkit::Button::SetAutoRepeating( bool autoRepeating ) - */ - void SetAutoRepeating( bool autoRepeating ); - - /** - * @copydoc Dali::Toolkit::Button::IsAutoRepeating() const - */ - bool IsAutoRepeating() const; - - /** - * @copydoc Dali::Toolkit::Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) - */ - void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ); - - /** - * @copydoc Dali::Toolkit::Button::GetInitialAutoRepeatingDelay() const + * @brief Sets the \e autorepeating property. + * @param[in] autoRepeating \e autorepeating property */ - float GetInitialAutoRepeatingDelay() const; + void SetAutoRepeating(bool autoRepeating); /** - * @copydoc Dali::Toolkit::Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) + * @brief Sets the initial autorepeating delay. + * @param[in] initialAutoRepeatingDelay in seconds */ - void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ); + void SetInitialAutoRepeatingDelay(float initialAutoRepeatingDelay); /** - * @copydoc Dali::Toolkit::Button::GetNextAutoRepeatingDelay() const + * @brief Sets the next autorepeating delay. + * @param[in] nextAutoRepeatingDelay in seconds */ - float GetNextAutoRepeatingDelay() const; + void SetNextAutoRepeatingDelay(float nextAutoRepeatingDelay); /** - * @copydoc Dali::Toolkit::Button::SetTogglableButton( bool togglable ) + * @brief Sets the \e togglable property. + * @param[in] togglable Togglable property */ - void SetTogglableButton( bool togglable ); + void SetTogglableButton(bool togglable); /** - * @copydoc Dali::Toolkit::Button::IsTogglableButton() const + * @brief Sets the button as selected or unselected. + * @param[in] selected Selected property */ - bool IsTogglableButton() const; + void SetSelected(bool selected); /** - * @copydoc Dali::Toolkit::Button::SetSelected( bool selected ) - */ - void SetSelected( bool selected ); - - /** - * @copydoc Dali::Toolkit::Button::IsSelected() const + * @brief Returns if the selected property is set and the button is togglable. + * @return \e true if the button is \e selected */ bool IsSelected() const; /** - * @copydoc Dali::Toolkit::Button::SetAnimationTime() - */ - void SetAnimationTime( float animationTime ); - - /** - * @copydoc Dali::Toolkit::Button::GetAnimationTime() - */ - float GetAnimationTime() const; - - /** - * @copydoc Dali::Toolkit::Button::SetLabel( const std::string& label ) - */ - void SetLabel( const std::string& label ); - - /** - * @copydoc Dali::Toolkit::Button::SetLabel( Actor label ) - */ - void SetLabel( Actor label ); - - /** - * @copydoc Dali::Toolkit::Button::GetLabel() - */ - Actor GetLabel() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image ) - */ - void SetButtonImage( Actor image ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetButtonImage() - */ - Actor GetButtonImage() const; - - /** - * Internal use only. - * @return A reference to the button image. - */ - Actor& GetButtonImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) - */ - void SetSelectedImage( Actor image ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetSelectedImage() - */ - Actor GetSelectedImage() const; - - /** - * Internal use only. - * @return A reference to the selected image. - */ - Actor& GetSelectedImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image ) - */ - void SetBackgroundImage( Actor image ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetBackgroundImage() - */ - Actor GetBackgroundImage() const; - - /** - * Internal use only. - * @return A reference to the background image. - */ - Actor& GetBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::SetSelectedBackgroundImage( Actor image ) - */ - void SetSelectedBackgroundImage( Actor image ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetSelectedBackgroundImage() - */ - Actor GetSelectedBackgroundImage() const; - - /** - * Internal use only. - * @return A reference to the selected background image. - */ - Actor& GetSelectedBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) - */ - void SetDisabledImage( Actor image ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetDisabledImage() - */ - Actor GetDisabledImage() const; - - /** - * Internal use only. - * @return A reference to the disabled button image. - */ - Actor& GetDisabledImage(); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledSelectedImage( Actor image ) - */ - void SetDisabledSelectedImage( Actor image ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetDisabledSelectedImage() - */ - Actor GetDisabledSelectedImage() const; - - /** - * Internal use only. - * @return A reference to the disabled selected image. - */ - Actor& GetDisabledSelectedImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) - */ - void SetDisabledBackgroundImage( Actor image ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage() - */ - Actor GetDisabledBackgroundImage() const; - - /** - * Internal use only. - * @return A reference to the disabled background image. + * @brief Produces a Property::Map of Text properties to create a Text Visual, merging existing properties with supplied map + * If the label does not exist yet, it is created. + * The derived buttons are notified if any properties are changed. + * @param[in] properties A Property::Map of key-value pairs of properties to set. + * @param[out] properties A Property::Map of text visual properties to set after merging inMap with existing maps */ - Actor& GetDisabledBackgroundImage(); + void MergeWithExistingLabelProperties(const Property::Map& inMap, Property::Map& outMap); /** * Performs actions as requested using the action name. @@ -260,136 +127,139 @@ 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 PropertyValueContainer& attributes ); - -protected: - - /** - * @return A reference to the label actor. - */ - Actor& GetLabel(); - - /** - * It changes the transition state of the push button. - */ - void UpdatePaintTransitionState(); - -private: - - /** - * Perform the click action to click the button. - * @param[in] attributes The attributes to perfrom this action. - */ - void DoClickAction( const PropertyValueContainer& attributes ); + static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes); +public: /** - * This method is called after the button initialization. - * Could be reimplemented in subclasses to provide specific behaviour. + * Button's state */ - virtual void OnButtonInitialize() { } + enum State + { + UNSELECTED_STATE, ///< The button is unselected. + SELECTED_STATE, ///< The button is selected. + DISABLED_UNSELECTED_STATE, ///< The button is disabled and unselected. + DISABLED_SELECTED_STATE, ///< The button is disabled and selected. + STATE_COUNT, ///< Number of States + }; /** - * This method is called when the label is set. + * Enum to distinguish the different style-able components of the button */ - virtual void OnLabelSet() {} + enum Visuals + { + UNSELECTED_FOREGROUND = 0, + SELECTED_FOREGROUND, + DISABLED_SELECTED_FOREGROUND, + DISABLED_UNSELECTED_FOREGROUND, + UNSELECTED_BACKGROUND, + SELECTED_BACKGROUND, + DISABLED_UNSELECTED_BACKGROUND, + DISABLED_SELECTED_BACKGROUND, + VISUALS_COUNT + }; /** - * This method is called when the button image is set + * Enum to list types of visual a state can have. */ - virtual void OnButtonImageSet() {} + enum VisualState + { + BACKGROUND = 0, + FOREGROUND, + VISUAL_STATE_COUNT + }; +protected: /** - * This method is called when the selected image is set + * Button press state which is not the same as the actual button's state. + * For example An UNSELECTED button can be DEPRESSED, but until released, the actual button state doesn't change to SELECTED */ - virtual void OnSelectedImageSet() {} + enum PressState + { + DEPRESSED, ///< The button is up. + UNPRESSED, ///< The button is down. + TOGGLE_DEPRESSED, ///< The button has been pressed down and will stay depressed when released. + }; /** - * This method is called when the background image is set + * Construct a new Button. */ - virtual void OnBackgroundImageSet() {} + Button(); /** - * This method is called when the selected background image is set + * A reference counted object may only be deleted by calling Unreference() */ - virtual void OnSelectedBackgroundImageSet() {} - + virtual ~Button(); /** - * This method is called when the disabled button image is set + * @return A reference to the label actor. */ - virtual void OnDisabledImageSet() {} + Actor& GetLabelActor(); /** - * This method is called when the disabled selected image is set + * @return A reference to the unselected button image. */ - virtual void OnDisabledSelectedImageSet() {} + Actor GetUnselectedImage(); /** - * This method is called when the disabled background image is set + * @return A reference to the selected image. */ - virtual void OnDisabledBackgroundImageSet() {} + Actor GetSelectedImage(); +private: /** - * This method is called from the OnTouchEvent method when the button is down. - * Could be reimplemented in subclasses to provide specific behaviour. + * Perform the click action to click the button. + * @param[in] attributes The attributes to perfrom this action. + * @return true if this control can perform action. */ - virtual void OnButtonDown(); + bool DoClickAction(const Property::Map& attributes); /** - * This method is called from the OnTouchEvent method 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. + * @return bool returns true if state changed. */ - virtual void OnButtonUp(); + virtual bool OnToggleReleased(); /** - * This method is called from the OnTouchEvent method when the touch point leaves the boundary of the button or - * more than one touch points are received. + * This method is called when touch leaves the boundary of the button or several touch points are received. * Could be reimplemented in subclasses to provide specific behaviour. */ virtual void OnTouchPointLeave(); /** - * This method is called from the OnTouchEvent method when the touch point is interrupted. + * This method is called when the touch is interrupted. * Could be reimplemented in subclasses to provide specific behaviour. */ 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. - * @return true if the transition animation is started. */ - virtual bool OnSelected() { return false; } + virtual void OnStateChange(State newState) + { + } /** * This method is called when the \e disabled property is changed. - * @return true if the transition animation is started. */ - virtual bool OnDisabled() { return false; } + virtual void OnDisabled() + { + } /** * This method is called when the button is pressed. - * @return true if the transition animation is started. */ - virtual bool OnPressed() { return false; } + virtual void OnPressed() + { + } /** * This method is called when the button is released. - * @return true if the transition animation is started. - */ - virtual bool OnReleased() { return false; } - - /** - * This method stops all animations */ - virtual void StopAllAnimations() {} + virtual void OnReleased() + { + } public: - /** * @copydoc Dali::Toolkit::PushButton::PressedSignal() */ @@ -419,7 +289,7 @@ public: * @return True if the signal was connected. * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. */ - static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); + static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor); // Properties @@ -429,7 +299,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. @@ -437,34 +307,59 @@ 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); -protected: // From CustomActorImpl +protected: // 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. + */ + void OnInitialize() override; /** - * @copydoc Dali::CustomActorImpl::OnTouchEvent( const TouchEvent& event ) + * @copydoc Toolkit::Control::OnAccessibilityActivated() */ - virtual bool OnTouchEvent( const TouchEvent& event ); + bool OnAccessibilityActivated() override; -private: // From Control + /** + * @copydoc Toolkit::Control::OnKeyboardEnter() + */ + bool OnKeyboardEnter() override; /** - * @copydoc Toolkit::Control::OnInitialize() + * @copydoc Toolkit::Control::OnSceneDisconnection() + * @note If overridden by deriving button classes, then an up-call to Button::OnSceneDisconnection MUST be made at the end. + */ + void OnSceneDisconnection() override; + + /** + * @copydoc Toolkit::Control::OnSceneConnection() + */ + void OnSceneConnection(int depth) override; + + /** + * @copydoc Toolkit::Control::GetNaturalSize */ - virtual void OnInitialize(); + Vector3 GetNaturalSize() override; /** - * @copydoc Toolkit::Control::OnActivated() + * @copydoc Toolkit::Control::OnSetResizePolicy */ - virtual void OnActivated(); + void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) override; /** - * Callback received when the button is disconnected from the stage. - * It resets the button status. + * @copydoc Toolkit::Control::OnRelayout */ - void OnControlStageDisconnection(); + void OnRelayout(const Vector2& size, RelayoutContainer& container) override; private: + /** + * @brief Handler for touch data + * @param[in] actor The touched actor. + * @param[in] touch The touch info. + * @return true, if consumed, false otherwise. + */ + bool OnTouch(Actor actor, const TouchEvent& touch); /** * Handler for tap events. @@ -480,7 +375,22 @@ private: * Sets up the autorepeating timer. * @param[in] delay The delay time in seconds. */ - void SetUpTimer( float delay ); + void SetUpTimer(float delay); + + /** + * Button has been 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. @@ -488,16 +398,18 @@ private: bool AutoRepeatingSlot(); /** - * Sets the button as selected or unselected. - * @param[in] selected \e selected property value. - * @param[in] emitSignal Emit a signal if this value is \e true. + * Check the requested state is an allowed transition. + * Some states can not be transitioned to from certain states. + * @param[in] requestedState check if can transition to this state + * @return bool true if state change valid */ - void SetSelected( bool selected, bool emitSignal ); + bool ValidateState(State requestedState); /** - * This method is called when the button is pressed. + * Changes the button state when an action occurs on it + * @param[in] requestedState the state to change to */ - void Pressed(); + void ChangeState(State requestedState); /** * This method is called when the button is released. @@ -505,118 +417,158 @@ private: void Released(); protected: + /** + * Set Text Label Padding + * @param[in] padding BEGIN END BOTTOM TOP + */ + void SetLabelPadding(const Padding& padding); - enum ButtonState - { - ButtonUp, ///< The button is up. - ButtonDown, ///< The button is down. - }; + /** + * Get Text Label padding + * @return Padding + */ + Padding GetLabelPadding(); /** - * Button paint states. + * Set Foreground/icon Padding + * @param[in] padding BEGIN END BOTTOM TOP */ - enum PaintState - { - UnselectedState, ///< The button is unselected. - SelectedState, ///< The button is selected. - DisabledUnselectedState, ///< The button is disabled and unselected. - DisabledSelectedState, ///< The button is disabled and selected. - UnselectedSelectedTransition, ///< The button is in transition from unselected to selected. - SelectedUnselectedTransition, ///< The button is in transition from selected to unselected. - UnselectedDisabledTransition, ///< The button is in transition from unselected to disabled. - DisabledUnselectedTransition, ///< The button is in transition from disabled to unselected. - SelectedDisabledTransition, ///< The button is in transition from selected to disabled. - DisabledSelectedTransition ///< The button is in transition from disabled to selected. - }; + void SetForegroundPadding(const Padding& padding); - ButtonState GetState(); - PaintState GetPaintState(); + /** + * Get Foreground padding + * @ return Padding + */ + Padding GetForegroundPadding(); + + /** + * @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 + * @param[in] visualDepth the depth of the visual if overlapping another + */ + void CreateVisualsForComponent(Property::Index index, const Property::Value& value, const int visualDepth); + + /** + * @brief Get the Property map for the given Visual + * @param[in] visualIndex visual index of the required visual + * @param[out] retreivedMap the property map used to construct the required visual + * @return bool success flag, true if visual found + */ + bool GetPropertyMapForVisual(Property::Index visualIndex, Property::Map& retreivedMap) const; + /** + * Returns the animation to be used for transition, creating the animation if needed. + * @return The initialised transition animation. + */ + Dali::Animation GetTransitionAnimation(); /** - * Inserts the actor to the button. + * @brief Set the position of the label relative to foreground/icon, if both present + * @param[in] labelAlignment given alignment setting */ - void InsertChild( unsigned int index, Actor& actor ); + void SetLabelAlignment(Align labelAlignment); /** - * Removes the actor from the button. + * @brief Get set alignment of label in relation to foreground/icon + * @return Set alignment value */ - void RemoveChild( Actor& actor ); + Align GetLabelAlignment(); /** - * Finds the index of the actor. - * If the actor doesn't exist, return the last index + 1. + * 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. + * Can decide to only remove specified visuals via index */ - unsigned int FindChildIndex( Actor& actor ); + virtual void OnButtonVisualRemoval(Property::Index visualIndex); private: + /** + * Removes the visual from the button and prepares it to be transitioned out + * @param[in] visualIndex the visual to remove + */ + void RemoveVisual(Property::Index visualIndex); + + /** + * Adds the required visual to the button. + * @param[in] visualIndex The Property index of the visual required + */ + void SelectRequiredVisual(Property::Index visualIndex); // Undefined - Button( const Button& ); + Button(const Button&); // Undefined - Button& operator = ( const Button& ); + Button& operator=(const Button&); private: - // Signals - Toolkit::Button::ButtonSignalType mPressedSignal; ///< Signal emitted when the button is pressed. - Toolkit::Button::ButtonSignalType mReleasedSignal; ///< Signal emitted when the button is released. - Toolkit::Button::ButtonSignalType mClickedSignal; ///< Signal emitted when the button is clicked. - Toolkit::Button::ButtonSignalType mStateChangedSignal; ///< Signal emitted when the button's state is changed. + Toolkit::Button::ButtonSignalType mPressedSignal; ///< Signal emitted when the button is pressed. + Toolkit::Button::ButtonSignalType mReleasedSignal; ///< Signal emitted when the button is released. + Toolkit::Button::ButtonSignalType mClickedSignal; ///< Signal emitted when the button is clicked. + Toolkit::Button::ButtonSignalType mStateChangedSignal; ///< Signal emitted when the button's state is changed. - Timer mAutoRepeatingTimer; ///< Timer used to implement the autorepeating property. + Timer mAutoRepeatingTimer; - Actor mLabel; ///< Stores the button label. + Actor mLabel; ///< Stores the button text label. + Padding mLabelPadding; ///< The padding around the label (if present). + Padding mForegroundPadding; ///< The padding around the foreground/icon visual (if present). - Actor mButtonContent; ///< Stores the unselected content. - Actor mSelectedContent; ///< Stores the selected content. - Actor mBackgroundContent; ///< Stores the background content. - Actor mSelectedBackgroundContent; ///< Stores the selected background content. - Actor mDisabledContent; ///< Stores the disabled content. - Actor mDisabledSelectedContent; ///< Stores the disabled selected content. - Actor mDisabledBackgroundContent; ///< Stores the disabled background content. + Align mTextLabelAlignment; ///< Position of text label in relation to foreground/icon when both are present. TapGestureDetector mTapDetector; - bool mDisabled; ///< Stores the disabled property. - bool mAutoRepeating; ///< Stores the autorepeating property. - bool mTogglableButton; ///< Stores the togglable property. - bool mSelected; ///< Stores the selected state. - float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds. - float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds. - float mAnimationTime; ///< The animation time. + bool mAutoRepeating; ///< Stores the autorepeating property. + bool mTogglableButton; ///< Stores the togglable property as a flag. + bool mTextStringSetFlag; ///< Stores if text has been set. Required in relayout but don't want to calculate there. + + float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds. + float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds. + + float mAnimationTime; + + PressState mButtonPressedState; ///< In relation to the button being pressed/released + State mButtonState; + State mPreviousButtonState; ///< During a transition between two states, this stores the previous state so Visuals can be removed. // Actions - bool mClickActionPerforming; + bool mClickActionPerforming; ///< Used to manage signal emissions during action + +protected: + struct AccessibleImpl : public DevelControl::AccessibleImpl + { + using DevelControl::AccessibleImpl::AccessibleImpl; - ButtonState mState; ///< Stores the button state. - PaintState mPaintState; ///< Stores the paint state. + Dali::Accessibility::States CalculateStates() override; + std::string GetNameRaw() override; + Property::Index GetNamePropertyIndex() override; + }; }; } // namespace Internal // Helpers for public-api forwarding methods -inline Toolkit::Internal::Button& GetImplementation( Toolkit::Button& button ) +inline Toolkit::Internal::Button& GetImplementation(Toolkit::Button& button) { - DALI_ASSERT_ALWAYS( button ); + DALI_ASSERT_ALWAYS(button); Dali::RefObject& handle = button.GetImplementation(); - return static_cast( handle ); + return static_cast(handle); } -inline const Toolkit::Internal::Button& GetImplementation( const Toolkit::Button& button ) +inline const Toolkit::Internal::Button& GetImplementation(const Toolkit::Button& button) { - DALI_ASSERT_ALWAYS( button ); + DALI_ASSERT_ALWAYS(button); const Dali::RefObject& handle = button.GetImplementation(); - return static_cast( handle ); + return static_cast(handle); } } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_BUTTON_H__ +#endif // DALI_TOOLKIT_INTERNAL_BUTTON_H