1 #ifndef __DALI_TOOLKIT_POPUP_H__
2 #define __DALI_TOOLKIT_POPUP_H__
5 * Copyright (c) 2014 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
38 * @brief Popup contains content that can come into focus when activated, and out of focus when deactivated.
42 * The content within a popup consists of:
46 * 3. Background/Frame (i.e. Scale-9 image)
47 * 4. Custom Content (Actors)
49 * All of which are optional.
53 * A popup can be in a number of states:
56 * 2. SHOW (visible at normal size)
57 * 3. SHOW_MAXIMIZED (visible occupying full parent size)
58 * 4. Or custom defined.
62 * A popup can use various custom transition effects, e.g.
63 * Alpha fade, Scaling transition, position/rotation, shader effects.
66 * | %Signal Name | Method |
67 * |-------------------|------------------------------|
68 * | touched-outside | @ref OutsideTouchedSignal() |
69 * | hidden | @ref HiddenSignal() |
71 class DALI_IMPORT_API Popup : public Control
77 * @brief Current popup state.
81 POPUP_NONE, ///< Init status
82 POPUP_HIDE, ///< Hidden (not visible)
83 POPUP_SHOW, ///< Shown (visible in default size)
86 typedef Signal< void () > TouchedOutsideSignalType; ///< Touched outside signal type.
87 typedef Signal< void () > HiddenSignalType; ///< Hidden signal type.
90 * @brief Signal emitted when user has touched outside of the Dialog.
92 TouchedOutsideSignalType& OutsideTouchedSignal();
95 * @brief Signal emitted when popup has been hidden.
97 HiddenSignalType& HiddenSignal();
102 * @brief Creates an empty Popup handle.
107 * @brief Copy constructor.
109 * Creates another handle that points to the same real object
110 * @param[in] handle Handle to the copied object
112 Popup( const Popup& handle );
115 * @brief Assignment operator.
117 * Changes this handle to point to another real object
118 * @param[in] handle Handle to the object
119 * @return A reference to this
121 Popup& operator=( const Popup& handle );
126 * This is non-virtual since derived Handle types must not contain data or virtual methods.
131 * @brief Create the Poup control.
133 * @return A handle to the Popup control.
138 * @brief Downcast an Object handle to Popup.
140 * If handle points to a Popup the
141 * downcast produces valid handle. If not the returned handle is left uninitialized.
142 * @param[in] handle Handle to an object
143 * @return handle to a Popup or an uninitialized handle
145 static Popup DownCast( BaseHandle handle );
150 * @brief Sets the background image for this Popup.
152 * The background is resized (stretched according to scale settings),
153 * to the size of the Popup.
155 * @param[in] image The Background ImageActor to cover background
157 void SetBackgroundImage( Actor image );
160 * @brief Sets a title for this Popup.
162 * By default a TextView is created with following settings: black color, split-by-word multi-line policy and split exceed policy.
164 * @param[in] text The text to appear as the heading for this Popup
166 void SetTitle( const std::string& text );
169 * @brief Gets the text (TextView) for this Popup.
171 * @return The text to appear as the heading for this Popup
173 std::string GetTitle() const;
176 * @brief Adds a button to this Popup.
178 * Buttons are added to the bottom of the Popup and Centered.
180 * By default the first button added will have the focus, and the focus will
181 * shift to other buttons based on the sequence in which they are added to the popup.
183 * @param[in] button The button to be added to this Popup
185 void AddButton( Button button );
188 * @brief Sets state of Popup, such as HIDE, and SHOW.
190 * The Popup will instantaneously jump to this state.
192 * @param[in] state The state of the popup
194 void SetState( PopupState state );
197 * @brief Sets state of Popup, such as HIDE, and SHOW.
199 * The Popup will smoothly animate to this state.
201 * @param[in] state The state of the popup
202 * @param[in] duration The time to animate to this new state.
204 void SetState( PopupState state, float duration );
207 * @brief Gets the state of the popup.
209 * @return The state of the popup.
211 PopupState GetState() const;
214 * @brief Shows the popup.
216 * The Popup will animate to the SHOW state
221 * @brief Hides the popup.
223 * The Popup will animate to the HIDE state
228 * @brief Shows the tail.
230 * The tail position is specified relative to it's Parent.
231 * To display at top center for instace, pass:
233 * ParentOrigin::TOP_CENTER
235 * @note The tail images are defined inside PopupStyle as
236 * tailUpImage, tailDownImage, tailLeftImage, and tailRightImage
238 * @param[in] position A position around the perimeter of the Parent.
240 void ShowTail(const Vector3& position);
243 * @brief Hides the tail.
248 * @brief Flag the popup as dirty for relayout
250 void MarkDirtyForRelayout();
252 public: // Not intended for application developers
255 * @brief Creates a handle using the Toolkit::Internal implementation.
257 * @param[in] implementation The Control implementation.
259 DALI_INTERNAL Popup(Internal::Popup& implementation);
262 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
264 * @param[in] internal A pointer to the internal CustomActor.
266 explicit DALI_INTERNAL Popup( Dali::Internal::CustomActor* internal );
269 } // namespace Toolkit
273 #endif // __DALI_TOOLKIT_POPUP_H__