1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_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/dali.h>
24 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
25 #include <dali-toolkit/public-api/controls/buttons/button.h>
37 * @brief Class to create and Popup bar made up of buttons.
38 * It provides signals when a button is pressed.
39 * The Popup must be positioned by it's owner.
40 * The future plan is to reuse the Toolkit Popup control to house the buttons.
43 class TextInputPopupNew : public ConnectionTracker
57 static const char* const SIGNAL_PRESSED;
58 static const char* const SIGNAL_HIDE_FINISHED;
59 static const char* const SIGNAL_SHOW_FINISHED;
61 // Popup Button Pressed
62 typedef SignalV2< bool( Toolkit::Button ) > PopUpPressedSignal;
64 // Popup Hide Finished
65 typedef SignalV2< void( TextInputPopupNew& ) > PopUpHideFinishedSignal;
67 // Popup Show Finished
68 typedef SignalV2< void( TextInputPopupNew& ) > PopUpShowFinishedSignal;
71 * Signal emitted when the button is touched.
73 PopUpPressedSignal& PressedSignal() { return mPressedSignal; }
76 * Signal emitted when popup is completely hidden
77 * @note Only occurs after a Show() call with animation enabled.
79 PopUpHideFinishedSignal& HideFinishedSignal() {return mHideFinishedSignal;}
82 * Signal emitted when popup is completely shown
83 * @note Only occurs after a Hide() call with animation enabled.
85 PopUpShowFinishedSignal& ShowFinishedSignal() {return mShowFinishedSignal;}
91 * Creates an empty popup base actor (no content i.e. invisible)
93 TextInputPopupNew(){};
98 ~TextInputPopupNew(){};
101 * @return The root actor of for this popup is returned.
103 Actor Self() { return mRootActor; };
106 * Clears popup options (popup no longer exists)
112 * @param[in] styledCaption The text to be displayed
113 * @return the newly created label
115 Toolkit::TextView CreateLabel( const MarkupProcessor::StyledTextArray& styledCaption ){return Toolkit::TextView();};
119 * @param[in] iconImage the image to be used
120 * @return the newly created Image actor to be used as the icon
122 ImageActor CreateIcon( Image iconImage ) {return ImageActor();};
125 * Creates and sets up the popup background
127 void CreatePopUpBackground(){};
130 * Create divider if multiple options
132 void CreateDivider(){};
135 * Create a background to be used when button pressed
136 * @param[in] requiredSize size Image actor should be
137 * @param[in] finalFlag flag to be set if option is the final one.
138 * @return Returns an Image Actor to be used a pressed background
140 ImageActor CreatePressedBackground( const Vector3 requiredSize, const bool finalFlag ){ return ImageActor(); };
143 * Adds a popup option button.
144 * @note Creates popup frame if not already created.
145 * @param[in] name The unique name for this option.
146 * @param[in] caption The caption (label) for this option
147 * @param[in] iconImage Image to displayed with text.
148 * @param[in] finalOption Flag to indicate that this is the final option.
149 * (set to true on the last option you add)
151 void AddButton(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption ){};
155 * @param[in] animate (optional) whether to animate popup to hide state over time (i.e. tween).
157 void Hide(bool animate = true){};
161 * @param[in] animate (optional) whether to animate popup to show state over time (i.e. tween).
162 * @param[in] target Actor to parent popup.
164 void Show( Actor target, bool animate = true ){};
167 * @brief Get the calculated size of the PopUp
168 * This can not be set directly as is calculated depending on the content added.
170 * @return Vector3 size of PopUp.
172 Vector3 GetSize() const { return Vector3::ZERO;};
175 * Returns the current state of the popup.
176 * @return The state of the popup see enum State
178 State GetState(void) const{ return StateHidden;};
181 * Get the root actor which the buttons are added to.
182 * @return the root actor
184 Actor GetRootActor() const { return Actor(); };
187 * @brief Creates the PopUp with the required buttons for the provided states.
188 * @param[in] isAllTextSelectedAlready Is all the text already selected
189 * @param[in] isTextEmpty Contains some text
190 * @param[in] hasClipboardGotContent Something to paste from clipboard
191 * @param[in] isSubsetOfTextAlreadySelected Some but not all text is selected
193 void CreateCutCopyPastePopUp( bool isAllTextSelectedAlready, bool isTextEmpty, bool hasClipboardGotContent, bool isSubsetOfTextAlreadySelected ){};
196 * @brief Applies constraint to keep Popup in view within the desired area.
197 * @param[in] bounding box in which the PopUp must remain.
200 void ApplyConfinementConstraint( Vector4 boundingBox ){};
205 * @brief Adds popup to the given parent
206 * @paran[in] parent target to add Popup to
208 void AddToParent( Actor parent ){};
211 * Removes popup from Parent.
213 void RemoveFromStage(){};
216 * Called when a button is pressed in the popup
217 * @param[in] button The button pressed.
219 bool OnButtonPressed( Toolkit::Button button ){return false;};
222 * Invoked upon popup Hide animation completing.
223 * @note Only called for animating hide, not called for instantaneous (animate = false)
224 * @param[in] source The animation which completed.
226 void OnHideFinished(Animation& source){};
229 * Invoked upon popup Show animation completing.
230 * @note Only called for animating show, not called for instantaneous (animate = false)
231 * @param[in] source The animation which completed.
233 void OnShowFinished(Animation& source);
238 * @brief Copy Constructor
242 TextInputPopupNew(const TextInputPopupNew& popup );
245 * @Assignment Constructor
249 TextInputPopupNew& operator=(const TextInputPopupNew& rhs);
253 State mState; // Popup State.
254 Actor mRootActor; // The actor which all popup content is added to (i.e. panel and buttons)
255 Vector3 mPopupSize; // Size of the PopUp determined by it's content and max/min size constraints.
256 ImageActor mBackground; // The background popup panel
257 ImageActor mTail; // The tail for the popup
258 Vector3 mContentSize; // Size of Content (i.e. Buttons)
259 ActorContainer mButtonContainer; // List of buttons added to popup.
260 ActorContainer mDividerContainer; // List of dividers added to popup.
261 Animation mAnimation; // Popup Hide/Show animation.
263 PopUpPressedSignal mPressedSignal; // Signal emitted when a button within the popup is pressed.
264 PopUpHideFinishedSignal mHideFinishedSignal; // Signal emitted when popup is completely hidden
265 PopUpShowFinishedSignal mShowFinishedSignal; // Signal emitted when popup is completely shown
269 } // namespace Internal
271 } // namespace Toolkit
275 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__