1 #ifndef DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H
2 #define DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
25 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
26 #include "button-impl.h"
35 * PushButton implementation class.
37 * \sa Dali::Toolkit::PushButton
39 class PushButton : public Button
43 * Create a new PushButton.
44 * @return A smart-pointer to the newly allocated PushButton.
46 static Dali::Toolkit::PushButton New();
50 * Construct a new PushButton.
55 * A reference counted object may only be deleted by calling Unreference()
57 virtual ~PushButton();
63 * Enum for the alignment modes of the icon.
75 * Called when a property of an object of this type is set.
76 * @param[in] object The object whose property is set.
77 * @param[in] index The property index.
78 * @param[in] value The new property value.
80 static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
83 * Called to retrieve a property of an object of this type.
84 * @param[in] object The object whose property is to be retrieved.
85 * @param[in] index The property index.
86 * @return The current value of the property.
88 static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
90 private: // From Button
92 * @copydoc Toolkit::Internal::Button::OnInitialize
94 void OnInitialize() override;
98 * @brief Sets the alignment mode to use to align the icon to the label.
100 * @param[in] iconAlignment The alignment mode to use
102 void SetIconAlignment(const PushButton::IconAlignment iconAlignment);
105 * @brief Gets the alignment mode used to align the icon to the label.
107 * @return The alignment mode in use
109 const PushButton::IconAlignment GetIconAlignment() const;
113 PushButton(const PushButton&);
116 PushButton& operator=(const PushButton&);
119 IconAlignment mIconAlignment; ///< The alignment of the icon against the label.
122 class PushButtonAccessible : public Button::ButtonAccessible
125 using Button::ButtonAccessible::ButtonAccessible;
128 * @copydoc Dali::Toolkit::DevelControl::ControlAccessible::CalculateStates()
130 Dali::Accessibility::States CalculateStates() override;
133 void OnStateChange(State newState) override;
136 } // namespace Internal
138 // Helpers for public-api forwarding methods
140 inline Toolkit::Internal::PushButton& GetImplementation(Toolkit::PushButton& button)
142 DALI_ASSERT_ALWAYS(button);
144 Dali::RefObject& handle = button.GetImplementation();
146 return static_cast<Toolkit::Internal::PushButton&>(handle);
149 inline const Toolkit::Internal::PushButton& GetImplementation(const Toolkit::PushButton& button)
151 DALI_ASSERT_ALWAYS(button);
153 const Dali::RefObject& handle = button.GetImplementation();
155 return static_cast<const Toolkit::Internal::PushButton&>(handle);
158 } // namespace Toolkit
162 #endif // DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H