X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Ftoggle-button-impl.h;h=322285b1dcf0d87fba8b2b3b7ddef60dd81fbb09;hb=e06940d202331c003c1ec793143efd20437cc9f3;hp=2c4f7536242791ad95aa901bab7abcfa49360447;hpb=acbe10c62c46a30c58e08d8971a736f04e68dbf8;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/toggle-button-impl.h b/dali-toolkit/internal/controls/buttons/toggle-button-impl.h index 2c4f753..322285b 100644 --- a/dali-toolkit/internal/controls/buttons/toggle-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/toggle-button-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TOGGLE_BUTTON_H /* - * Copyright (c) 2019 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,9 +20,8 @@ // EXTERNAL INCLUDES #include -#include #include - +#include // INTERNAL INCLUDES #include @@ -30,13 +29,10 @@ namespace Dali { - namespace Toolkit { - namespace Internal { - /** * ToggleButton implementation class. * @@ -45,7 +41,6 @@ namespace Internal class ToggleButton : public Button { public: - /** * Create a new ToggleButton. * @return A smart-pointer to the newly allocated ToggleButton. @@ -53,7 +48,6 @@ public: static Dali::Toolkit::ToggleButton New(); protected: - /** * Construct a new ToggleButton. */ @@ -65,14 +59,13 @@ protected: virtual ~ToggleButton(); public: - /** * Called when a property of an object of this type is set. * @param[in] object The object whose property is set. * @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. @@ -80,22 +73,21 @@ 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: - /** * Called to create all toggle visuals and save them to mToggleVisuals. * @param[in] states The array store toggle states. * @param[out] visuals The created state visual vector. */ - void CreateVisualsForAllStates( const Property::Array& states, std::vector& visuals ); + void CreateVisualsForAllStates(const Property::Array& states, std::vector& visuals); /** * Called to set toggle states when TOGGLE_STATES is set in SetProperty function. * @param[in] states The array store toggle states. */ - void SetToggleStates( const Property::Array& states ); + void SetToggleStates(const Property::Array& states); /** * Called to retrieve toggle states. @@ -107,7 +99,7 @@ private: * Called to set toggle tooltips when TOGGLE_TIPS is set in SetProperty function. * @param[in] tips The array store toggle tips. */ - void SetToggleTooltips( std::vector& tips ); + void SetToggleTooltips(std::vector& tips); /** * Called to retrieve toggle tips. @@ -127,64 +119,71 @@ private: * @param[in] index The index of visual to relayout. * @param[in] size The size of control. */ - void RelayoutVisual( Property::Index index, const Vector2& size ); + void RelayoutVisual(Property::Index index, const Vector2& size); private: // From Button - /** * @copydoc Toolkit::Internal::Button::OnInitialize */ - virtual void OnInitialize(); + void OnInitialize() override; /** * @copydoc Toolkit::Internal::Button::OnRelayout */ - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); + void OnRelayout(const Vector2& size, RelayoutContainer& container) override; /** * This method is called when the button is pressed. */ - virtual void OnPressed(); + void OnPressed() override; private: - // Undefined - ToggleButton( const ToggleButton& ); + ToggleButton(const ToggleButton&); // Undefined - ToggleButton& operator=( const ToggleButton& ); + ToggleButton& operator=(const ToggleButton&); private: - - Property::Array mToggleStates; ///< Toggle states, string or map. - std::vector mToggleVisuals; ///< Save all unselected visuals. - std::vector mToggleSelectedVisuals; ///< Save all selected visuals. - std::vector mToggleDisabledVisuals; ///< Save all disabled unselected visuals. - std::vector mToggleDisabledSelectedVisuals; ///< Save all disabled selected visuals. - std::vector mToggleTooltips; ///< Toggle tooltips. - unsigned int mCurrentToggleIndex; ///< The index of state. + Property::Array mToggleStates; ///< Toggle states, string or map. + std::vector mToggleVisuals; ///< Save all unselected visuals. + std::vector mToggleSelectedVisuals; ///< Save all selected visuals. + std::vector mToggleDisabledVisuals; ///< Save all disabled unselected visuals. + std::vector mToggleDisabledSelectedVisuals; ///< Save all disabled selected visuals. + std::vector mToggleTooltips; ///< Toggle tooltips. + unsigned int mCurrentToggleIndex; ///< The index of state. +protected: + struct AccessibleImpl : public Button::AccessibleImpl + { + using Button::AccessibleImpl::AccessibleImpl; + + Dali::Accessibility::States CalculateStates() override; + std::string GetDescriptionRaw() override; + Property::Index GetDescriptionPropertyIndex() override; + }; + void OnStateChange(State newState) override; }; } // namespace Internal // Helpers for public-api forwarding methods -inline Toolkit::Internal::ToggleButton& GetImplementation( Toolkit::ToggleButton& button ) +inline Toolkit::Internal::ToggleButton& GetImplementation(Toolkit::ToggleButton& 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::ToggleButton& GetImplementation( const Toolkit::ToggleButton& button ) +inline const Toolkit::Internal::ToggleButton& GetImplementation(const Toolkit::ToggleButton& 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