1 #ifndef DALI_TOOLKIT_POPUP_H
2 #define DALI_TOOLKIT_POPUP_H
5 * Copyright (c) 2020 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-toolkit/public-api/controls/control.h>
28 namespace Internal DALI_INTERNAL
34 * @brief The Popup widget provides a configurable pop-up dialog with built-in layout of three main fields.
42 * Please see the programming guide for a detailed description of the Popup including examples.
45 * | %Signal Name | Method |
46 * |-------------------|------------------------------|
47 * | touchedOutside | @ref OutsideTouchedSignal() |
48 * | showing | @ref ShowingSignal() |
49 * | shown | @ref ShownSignal() |
50 * | hiding | @ref HidingSignal() |
51 * | hidden | @ref HiddenSignal() |
53 class DALI_TOOLKIT_API Popup : public Control
57 * @brief The start and end property ranges for this control.
61 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
62 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
66 * @brief An enumeration of properties belonging to the Popup class.
72 TITLE = PROPERTY_START_INDEX, ///< name "title", type Property::Map
73 CONTENT, ///< name "content", type Property::Map
74 FOOTER, ///< name "footer", type Property::Map
75 DISPLAY_STATE, ///< name "displayState", type std::string
76 TOUCH_TRANSPARENT, ///< name "touchTransparent", type bool
77 TAIL_VISIBILITY, ///< name "tailVisibility", type bool
78 TAIL_POSITION, ///< name "tailPosition", type Vector3
79 CONTEXTUAL_MODE, ///< name "contextualMode", type std::string
80 ANIMATION_DURATION, ///< name "animationDuration", type float
81 ANIMATION_MODE, ///< name "animationMode", type std::string
82 ENTRY_ANIMATION, ///< name "entryAnimation", type Property::Map
83 EXIT_ANIMATION, ///< name "exitAnimation", type Property::Map
84 AUTO_HIDE_DELAY, ///< name "autoHideDelay", type int
85 BACKING_ENABLED, ///< name "backingEnabled", type bool
86 BACKING_COLOR, ///< name "backingColor", type Vector4
87 POPUP_BACKGROUND_IMAGE, ///< name "popupBackgroundImage", type std::string
88 POPUP_BACKGROUND_BORDER, ///< name "popupBackgroundBorder", type Rect< int >, Values are in the order: left, right, bottom, top
89 TAIL_UP_IMAGE, ///< name "tailUpImage", type std::string
90 TAIL_DOWN_IMAGE, ///< name "tailDownImage", type std::string
91 TAIL_LEFT_IMAGE, ///< name "tailLeftImage", type std::string
92 TAIL_RIGHT_IMAGE, ///< name "tailRightImage", type std::string
97 * The display states of the Popup.
101 SHOWING, ///< The popup is transitioning in
102 SHOWN, ///< The popup is fully shown
103 HIDING, ///< The popup is transitioning out
104 HIDDEN ///< The popup is fully hidden
108 * The animation mode within popup.
109 * Choose from a predefined mode or "CUSTOM" to use the ANIMATION_IN and ANIMATION_OUT properties.
113 NONE, ///< No animation.
114 ZOOM, ///< Popup zooms in and out animating the scale property.
115 FADE, ///< Popup fades in and out.
116 CUSTOM ///< Use the EntryAnimation and ExitAnimation animation properties.
120 * Types of contextual layout.
121 * The Popup is positioned adjacent to it's parent in the direction specified by this mode.
122 * NON_CONTEXTUAL disables any contextual positioning.
135 * @brief Creates an empty Popup handle.
140 * @brief Create the Popup control.
142 * @return A handle to the Popup control.
149 * This is non-virtual since derived Handle types must not contain data or virtual methods.
154 * @brief Copy constructor.
156 * Creates another handle that points to the same real object
157 * @param[in] handle Handle to the copied object
159 Popup(const Popup& handle);
162 * @brief Assignment operator.
164 * Changes this handle to point to another real object
165 * @param[in] handle Handle to the object
166 * @return A reference to this
168 Popup& operator=(const Popup& handle);
171 * @brief Downcast an Object handle to Popup.
173 * If handle points to a Popup the
174 * downcast produces valid handle. If not the returned handle is left uninitialized.
175 * @param[in] handle Handle to an object
176 * @return handle to a Popup or an uninitialized handle
178 static Popup DownCast(BaseHandle handle);
182 * @brief Sets a title for this Popup.
184 * @param[in] titleActor Any actor can be specified when using this method.
186 void SetTitle(Actor titleActor);
189 * @brief Gets the title actor for this Popup.
191 * @return The actor representing the title is returned.
193 Actor GetTitle() const;
196 * @brief Sets the content actor.
197 * This can any actor type or heirarchy of actors.
199 * @param[in] content The actor to use.
201 void SetContent(Actor content);
204 * @brief Gets the actor currently used for the content.
206 * @return The content actor.
208 Actor GetContent() const;
211 * @brief Sets the actor to use for a footer in this Popup.
213 * @param[in] footer The footer actor to be added to this Popup
215 void SetFooter(Actor footer);
218 * @brief Gets the footer actor.
220 * @return The footer actor.
222 Actor GetFooter() const;
225 * @brief Sets the display state of Popup.
227 * There are 4 total display states.
228 * Only 2 can be set, but all four can be read for better inspection of the current popup state.
230 * The other two states are getable, but not setable and are there for consistency.
232 * | Value | Setting the state | Getting the state |
233 * |----------|--------------------------------|--------------------------------|
234 * | SHOWN | Show the popup | The popup is fully shown |
235 * | HIDDEN | Hide the popup | The popup is fully hidden |
236 * | SHOWING | | The popup is transitioning in |
237 * | HIDING | | The popup is transitioning out |
239 * All 4 state changes cause notifications via 4 respective signals that can be connected to.
240 * @see GetDisplayState()
242 * @param[in] displayState The desired display state to change to.
244 void SetDisplayState(Toolkit::Popup::DisplayState displayState);
247 * @brief Gets the current state of the popup.
249 * This will also show if the popup is in the process of showing or hiding.
251 * @return The current state of the popup.
253 Toolkit::Popup::DisplayState GetDisplayState() const;
256 typedef Signal<void()> TouchedOutsideSignalType; ///< Touched outside signal type.
257 typedef Signal<void()> DisplayStateChangeSignalType; ///< Used for signals emitted when the displayed state changes.
260 * @brief Signal emitted when user has touched outside of the Dialog.
262 TouchedOutsideSignalType& OutsideTouchedSignal();
265 * @brief Signal emitted when the Popup is starting to be shown.
267 DisplayStateChangeSignalType& ShowingSignal();
270 * @brief Signal emitted when the Popup has been fully displayed.
272 DisplayStateChangeSignalType& ShownSignal();
275 * @brief Signal emitted when the Popup is starting to be hidden.
277 DisplayStateChangeSignalType& HidingSignal();
280 * @brief Signal emitted when the Popup has been completely hidden.
282 DisplayStateChangeSignalType& HiddenSignal();
284 public: // Not intended for application developers
286 * @brief Creates a handle using the Toolkit::Internal implementation.
288 * @param[in] implementation The Control implementation.
290 DALI_INTERNAL Popup(Internal::Popup& implementation);
293 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
295 * @param[in] internal A pointer to the internal CustomActor.
297 explicit DALI_INTERNAL Popup(Dali::Internal::CustomActor* internal);
300 } // namespace Toolkit
304 #endif // DALI_TOOLKIT_POPUP_H