1 #ifndef __DALI_TOOLKIT_POPUP_H__
2 #define __DALI_TOOLKIT_POPUP_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 * @addtogroup CAPI_DALI_FRAMEWORK
26 #include <dali-toolkit/public-api/controls/control.h>
27 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
29 namespace Dali DALI_IMPORT_API
35 namespace Internal DALI_INTERNAL
43 * Popup contains content that can come into focus when
44 * activated, and out of focus when deactivated.
48 * The content within a popup consists of:
52 * 3. Background/Frame (i.e. Scale-9 image)
53 * 4. Custom Content (Actors)
55 * All of which are optional.
59 * A popup can be in a number of states:
62 * 2. SHOW (visible at normal size)
63 * 3. SHOW_MAXIMIZED (visible occupying full parent size)
64 * 4. Or custom defined.
68 * A popup can use various custom transition effects e.g.
70 * Alpha fade, Scaling transition, position/rotation, shader effects.
73 class Popup : public Control
79 static const char* const SIGNAL_TOUCHED_OUTSIDE;
80 static const char* const SIGNAL_HIDDEN;
83 * The names of custom properties installed by this control.
86 static const char* const PROPERTY_TITLE; ///< name "title", type string.
87 static const char* const PROPERTY_STATE; ///< name "state", type string.
94 POPUP_NONE, ///< Init status
95 POPUP_HIDE, ///< Hidden (not visible)
96 POPUP_SHOW, ///< Shown (visible in default size)
99 typedef SignalV2< void () > TouchedOutsideSignalV2;
100 typedef SignalV2< void () > HiddenSignalV2;
103 * Signal emitted when user has touched outside of the Dialog.
105 TouchedOutsideSignalV2& OutsideTouchedSignal();
108 * Signal emitted when popup has been hidden.
110 HiddenSignalV2& HiddenSignal();
115 * Creates an empty Popup handle
120 * Copy constructor. Creates another handle that points to the same real object
122 Popup( const Popup& handle );
125 * Assignment operator. Changes this handle to point to another real object
127 Popup& operator=( const Popup& handle );
130 * Virtual destructor.
131 * Dali::Object derived classes typically do not contain member data.
136 * Create the Poup control
137 * @return A handle to the Popup control.
142 * Downcast an Object handle to Popup. If handle points to a Popup the
143 * downcast produces valid handle. If not the returned handle is left uninitialized.
144 * @param[in] handle Handle to an object
145 * @return handle to a Popup or an uninitialized handle
147 static Popup DownCast( BaseHandle handle );
152 * Sets the background image for this Popup.
154 * The background is resized (stretched according to scale settings),
155 * to the size of the Popup.
157 * @param[in] image The Background ImageActor to cover background
159 void SetBackgroundImage( Actor image );
162 * Sets a title for this Popup.
164 * By default a TextView is created with following settings: black color, split-by-word multi-line policy and split exceed policy.
166 * @param[in] text The text to appear as the heading for this Popup
168 void SetTitle( const std::string& text );
171 * Sets a title for this Popup.
173 * @param[in] titleActor The TextView to appear as the heading for this Popup
175 void SetTitle( TextView titleActor );
178 * Gets the text (TextView) for this Popup.
180 * @return The TextView representing this popup is returned.
182 TextView GetTitle() const;
185 * Adds a button to this Popup.
187 * Buttons are added to the bottom of the Popup and Centered.
189 * By default the first button added will have the focus, and the focus will
190 * shift to other buttons based on the sequence in which they are added to the popup.
192 * @param[in] button The button to be added to this Popup
194 void AddButton( Button button );
197 * Sets state of Popup, such as HIDE, and SHOW.
199 * The Popup will instantaneously jump to this state.
201 * @param[in] state The state of the popup
203 void SetState( PopupState state );
206 * Sets state of Popup, such as HIDE, and SHOW.
208 * The Popup will smoothly animate to this state.
210 * @param[in] state The state of the popup
211 * @param[in] duration The time to animate to this new state.
213 void SetState( PopupState state, float duration );
216 * Gets the state of the popup.
217 * @return The state of the popup.
219 PopupState GetState() const;
224 * The Popup will animate to the SHOW state
231 * The Popup will animate to the HIDE state
238 * The tail position is specified relative to it's Parent.
239 * To display at top center for instace, pass:
241 * ParentOrigin::TOP_CENTER
243 * @note The tail images are defined inside PopupStyle as
244 * tailUpImage, tailDownImage, tailLeftImage, and tailRightImage
246 * @param[in] position A position around the perimeter of the Parent.
248 void ShowTail(const Vector3& position);
255 public: // Not intended for application developers
258 * Creates a handle using the Toolkit::Internal implementation.
259 * @param[in] implementation The Control implementation.
261 Popup(Internal::Popup& implementation);
264 * Allows the creation of this Control from an Internal::CustomActor pointer.
265 * @param[in] internal A pointer to the internal CustomActor.
267 Popup( Dali::Internal::CustomActor* internal );
270 } // namespace Toolkit
277 #endif // __DALI_TOOLKIT_POPUP_H__