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 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 #include <dali/dali.h>
23 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
24 #include <dali-toolkit/public-api/controls/buttons/button.h>
36 * @brief Class to create and Popup bar made up of buttons.
37 * It provides signals when a button is pressed.
38 * The Popup must be positioned by it's owner.
39 * The future plan is to reuse the Toolkit Popup control to house the buttons.
42 class TextInputPopupNew : public ConnectionTracker
56 static const char* const SIGNAL_PRESSED;
57 static const char* const SIGNAL_HIDE_FINISHED;
58 static const char* const SIGNAL_SHOW_FINISHED;
60 // Popup Button Pressed
61 typedef SignalV2< bool( Toolkit::Button ) > PopUpPressedSignal;
63 // Popup Hide Finished
64 typedef SignalV2< void( TextInputPopupNew& ) > PopUpHideFinishedSignal;
66 // Popup Show Finished
67 typedef SignalV2< void( TextInputPopupNew& ) > PopUpShowFinishedSignal;
70 * Signal emitted when the button is touched.
72 PopUpPressedSignal& PressedSignal() { return mPressedSignal; }
75 * Signal emitted when popup is completely hidden
76 * @note Only occurs after a Show() call with animation enabled.
78 PopUpHideFinishedSignal& HideFinishedSignal() {return mHideFinishedSignal;}
81 * Signal emitted when popup is completely shown
82 * @note Only occurs after a Hide() call with animation enabled.
84 PopUpShowFinishedSignal& ShowFinishedSignal() {return mShowFinishedSignal;}
90 * Creates an empty popup base actor (no content i.e. invisible)
92 TextInputPopupNew(){};
97 ~TextInputPopupNew(){};
100 * @return The root actor of for this popup is returned.
102 Actor Self() { return mRootActor; };
105 * Clears popup options (popup no longer exists)
111 * @param[in] styledCaption The text to be displayed
112 * @return the newly created label
114 Toolkit::TextView CreateLabel( const MarkupProcessor::StyledTextArray& styledCaption ){return Toolkit::TextView();};
118 * @param[in] iconImage the image to be used
119 * @return the newly created Image actor to be used as the icon
121 ImageActor CreateIcon( Image iconImage ) {return ImageActor();};
124 * Creates and sets up the popup background
126 void CreatePopUpBackground(){};
129 * Create divider if multiple options
131 void CreateDivider(){};
134 * Create a background to be used when button pressed
135 * @param[in] requiredSize size Image actor should be
136 * @param[in] finalFlag flag to be set if option is the final one.
137 * @return Returns an Image Actor to be used a pressed background
139 ImageActor CreatePressedBackground( const Vector3 requiredSize, const bool finalFlag ){ return ImageActor(); };
142 * Adds a popup option button.
143 * @note Creates popup frame if not already created.
144 * @param[in] name The unique name for this option.
145 * @param[in] caption The caption (label) for this option
146 * @param[in] iconImage Image to displayed with text.
147 * @param[in] finalOption Flag to indicate that this is the final option.
148 * (set to true on the last option you add)
150 void AddButton(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption ){};
154 * @param[in] animate (optional) whether to animate popup to hide state over time (i.e. tween).
156 void Hide(bool animate = true){};
160 * @param[in] animate (optional) whether to animate popup to show state over time (i.e. tween).
161 * @param[in] target Actor to parent popup.
163 void Show( Actor target, bool animate = true ){};
166 * @brief Get the calculated size of the PopUp
167 * This can not be set directly as is calculated depending on the content added.
169 * @return Vector3 size of PopUp.
171 Vector3 GetSize() const { return Vector3::ZERO;};
174 * Returns the current state of the popup.
175 * @return The state of the popup see enum State
177 State GetState(void) const{ return StateHidden;};
180 * Get the root actor which the buttons are added to.
181 * @return the root actor
183 Actor GetRootActor() const { return Actor(); };
186 * @brief Creates the PopUp with the required buttons for the provided states.
187 * @param[in] isAllTextSelectedAlready Is all the text already selected
188 * @param[in] isTextEmpty Contains some text
189 * @param[in] hasClipboardGotContent Something to paste from clipboard
190 * @param[in] isSubsetOfTextAlreadySelected Some but not all text is selected
192 void CreateCutCopyPastePopUp( bool isAllTextSelectedAlready, bool isTextEmpty, bool hasClipboardGotContent, bool isSubsetOfTextAlreadySelected ){};
195 * @brief Applies constraint to keep Popup in view within the desired area.
196 * @param[in] bounding box in which the PopUp must remain.
199 void ApplyConfinementConstraint( Vector4 boundingBox ){};
204 * @brief Adds popup to the given parent
205 * @paran[in] parent target to add Popup to
207 void AddToParent( Actor parent ){};
210 * Removes popup from Parent.
212 void RemoveFromStage(){};
215 * Called when a button is pressed in the popup
216 * @param[in] button The button pressed.
218 bool OnButtonPressed( Toolkit::Button button ){return false;};
221 * Invoked upon popup Hide animation completing.
222 * @note Only called for animating hide, not called for instantaneous (animate = false)
223 * @param[in] source The animation which completed.
225 void OnHideFinished(Animation& source){};
228 * Invoked upon popup Show animation completing.
229 * @note Only called for animating show, not called for instantaneous (animate = false)
230 * @param[in] source The animation which completed.
232 void OnShowFinished(Animation& source);
237 * @brief Copy Constructor
241 TextInputPopupNew(const TextInputPopupNew& popup );
244 * @Assignment Constructor
248 TextInputPopupNew& operator=(const TextInputPopupNew& rhs);
252 State mState; // Popup State.
253 Actor mRootActor; // The actor which all popup content is added to (i.e. panel and buttons)
254 Vector3 mPopupSize; // Size of the PopUp determined by it's content and max/min size constraints.
255 ImageActor mBackground; // The background popup panel
256 ImageActor mTail; // The tail for the popup
257 Vector3 mContentSize; // Size of Content (i.e. Buttons)
258 ActorContainer mButtonContainer; // List of buttons added to popup.
259 ActorContainer mDividerContainer; // List of dividers added to popup.
260 Animation mAnimation; // Popup Hide/Show animation.
262 PopUpPressedSignal mPressedSignal; // Signal emitted when a button within the popup is pressed.
263 PopUpHideFinishedSignal mHideFinishedSignal; // Signal emitted when popup is completely hidden
264 PopUpShowFinishedSignal mShowFinishedSignal; // Signal emitted when popup is completely shown
268 } // namespace Internal
270 } // namespace Toolkit
274 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__