1 #ifndef __DALI_TOOLKIT_POPUP_H__
2 #define __DALI_TOOLKIT_POPUP_H__
5 * Copyright (c) 2015 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_IMPORT_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 TAIL_UP_IMAGE, ///< name "tailUpImage", type std::string
93 TAIL_DOWN_IMAGE, ///< name "tailDownImage", type std::string
94 TAIL_LEFT_IMAGE, ///< name "tailLeftImage", type std::string
95 TAIL_RIGHT_IMAGE, ///< name "tailRightImage", type std::string
100 * The display states of the Popup.
104 SHOWING, ///< The popup is transitioning in
105 SHOWN, ///< The popup is fully shown
106 HIDING, ///< The popup is transitioning out
107 HIDDEN ///< The popup is fully hidden
111 * The animation mode within popup.
112 * Choose from a predefined mode or "CUSTOM" to use the ANIMATION_IN and ANIMATION_OUT properties.
116 NONE, ///< No animation.
117 ZOOM, ///< Popup zooms in and out animating the scale property.
118 FADE, ///< Popup fades in and out.
119 CUSTOM ///< Use the EntryAnimation and ExitAnimation animation properties.
123 * Types of contextual layout.
124 * The Popup is positioned adjacent to it's parent in the direction specified by this mode.
125 * NON_CONTEXTUAL disables any contextual positioning.
139 * @brief Creates an empty Popup handle.
144 * @brief Create the Popup control.
146 * @return A handle to the Popup control.
153 * This is non-virtual since derived Handle types must not contain data or virtual methods.
158 * @brief Copy constructor.
160 * Creates another handle that points to the same real object
161 * @param[in] handle Handle to the copied object
163 Popup( const Popup& handle );
166 * @brief Assignment operator.
168 * Changes this handle to point to another real object
169 * @param[in] handle Handle to the object
170 * @return A reference to this
172 Popup& operator=( const Popup& handle );
175 * @brief Downcast an Object handle to Popup.
177 * If handle points to a Popup the
178 * downcast produces valid handle. If not the returned handle is left uninitialized.
179 * @param[in] handle Handle to an object
180 * @return handle to a Popup or an uninitialized handle
182 static Popup DownCast( BaseHandle handle );
187 * @brief Sets a title for this Popup.
189 * @param[in] titleActor Any actor can be specified when using this method.
191 void SetTitle( Actor titleActor );
194 * @brief Gets the title actor for this Popup.
196 * @return The actor representing the title is returned.
198 Actor GetTitle() const;
201 * @brief Sets the content actor.
202 * This can any actor type or heirarchy of actors.
204 * @param[in] content The actor to use.
206 void SetContent( Actor content );
209 * @brief Gets the actor currently used for the content.
211 * @return The content actor.
213 Actor GetContent() const;
216 * @brief Sets the actor to use for a footer in this Popup.
218 * @param[in] footer The footer actor to be added to this Popup
220 void SetFooter( Actor footer );
223 * @brief Gets the footer actor.
225 * @return The footer actor.
227 Actor GetFooter() const;
230 * @brief Sets the display state of Popup.
232 * There are 4 total display states.
233 * Only 2 can be set, but all four can be read for better inspection of the current popup state.
235 * The other two states are getable, but not setable and are there for consistency.
237 * | Value | Setting the state | Getting the state |
238 * |----------|--------------------------------|--------------------------------|
239 * | SHOWN | Show the popup | The popup is fully shown |
240 * | HIDDEN | Hide the popup | The popup is fully hidden |
241 * | SHOWING | | The popup is transitioning in |
242 * | HIDING | | The popup is transitioning out |
244 * All 4 state changes cause notifications via 4 respective signals that can be connected to.
245 * @see GetDisplayState()
247 * @param[in] displayState The desired display state to change to.
249 void SetDisplayState( Toolkit::Popup::DisplayState displayState );
252 * @brief Gets the current state of the popup.
254 * This will also show if the popup is in the process of showing or hiding.
256 * @return The current state of the popup.
258 Toolkit::Popup::DisplayState GetDisplayState() const;
262 typedef Signal< void () > TouchedOutsideSignalType; ///< Touched outside signal type.
263 typedef Signal< void () > DisplayStateChangeSignalType; ///< Used for signals emitted when the displayed state changes.
266 * @brief Signal emitted when user has touched outside of the Dialog.
268 TouchedOutsideSignalType& OutsideTouchedSignal();
271 * @brief Signal emitted when the Popup is starting to be shown.
273 DisplayStateChangeSignalType& ShowingSignal();
276 * @brief Signal emitted when the Popup has been fully displayed.
278 DisplayStateChangeSignalType& ShownSignal();
281 * @brief Signal emitted when the Popup is starting to be hidden.
283 DisplayStateChangeSignalType& HidingSignal();
286 * @brief Signal emitted when the Popup has been completely hidden.
288 DisplayStateChangeSignalType& HiddenSignal();
290 public: // Not intended for application developers
293 * @brief Creates a handle using the Toolkit::Internal implementation.
295 * @param[in] implementation The Control implementation.
297 DALI_INTERNAL Popup( Internal::Popup& implementation );
300 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
302 * @param[in] internal A pointer to the internal CustomActor.
304 explicit DALI_INTERNAL Popup( Dali::Internal::CustomActor* internal );
307 } // namespace Toolkit
311 #endif // __DALI_TOOLKIT_POPUP_H__