1 #ifndef DALI_TOOLKIT_POPUP_H
2 #define DALI_TOOLKIT_POPUP_H
5 * Copyright (c) 2019 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>
30 namespace Internal DALI_INTERNAL
36 * @brief The Popup widget provides a configurable pop-up dialog with built-in layout of three main fields.
44 * Please see the programming guide for a detailed description of the Popup including examples.
47 * | %Signal Name | Method |
48 * |-------------------|------------------------------|
49 * | touchedOutside | @ref OutsideTouchedSignal() |
50 * | showing | @ref ShowingSignal() |
51 * | shown | @ref ShownSignal() |
52 * | hiding | @ref HidingSignal() |
53 * | hidden | @ref HiddenSignal() |
55 class DALI_TOOLKIT_API Popup : public Control
61 * @brief The start and end property ranges for this control.
65 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
66 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
70 * @brief An enumeration of properties belonging to the Popup class.
76 TITLE = PROPERTY_START_INDEX, ///< name "title", type Property::Map
77 CONTENT, ///< name "content", type Property::Map
78 FOOTER, ///< name "footer", type Property::Map
79 DISPLAY_STATE, ///< name "displayState", type std::string
80 TOUCH_TRANSPARENT, ///< name "touchTransparent", type bool
81 TAIL_VISIBILITY, ///< name "tailVisibility", type bool
82 TAIL_POSITION, ///< name "tailPosition", type Vector3
83 CONTEXTUAL_MODE, ///< name "contextualMode", type std::string
84 ANIMATION_DURATION, ///< name "animationDuration", type float
85 ANIMATION_MODE, ///< name "animationMode", type std::string
86 ENTRY_ANIMATION, ///< name "entryAnimation", type Property::Map
87 EXIT_ANIMATION, ///< name "exitAnimation", type Property::Map
88 AUTO_HIDE_DELAY, ///< name "autoHideDelay", type int
89 BACKING_ENABLED, ///< name "backingEnabled", type bool
90 BACKING_COLOR, ///< name "backingColor", type Vector4
91 POPUP_BACKGROUND_IMAGE, ///< name "popupBackgroundImage", type std::string
92 POPUP_BACKGROUND_BORDER, ///< name "popupBackgroundBorder", type Rect< int >, Values are in the order: left, right, bottom, top
93 TAIL_UP_IMAGE, ///< name "tailUpImage", type std::string
94 TAIL_DOWN_IMAGE, ///< name "tailDownImage", type std::string
95 TAIL_LEFT_IMAGE, ///< name "tailLeftImage", type std::string
96 TAIL_RIGHT_IMAGE, ///< name "tailRightImage", type std::string
101 * The display states of the Popup.
105 SHOWING, ///< The popup is transitioning in
106 SHOWN, ///< The popup is fully shown
107 HIDING, ///< The popup is transitioning out
108 HIDDEN ///< The popup is fully hidden
112 * The animation mode within popup.
113 * Choose from a predefined mode or "CUSTOM" to use the ANIMATION_IN and ANIMATION_OUT properties.
117 NONE, ///< No animation.
118 ZOOM, ///< Popup zooms in and out animating the scale property.
119 FADE, ///< Popup fades in and out.
120 CUSTOM ///< Use the EntryAnimation and ExitAnimation animation properties.
124 * Types of contextual layout.
125 * The Popup is positioned adjacent to it's parent in the direction specified by this mode.
126 * NON_CONTEXTUAL disables any contextual positioning.
140 * @brief Creates an empty Popup handle.
145 * @brief Create the Popup control.
147 * @return A handle to the Popup control.
154 * This is non-virtual since derived Handle types must not contain data or virtual methods.
159 * @brief Copy constructor.
161 * Creates another handle that points to the same real object
162 * @param[in] handle Handle to the copied object
164 Popup( const Popup& handle );
167 * @brief Assignment operator.
169 * Changes this handle to point to another real object
170 * @param[in] handle Handle to the object
171 * @return A reference to this
173 Popup& operator=( const Popup& handle );
176 * @brief Downcast an Object handle to Popup.
178 * If handle points to a Popup the
179 * downcast produces valid handle. If not the returned handle is left uninitialized.
180 * @param[in] handle Handle to an object
181 * @return handle to a Popup or an uninitialized handle
183 static Popup DownCast( BaseHandle handle );
188 * @brief Sets a title for this Popup.
190 * @param[in] titleActor Any actor can be specified when using this method.
192 void SetTitle( Actor titleActor );
195 * @brief Gets the title actor for this Popup.
197 * @return The actor representing the title is returned.
199 Actor GetTitle() const;
202 * @brief Sets the content actor.
203 * This can any actor type or heirarchy of actors.
205 * @param[in] content The actor to use.
207 void SetContent( Actor content );
210 * @brief Gets the actor currently used for the content.
212 * @return The content actor.
214 Actor GetContent() const;
217 * @brief Sets the actor to use for a footer in this Popup.
219 * @param[in] footer The footer actor to be added to this Popup
221 void SetFooter( Actor footer );
224 * @brief Gets the footer actor.
226 * @return The footer actor.
228 Actor GetFooter() const;
231 * @brief Sets the display state of Popup.
233 * There are 4 total display states.
234 * Only 2 can be set, but all four can be read for better inspection of the current popup state.
236 * The other two states are getable, but not setable and are there for consistency.
238 * | Value | Setting the state | Getting the state |
239 * |----------|--------------------------------|--------------------------------|
240 * | SHOWN | Show the popup | The popup is fully shown |
241 * | HIDDEN | Hide the popup | The popup is fully hidden |
242 * | SHOWING | | The popup is transitioning in |
243 * | HIDING | | The popup is transitioning out |
245 * All 4 state changes cause notifications via 4 respective signals that can be connected to.
246 * @see GetDisplayState()
248 * @param[in] displayState The desired display state to change to.
250 void SetDisplayState( Toolkit::Popup::DisplayState displayState );
253 * @brief Gets the current state of the popup.
255 * This will also show if the popup is in the process of showing or hiding.
257 * @return The current state of the popup.
259 Toolkit::Popup::DisplayState GetDisplayState() const;
263 typedef Signal< void () > TouchedOutsideSignalType; ///< Touched outside signal type.
264 typedef Signal< void () > DisplayStateChangeSignalType; ///< Used for signals emitted when the displayed state changes.
267 * @brief Signal emitted when user has touched outside of the Dialog.
269 TouchedOutsideSignalType& OutsideTouchedSignal();
272 * @brief Signal emitted when the Popup is starting to be shown.
274 DisplayStateChangeSignalType& ShowingSignal();
277 * @brief Signal emitted when the Popup has been fully displayed.
279 DisplayStateChangeSignalType& ShownSignal();
282 * @brief Signal emitted when the Popup is starting to be hidden.
284 DisplayStateChangeSignalType& HidingSignal();
287 * @brief Signal emitted when the Popup has been completely hidden.
289 DisplayStateChangeSignalType& HiddenSignal();
291 public: // Not intended for application developers
294 * @brief Creates a handle using the Toolkit::Internal implementation.
296 * @param[in] implementation The Control implementation.
298 DALI_INTERNAL Popup( Internal::Popup& implementation );
301 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
303 * @param[in] internal A pointer to the internal CustomActor.
305 explicit DALI_INTERNAL Popup( Dali::Internal::CustomActor* internal );
308 } // namespace Toolkit
312 #endif // DALI_TOOLKIT_POPUP_H