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
55 // Popup Button Pressed
56 typedef Signal< bool( Toolkit::Button ) > PopUpPressedSignal;
58 // Popup Hide Finished
59 typedef Signal< void( TextInputPopupNew& ) > PopUpVisibilityChangeFinishedSignal;
62 * Signal emitted when the button is touched.
64 PopUpPressedSignal& PressedSignal() { return mPressedSignal; }
67 * Signal emitted when popup is completely hidden
68 * @note Only occurs after a Show() call with animation enabled.
70 PopUpVisibilityChangeFinishedSignal& HideFinishedSignal() { return mHideFinishedSignal; }
73 * Signal emitted when popup is completely shown
74 * @note Only occurs after a Hide() call with animation enabled.
76 PopUpVisibilityChangeFinishedSignal& ShowFinishedSignal() { return mShowFinishedSignal; }
82 * Creates an empty popup base actor (no content i.e. invisible)
91 ~TextInputPopupNew(){};
94 * @return The root actor of for this popup is returned.
96 Actor Self() { return mRootActor; };
99 * Clears popup options (popup no longer exists)
105 * @param[in] styledCaption The text to be displayed
106 * @return the newly created label
108 Toolkit::TextView CreateLabel( const MarkupProcessor::StyledTextArray& styledCaption ){return Toolkit::TextView();};
112 * @param[in] iconImage the image to be used
113 * @return the newly created Image actor to be used as the icon
115 ImageActor CreateIcon( Image iconImage ) {return ImageActor();};
118 * Creates and sets up the popup background
120 void CreatePopUpBackground(){};
123 * Create divider if multiple options
125 void CreateDivider(){};
128 * Create a background to be used when button pressed
129 * @param[in] requiredSize size Image actor should be
130 * @param[in] finalFlag flag to be set if option is the final one.
131 * @return Returns an Image Actor to be used a pressed background
133 ImageActor CreatePressedBackground( const Vector3 requiredSize, const bool finalFlag ){ return ImageActor(); };
136 * Adds a popup option button.
137 * @note Creates popup frame if not already created.
138 * @param[in] name The unique name for this option.
139 * @param[in] caption The caption (label) for this option
140 * @param[in] iconImage Image to displayed with text.
141 * @param[in] finalOption Flag to indicate that this is the final option.
142 * (set to true on the last option you add)
144 void AddButton(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption ){};
148 * @param[in] animate (optional) whether to animate popup to hide state over time (i.e. tween).
150 void Hide(bool animate = true){};
154 * @param[in] animate (optional) whether to animate popup to show state over time (i.e. tween).
155 * @param[in] target Actor to parent popup.
157 void Show( Actor target, bool animate = true ){};
160 * @brief Get the calculated size of the PopUp
161 * This can not be set directly as is calculated depending on the content added.
163 * @return Vector3 size of PopUp.
165 Vector3 GetSize() const { return Vector3::ZERO;};
168 * Returns the current state of the popup.
169 * @return The state of the popup see enum State
171 State GetState(void) const{ return StateHidden;};
174 * Get the root actor which the buttons are added to.
175 * @return the root actor
177 Actor GetRootActor() const { return Actor(); };
180 * @brief Creates the PopUp with the required buttons for the provided states.
181 * @param[in] isAllTextSelectedAlready Is all the text already selected
182 * @param[in] isTextEmpty Contains some text
183 * @param[in] hasClipboardGotContent Something to paste from clipboard
184 * @param[in] isSubsetOfTextAlreadySelected Some but not all text is selected
186 void CreateCutCopyPastePopUp( bool isAllTextSelectedAlready, bool isTextEmpty, bool hasClipboardGotContent, bool isSubsetOfTextAlreadySelected ){};
189 * @brief Applies constraint to keep Popup in view within the desired area.
190 * @param[in] bounding box in which the PopUp must remain.
193 void ApplyConfinementConstraint( Vector4 boundingBox ){};
198 * @brief Adds popup to the given parent
199 * @paran[in] parent target to add Popup to
201 void AddToParent( Actor parent ){};
204 * Removes popup from Parent.
206 void RemoveFromStage(){};
209 * Called when a button is pressed in the popup
210 * @param[in] button The button pressed.
212 bool OnButtonPressed( Toolkit::Button button ){return false;};
215 * Invoked upon popup Hide animation completing.
216 * @note Only called for animating hide, not called for instantaneous (animate = false)
217 * @param[in] source The animation which completed.
219 void OnHideFinished(Animation& source){};
222 * Invoked upon popup Show animation completing.
223 * @note Only called for animating show, not called for instantaneous (animate = false)
224 * @param[in] source The animation which completed.
226 void OnShowFinished(Animation& source);
231 * @brief Copy Constructor
235 TextInputPopupNew(const TextInputPopupNew& popup );
238 * @Assignment Constructor
242 TextInputPopupNew& operator=(const TextInputPopupNew& rhs);
246 State mState; // Popup State.
247 Actor mRootActor; // The actor which all popup content is added to (i.e. panel and buttons)
248 Vector3 mPopupSize; // Size of the PopUp determined by it's content and max/min size constraints.
249 ImageActor mBackground; // The background popup panel
250 ImageActor mTail; // The tail for the popup
251 Vector3 mContentSize; // Size of Content (i.e. Buttons)
252 ActorContainer mButtonContainer; // List of buttons added to popup.
253 ActorContainer mDividerContainer; // List of dividers added to popup.
254 Animation mAnimation; // Popup Hide/Show animation.
256 PopUpPressedSignal mPressedSignal; // Signal emitted when a button within the popup is pressed.
257 PopUpVisibilityChangeFinishedSignal mHideFinishedSignal; // Signal emitted when popup is completely hidden
258 PopUpVisibilityChangeFinishedSignal mShowFinishedSignal; // Signal emitted when popup is completely shown
262 } // namespace Internal
264 } // namespace Toolkit
268 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__