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.
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 Signal< bool( Toolkit::Button ) > PopUpPressedSignal;
63 // Popup Hide Finished
64 typedef Signal< void( TextInputPopupNew& ) > PopUpHideFinishedSignal;
66 // Popup Show Finished
67 typedef Signal< 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)
99 ~TextInputPopupNew(){};
102 * @return The root actor of for this popup is returned.
104 Actor Self() { return mRootActor; };
107 * Clears popup options (popup no longer exists)
113 * @param[in] styledCaption The text to be displayed
114 * @return the newly created label
116 Toolkit::TextView CreateLabel( const MarkupProcessor::StyledTextArray& styledCaption ){return Toolkit::TextView();};
120 * @param[in] iconImage the image to be used
121 * @return the newly created Image actor to be used as the icon
123 ImageActor CreateIcon( Image iconImage ) {return ImageActor();};
126 * Creates and sets up the popup background
128 void CreatePopUpBackground(){};
131 * Create divider if multiple options
133 void CreateDivider(){};
136 * Create a background to be used when button pressed
137 * @param[in] requiredSize size Image actor should be
138 * @param[in] finalFlag flag to be set if option is the final one.
139 * @return Returns an Image Actor to be used a pressed background
141 ImageActor CreatePressedBackground( const Vector3 requiredSize, const bool finalFlag ){ return ImageActor(); };
144 * Adds a popup option button.
145 * @note Creates popup frame if not already created.
146 * @param[in] name The unique name for this option.
147 * @param[in] caption The caption (label) for this option
148 * @param[in] iconImage Image to displayed with text.
149 * @param[in] finalOption Flag to indicate that this is the final option.
150 * (set to true on the last option you add)
152 void AddButton(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption ){};
156 * @param[in] animate (optional) whether to animate popup to hide state over time (i.e. tween).
158 void Hide(bool animate = true){};
162 * @param[in] animate (optional) whether to animate popup to show state over time (i.e. tween).
163 * @param[in] target Actor to parent popup.
165 void Show( Actor target, bool animate = true ){};
168 * @brief Get the calculated size of the PopUp
169 * This can not be set directly as is calculated depending on the content added.
171 * @return Vector3 size of PopUp.
173 Vector3 GetSize() const { return Vector3::ZERO;};
176 * Returns the current state of the popup.
177 * @return The state of the popup see enum State
179 State GetState(void) const{ return StateHidden;};
182 * Get the root actor which the buttons are added to.
183 * @return the root actor
185 Actor GetRootActor() const { return Actor(); };
188 * @brief Creates the PopUp with the required buttons for the provided states.
189 * @param[in] isAllTextSelectedAlready Is all the text already selected
190 * @param[in] isTextEmpty Contains some text
191 * @param[in] hasClipboardGotContent Something to paste from clipboard
192 * @param[in] isSubsetOfTextAlreadySelected Some but not all text is selected
194 void CreateCutCopyPastePopUp( bool isAllTextSelectedAlready, bool isTextEmpty, bool hasClipboardGotContent, bool isSubsetOfTextAlreadySelected ){};
197 * @brief Applies constraint to keep Popup in view within the desired area.
198 * @param[in] bounding box in which the PopUp must remain.
201 void ApplyConfinementConstraint( Vector4 boundingBox ){};
206 * @brief Adds popup to the given parent
207 * @paran[in] parent target to add Popup to
209 void AddToParent( Actor parent ){};
212 * Removes popup from Parent.
214 void RemoveFromStage(){};
217 * Called when a button is pressed in the popup
218 * @param[in] button The button pressed.
220 bool OnButtonPressed( Toolkit::Button button ){return false;};
223 * Invoked upon popup Hide animation completing.
224 * @note Only called for animating hide, not called for instantaneous (animate = false)
225 * @param[in] source The animation which completed.
227 void OnHideFinished(Animation& source){};
230 * Invoked upon popup Show animation completing.
231 * @note Only called for animating show, not called for instantaneous (animate = false)
232 * @param[in] source The animation which completed.
234 void OnShowFinished(Animation& source);
239 * @brief Copy Constructor
243 TextInputPopupNew(const TextInputPopupNew& popup );
246 * @Assignment Constructor
250 TextInputPopupNew& operator=(const TextInputPopupNew& rhs);
254 State mState; // Popup State.
255 Actor mRootActor; // The actor which all popup content is added to (i.e. panel and buttons)
256 Vector3 mPopupSize; // Size of the PopUp determined by it's content and max/min size constraints.
257 ImageActor mBackground; // The background popup panel
258 ImageActor mTail; // The tail for the popup
259 Vector3 mContentSize; // Size of Content (i.e. Buttons)
260 ActorContainer mButtonContainer; // List of buttons added to popup.
261 ActorContainer mDividerContainer; // List of dividers added to popup.
262 Animation mAnimation; // Popup Hide/Show animation.
264 PopUpPressedSignal mPressedSignal; // Signal emitted when a button within the popup is pressed.
265 PopUpHideFinishedSignal mHideFinishedSignal; // Signal emitted when popup is completely hidden
266 PopUpShowFinishedSignal mShowFinishedSignal; // Signal emitted when popup is completely shown
270 } // namespace Internal
272 } // namespace Toolkit
276 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__