Remove obsolete and non functional SizeChanged signal from actor
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-input / text-input-popup-new-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22
23 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
24 #include <dali-toolkit/public-api/controls/buttons/button.h>
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 namespace Internal
33 {
34
35 /**
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.
40  */
41
42 class TextInputPopupNew : public ConnectionTracker
43 {
44
45 public:
46
47   enum State
48   {
49     StateHidden,
50     StateHiding,
51     StateShowing,
52     StateShown
53   };
54
55   // Signal names
56   static const char* const SIGNAL_PRESSED;
57   static const char* const SIGNAL_HIDE_FINISHED;
58   static const char* const SIGNAL_SHOW_FINISHED;
59
60   // Popup Button Pressed
61   typedef Signal< bool( Toolkit::Button ) > PopUpPressedSignal;
62
63   // Popup Hide Finished
64   typedef Signal< void( TextInputPopupNew& ) > PopUpHideFinishedSignal;
65
66   // Popup Show Finished
67   typedef Signal< void( TextInputPopupNew& ) > PopUpShowFinishedSignal;
68
69   /**
70    * Signal emitted when the button is touched.
71    */
72   PopUpPressedSignal& PressedSignal() { return mPressedSignal; }
73
74   /**
75    * Signal emitted when popup is completely hidden
76    * @note Only occurs after a Show() call with animation enabled.
77    */
78   PopUpHideFinishedSignal& HideFinishedSignal() {return mHideFinishedSignal;}
79
80   /**
81    * Signal emitted when popup is completely shown
82    * @note Only occurs after a Hide() call with animation enabled.
83    */
84   PopUpShowFinishedSignal& ShowFinishedSignal() {return mShowFinishedSignal;}
85
86 public:
87
88   /**
89    * Default constructor
90    * Creates an empty popup base actor (no content i.e. invisible)
91    */
92   TextInputPopupNew()
93   : mState(StateHidden)
94   { };
95
96   /**
97    * Destructor
98    */
99   ~TextInputPopupNew(){};
100
101   /**
102    * @return The root actor of for this popup is returned.
103    */
104   Actor Self() { return mRootActor; };
105
106   /**
107    * Clears popup options (popup no longer exists)
108    */
109   void Clear(){};
110
111   /**
112    * Create the label
113    * @param[in] styledCaption The text to be displayed
114    * @return the newly created label
115    */
116   Toolkit::TextView CreateLabel( const MarkupProcessor::StyledTextArray& styledCaption ){return Toolkit::TextView();};
117
118   /**
119    * Create the label
120    * @param[in] iconImage the image to be used
121    * @return the newly created Image actor to be used as the icon
122    */
123   ImageActor CreateIcon( Image iconImage ) {return ImageActor();};
124
125   /**
126    * Creates and sets up the popup background
127    */
128   void CreatePopUpBackground(){};
129
130   /**
131    * Create divider if multiple options
132    */
133   void CreateDivider(){};
134
135   /**
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
140    */
141   ImageActor CreatePressedBackground( const Vector3 requiredSize, const bool finalFlag ){ return ImageActor(); };
142
143   /**
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)
151    */
152   void AddButton(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption ){};
153
154   /**
155    * Hides the popup
156    * @param[in] animate (optional) whether to animate popup to hide state over time (i.e. tween).
157    */
158   void Hide(bool animate = true){};
159
160   /**
161    * Shows the popup
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.
164    */
165   void Show( Actor target, bool animate = true ){};
166
167   /**
168    * @brief Get the calculated size of the PopUp
169    * This can not be set directly as is calculated depending on the content added.
170    *
171    * @return Vector3 size of PopUp.
172    */
173   Vector3 GetSize() const { return Vector3::ZERO;};
174
175   /**
176    * Returns the current state of the popup.
177    * @return The state of the popup see enum State
178    */
179   State GetState(void) const{ return StateHidden;};
180
181   /**
182    * Get the root actor which the buttons are added to.
183    * @return the root actor
184    */
185   Actor GetRootActor() const { return Actor(); };
186
187   /**
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
193    */
194   void CreateCutCopyPastePopUp( bool isAllTextSelectedAlready, bool isTextEmpty, bool hasClipboardGotContent, bool isSubsetOfTextAlreadySelected ){};
195
196   /**
197    * @brief Applies constraint to keep Popup in view within the desired area.
198    * @param[in] bounding box in which the PopUp must remain.
199    *
200    */
201   void ApplyConfinementConstraint( Vector4 boundingBox ){};
202
203 private:
204
205   /**
206    * @brief Adds popup to the given parent
207    * @paran[in] parent target to add Popup to
208    */
209   void AddToParent( Actor parent ){};
210
211   /**
212    * Removes popup from Parent.
213    */
214   void RemoveFromStage(){};
215
216   /**
217    * Called when a button is pressed in the popup
218    * @param[in] button The button pressed.
219    */
220   bool OnButtonPressed( Toolkit::Button button ){return false;};
221
222   /**
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.
226    */
227   void OnHideFinished(Animation& source){};
228
229   /**
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.
233    */
234   void OnShowFinished(Animation& source);
235
236 private:
237
238   /**
239    * @brief Copy Constructor
240    * @param[in] popup
241    * Undefined/Hidden.
242    */
243   TextInputPopupNew(const TextInputPopupNew& popup );
244
245   /**
246    * @Assignment Constructor
247    * @param[in] rhs
248    * Undefined/Hidden.
249    */
250   TextInputPopupNew& operator=(const TextInputPopupNew& rhs);
251
252 private:
253
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.
263
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
267
268 };
269
270 } // namespace Internal
271
272 } // namespace Toolkit
273
274 } // namespace Dali
275
276 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_INPUT_POPUP_NEW_H__