Tizen 2.1 base
[framework/osp/uifw.git] / inc / FUiCtrlEditField.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FUiCtrlEditField.h
20  * @brief       This is the header file for the %EditField class.
21  *
22  * This header file contains the declarations of the %EditField class and its helper classes.
23  */
24
25 #ifndef _FUI_CTRL_EDIT_FIELD_H_
26 #define _FUI_CTRL_EDIT_FIELD_H_
27
28 #include <FBaseCharacter.h>
29 #include <FBaseString.h>
30 #include <FGrpBitmap.h>
31 #include <FGrpPoint.h>
32 #include <FGrpRectangle.h>
33 #include <FLclLocale.h>
34 #include <FUiControl.h>
35 #include <FUiContainer.h>
36 #include <FUiCtrlControlsTypes.h>
37 #include <FUiCtrlEditTypes.h>
38 #include <FUiCtrlGroupTypes.h>
39 #include <FUiCtrlInputTypes.h>
40 #include <FUiIActionEventListener.h>
41 #include <FUiIKeypadEventListener.h>
42 #include <FUiILanguageEventListener.h>
43 #include <FUiIScrollPanelEventListener.h>
44 #include <FUiITextBlockEventListener.h>
45 #include <FUiITextEventListener.h>
46 #include <FUiIUiLinkEventListener.h>
47
48 namespace Tizen { namespace Locales
49 {
50 class Locale;
51 }}
52
53 namespace Tizen { namespace Ui { namespace Controls
54 {
55
56 /**
57  * @class       EditField
58  * @brief   This class defines a common behavior for an %EditField control.
59  *
60  * @since               2.0
61  *
62  * The %EditField  class displays a single-line text editor.
63  *
64  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_editfield_editarea.htm">EditArea and EditField</a>.
65  *
66  * The following example demonstrates how to use the %EditField class.
67  *
68  * @code
69 // Sample code for EditFieldSample.h
70 #include <FUi.h>
71
72 class EditFieldSample
73         : public Tizen::Ui::Controls::Form
74         , public Tizen::Ui::ITextEventListener
75 {
76 public:
77         EditFieldSample(void)
78         : __pEditField(null){}
79
80         bool Initialize(void);
81         virtual result OnInitializing(void);
82
83         // ITextEventListener
84         virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
85         virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
86
87 private:
88         Tizen::Ui::Controls::EditField* __pEditField;
89 };
90  * @endcode
91  *
92  * @code
93 // Sample code for EditFieldSample.cpp
94 #include <FGraphics.h>
95
96 #include "EditFieldSample.h"
97
98 using namespace Tizen::Graphics;
99 using namespace Tizen::Ui::Controls;
100
101 bool
102 EditFieldSample::Initialize(void)
103 {
104         Construct(FORM_STYLE_NORMAL);
105         return true;
106 }
107
108 result
109 EditFieldSample::OnInitializing(void)
110 {
111         result r = E_SUCCESS;
112
113         // Creates an instance of EditField
114         __pEditField = new EditField();
115         __pEditField->Construct(Rectangle(50, 100, 400, 150));
116         __pEditField->AddTextEventListener(*this);
117
118         //Adds the edit field to the Form
119         AddControl(*__pEditField);
120
121         return r;
122 }
123
124 // ITextEventListener implementation
125 void
126 EditFieldSample::OnTextValueChanged(const Tizen::Ui::Control& source)
127 {
128     // ....
129 }
130
131 void
132 EditFieldSample::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
133 {
134     // ....
135 }
136  * @endcode
137  *
138  */
139
140 class _OSP_EXPORT_ EditField
141         : public Tizen::Ui::Control
142 {
143 public:
144         /**
145          * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
146          *
147          * @since               2.0
148          */
149         EditField(void);
150
151         /**
152          * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
153          *
154          * @since               2.0
155          */
156         virtual ~EditField(void);
157
158         /**
159          * Initializes this instance of the %EditField control with the specified parameters.
160          *
161          * @since                       2.0
162          *
163          * @return                      An error code
164          * @param[in]           rect            An instance of the Graphics::Rectangle class @n
165          *                                                                              This instance represents the x and y coordinates of the top-left corner of the created window along with
166          *                                                                              the width and height of the control.
167          * @param[in]   style                   The style of the %EditField control
168          * @param[in]   inputStyle              The input style of the %EditField control
169          * @param[in]   showTitle                               Set to @c true to display the title, @n
170          *                                                              else @c false
171          * @param[in]   limitLength             The limit for the length of the text in the %EditField control
172          * @param[in]   groupStyle              The table view style of the %EditField control
173          * @exception   E_SUCCESS                               The method is successful.
174          * @exception   E_INVALID_ARG                   The specified @c limitLength is less than or equal to @c 0, or @n
175          *                                                                              either the @c rect.width or the @c rect.height is less than @c 0.
176          * @exception   E_UNSUPPORTED_OPTION    The specified option is not supported. @n
177          *                                                                              The title is not supported by small style %EditField.
178          * @exception   E_SYSTEM                                A system error has occurred.
179          * @remarks             A control is fully usable only after it has been added to a container. Therefore, some methods may fail if the control has been used
180          *                              earlier. The %EditField style of SMALL property cannot be used together with group styles. @n
181          *                              If the specified size is less than the minimum size, %EditField is constructed with the minimum size.
182          * @remarks             Following are the input styles used for creating the different orientations of a keypad: @n
183          *              -       INPUT_STYLE_FULLSCREEN: The orientation is decided by the G-sensor value. @n
184          *              -       INPUT_STYLE_OVERLAY: The orientation is the same as that of a parent form.
185          */
186         result Construct(const Tizen::Graphics::Rectangle& rect, EditFieldStyle style = EDIT_FIELD_STYLE_NORMAL, InputStyle inputStyle = INPUT_STYLE_FULLSCREEN, bool showTitle = false, int limitLength = 100, GroupStyle groupStyle = GROUP_STYLE_NONE);
187
188         /**
189          * Initializes this instance of the %EditField control.
190          *
191          * @since        2.0
192          *
193          * @return       An error code
194          * @param[in]   rect                    The bounds of %EditField
195          * @param[in]    style           The style of the %EditField control
196          * @param[in]    inputStyle      The input style of the %EditField control
197          * @param[in]    titleStyle      The title style
198          * @param[in]   enableClear                 Set to @c true to enable the clear button, @n
199          *                                                                              else @c false
200          * @param[in]    limitLength     The limit of the length of text in the %EditField control
201          * @param[in]    groupStyle      The table view style of the %EditField control
202          * @exception   E_SUCCESS               The method is successful.
203          * @exception   E_INVALID_ARG           A specified input parameter is invalid. @n
204          *                                      The specified @c limitLength is less than or equal to @c 0. @n
205          *                                                                      The specified @c rect.width or the @c rect.height is less than @c 0.
206          * @exception   E_UNSUPPORTED_OPTION    The specified option is not supported. @n
207          *                                                                              Title is not supported in small style %EditField.
208          * @exception   E_SYSTEM                                A system error has occurred.
209          * @remarks              A control is fully usable only after it has been added to a container. Therefore, some methods may fail if the control is used earlier.
210          *                              The %EditField style of SMALL property cannot be used together with group styles. @n
211          *               If the specified size is less than the minimum size, EditFied() is constructed with the minimum size.
212          * @remarks      Following are the input styles used for creating different orientations of a keypad: @n
213          *                                                                              -   INPUT_STYLE_FULLSCREEN: The orientation is decided by the G-sensor value.@n
214          *                                                                              -   INPUT_STYLE_OVERLAY: The orientation is similar to the parent Form.
215          */
216         result Construct(const Tizen::Graphics::Rectangle& rect, EditFieldStyle style, InputStyle inputStyle, EditFieldTitleStyle titleStyle, bool enableClear = false, int limitLength = 100, GroupStyle groupStyle = GROUP_STYLE_NONE);
217
218 public:
219         /**
220          * Gets the horizontal text alignment of the %EditField control.
221          *
222          * @since               2.0
223          *
224          * @return              The horizontal text alignment
225          * @exception   E_SUCCESS                       The method is successful.
226          * @exception   E_SYSTEM                        A system error has occurred.
227          * @remarks         The specific error code can be accessed using the GetLastResult() method.
228          * @see                 SetTextAlignment()
229          */
230         HorizontalAlignment GetTextAlignment(void) const;
231
232         /**
233          * Sets the horizontal text alignment of the %EditField control.
234          *
235          * @since       2.0
236          *
237          * @return              An error code
238          * @exception   E_SUCCESS                       The method is successful.
239          * @exception   E_SYSTEM                        A system error has occurred.
240          * @see                 GetTextAlignment()
241          */
242         result SetTextAlignment(HorizontalAlignment alignment);
243
244         /**
245          * Checks whether the view mode is enabled.
246          *
247          * @since       2.0
248          *
249          * @return              @c true if the view mode is enabled, @n
250          *              else @c false
251          * @exception   E_SUCCESS                       The method is successful.
252          * @exception   E_SYSTEM                        A system error has occurred.
253          * @remarks     The specific error code can be accessed using the GetLastResult() method. @n
254          *                              In the view mode, the auto-detected links are displayed as linked text.
255          * @see   SetViewModeEnabled()
256          */
257         bool IsViewModeEnabled(void) const;
258
259         /**
260          * Enables or disables the view mode.
261          *
262          * @since       2.0
263          *
264          * @return              An error code
265          * @param[in]   enable              Set to @c true to enable the view mode, @n
266          *                                                                      else @c false
267          * @exception   E_SUCCESS                       The method is successful.
268          * @exception   E_SYSTEM                        A system error has occurred.
269          * @remarks             In the view mode, the auto-detected links are displayed as linked text.
270          * @see         IsViewModeEnabled()
271          */
272         result SetViewModeEnabled(bool enable);
273
274         /**
275          * Sets the auto-link mask.
276          *
277          * @since               2.0
278          *
279          * @return              An error code
280          * @param[in]   autoLinks                               The auto-link mask @n
281          *                                                                              Multiple link types can be combined using bitwise OR operator (see Tizen::Base::Utility::LinkType). @n
282          *                                                                              For more information, see <a href="../org.tizen.native.appprogramming/html/guide/ui/auto_link_detection.htm">AutoLink Detection</a>.
283          * @exception   E_SUCCESS                               The method is successful.
284          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation @n
285          *                                                                              The input style is not @c INPUT_STYLE_OVERLAY.
286          * @exception   E_SYSTEM                                A system error has occurred.
287          * @remarks             When @c autoLinks is set to @c 0, the auto-link detection is disabled.
288          * @see                 Tizen::Base::Utility::LinkType
289          * @see                 GetAutoLinkMask()
290          * @see                 IsViewModeEnabled()
291          * @see                 SetViewModeEnabled()
292          */
293         result SetAutoLinkMask(unsigned long autoLinks);
294
295         /**
296          * Gets the auto-link mask.
297          *
298          * @since               2.0
299          *
300          * @return              The auto-link mask
301          * @exception   E_SUCCESS                               The method is successful.
302          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation @n
303          *                                                                              The input style is not @c INPUT_STYLE_OVERLAY.
304          * @exception   E_SYSTEM                                A system error has occurred.
305          * @remarks             The specific error code can be accessed using the GetLastResult() method.
306          * @see                 SetAutoLinkMask()
307          */
308         unsigned long GetAutoLinkMask(void) const;
309
310         /**
311          * Adds a link event listener.
312          *
313          * @since               2.0
314          *
315          * @param[in]   listener        The event listener to be added
316          * @remarks             This method is supported when the input style is @c INPUT_STYLE_OVERLAY. @n
317          *                              The added listener is notified when the links are selected by the user.
318          * @see                 RemoveUiLinkEventListener()
319          */
320         void AddUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
321
322         /**
323          * Removes the specified link event listener. @n
324          * The removed listener cannot listen to events when they are fired.
325          *
326          * @since               2.0
327          *
328          * @param[in]   listener        The event listener to be removed
329          * @remarks             This method is supported when the input style is @c INPUT_STYLE_OVERLAY.
330          * @see                 AddUiLinkEventListener()
331          */
332         void RemoveUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
333
334         /**
335          * Gets the margin value of the specified margin type.
336          *
337          * @since       2.0
338          *
339          * @return          The margin value of the specified margin type, @n
340          *                              else @c -1 if an error occurs
341          * @param[in]   marginType              The margin type
342          * @exception   E_SUCCESS               The method is successful.
343          * @exception   E_SYSTEM                A system error has occurred.
344          * @remarks     The specific error code can be accessed using the GetLastResult() method.
345          * @see         SetMargin()
346          */
347         int GetMargin(EditMarginType marginType) const;
348
349         /**
350          * Sets the margin for the specified margin type.
351          *
352          * @since       2.0
353          *
354          * @return          An error code
355          * @param[in]   marginType              The margin type
356          * @param[in]   margin                  The margin to set
357          * @exception   E_SUCCESS               The method is successful.
358          * @exception   E_INVALID_ARG   A specified input parameter is invalid. @n
359          *                                                              The specified @c margin cannot be a negative integer.
360          * @exception   E_SYSTEM                A system error has occurred.
361          * @see         GetMargin()
362          */
363         result SetMargin(EditMarginType marginType, int margin);
364
365         /**
366          * Enables or disables the keypad action.
367          *
368          * @since 2.0
369          * @return      An error code
370          * @param[in]   enable  Set to @c true to enable the keypad action, @n
371          *                                              else @c false
372          * @exception   E_SUCCESS                               The method is successful.
373          * @exception   E_UNSUPPORTED_OPERATION  The underlying input method does not support this operation.
374          * @remarks     Depending on the value of input param, the enter key have a enable or disable look accordingly.
375          */
376         result SetKeypadActionEnabled(bool enable);
377
378         /**
379          * Checks whether the keypad action is enabled.
380          *
381          * @since 2.0
382          * @return              @c true if the keypad action is enabled, @n
383          *                              else @c false
384          */
385         bool IsKeypadActionEnabled(void) const;
386
387         /**
388          * Gets the keypad action type.
389          *
390          * @since               2.0
391          *
392          * @return      The keypad action
393          * @exception   E_SUCCESS                               The method is successful.
394          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
395          *                                                                              The input style is not @c INPUT_STYLE_OVERLAY.
396          * @exception   E_SYSTEM                A system error has occurred.
397          * @remarks     The specific error code can be accessed using the GetLastResult() method.
398          * @see         SetKeypadAction()
399          */
400         Tizen::Ui::KeypadAction GetKeypadAction(void) const;
401
402         /**
403          * Sets the keypad action type.
404          *
405          * @since               2.0
406          *
407          * @return      An error code
408          * @param[in]   keypadAction                    The keypad action
409          * @exception   E_SUCCESS                               The method is successful.
410          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
411          *                                                                              The input style is not @c INPUT_STYLE_OVERLAY.
412          * @exception   E_SYSTEM                                A system error has occurred.
413          * @remarks             Based on the specified value of @c keypadAction, the enter key label of the keypad changes accordingly.
414          * @see         GetKeypadAction()
415          */
416         result SetKeypadAction(Tizen::Ui::KeypadAction keypadAction);
417
418         /**
419          * Sets the visibility of the command buttons of the overlay style keypad.
420          *
421          * @since               2.0
422          *
423          * @return              An error code
424          * @param[in]   visible                                 Set to @c true to set the visibility of the overlay keypad command buttons, @n
425          *                                      else @c false
426          * @exception   E_SUCCESS                               The method is successful.
427          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
428          *                                                                              The input style is not @c INPUT_STYLE_OVERLAY.
429          * @exception   E_SYSTEM                                A system error has occurred.
430          */
431         result SetOverlayKeypadCommandButtonVisible(bool visible);
432
433         /**
434          * Checks whether the command buttons of the overlay style keypad are visible.
435          *
436          * @since       2.0
437          *
438          * @return      @c true if the overlay command buttons are visible, @n
439          *              else @c false
440          * @exception   E_SUCCESS                   The method is successful.
441          * @exception   E_UNSUPPORTED_OPERATION         The current state of the instance prohibits the execution of the specified operation. @n
442          *                                                                                      The input style is not @c INPUT_STYLE_OVERLAY.
443          * @exception   E_SYSTEM                    A system error has occurred.
444          * @remarks     The specific error code can be accessed using the GetLastResult() method.
445          */
446         bool IsOverlayCommandButtonVisible(void) const;
447
448         /**
449          * Hides the keypad.
450          *
451          * @since       2.0
452          *
453          * @return      An error code
454          * @exception   E_SUCCESS                               The method is successful.
455          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
456          *                                                                              The input style is not @c INPUT_STYLE_OVERLAY.
457          * @exception   E_SYSTEM                                A system error has occurred.
458          * @see         ShowKeypad()
459          */
460         result HideKeypad(void);
461
462         /**
463          * Gets the position of the ellipsis.
464          *
465          * @since       2.0
466          *
467          * @return      The ellipsis position
468          * @exception   E_SUCCESS                       The method is successful.
469          * @exception   E_SYSTEM                        A system error has occurred.
470          * @remarks     The specific error code can be accessed using the GetLastResult() method.
471          * @see         SetEllipsisPosition()
472          */
473         EllipsisPosition GetEllipsisPosition(void) const;
474
475         /**
476          * Sets the position of the ellipsis.
477          *
478          * @since       2.0
479          *
480          * @return      An error code
481          * @param[in]   position        The ellipsis position
482          * @exception   E_SUCCESS                       The method is successful.
483          * @exception   E_SYSTEM                        A system error has occurred.
484          * @see         GetEllipsisPosition()
485          */
486         result SetEllipsisPosition(EllipsisPosition position);
487
488         /**
489          * Gets the text size.
490          *
491          * @since       2.0
492          *
493          * @return      The size of the text, @n
494          *              else @c -1 if an error occurs
495          * @exception   E_SUCCESS                       The method is successful.
496          * @exception   E_SYSTEM                        A system error has occurred.
497          * @remarks     The specific error code can be accessed using the GetLastResult() method.
498          * @see         SetTextSize()
499          */
500         int GetTextSize(void) const;
501
502         /**
503          * Sets the text size.
504          *
505          * @since               2.0
506          *
507          * @return              An error code
508          * @param[in]   size                    The text size
509          * @exception   E_SUCCESS               The method is successful.
510          * @exception   E_INVALID_ARG   The specified input parameter is invalid. @n
511          *                                                              The @c size cannot be a negative integer.
512          * @exception   E_SYSTEM                A system error has occurred.
513          * @see                 GetTextSize()
514          */
515         result SetTextSize(int size);
516
517         /**
518          * Gets the color of the %EditField control for the specified status.
519          *
520          * @since        2.0
521          *
522          * @return       The color, @n
523          *                               else RGBA(0,0,0,0) if an error occurs
524          * @param[in]    status                         The status
525          * @exception   E_SUCCESS                       The method is successful.
526          * @exception   E_SYSTEM                        A system error has occurred.
527          * @remarks      The specific error code can be accessed using the GetLastResult() method.
528          */
529         Tizen::Graphics::Color GetColor(EditStatus status) const;
530
531         /**
532          * Gets the text color of the specified text color type.
533          *
534          * @since               2.0
535          *
536          * @return              The color, @n
537          *                              else RGBA(0,0,0,0) if an error occurs
538          * @param[in]   type                    The text color type
539          * @exception   E_SUCCESS               The method is successful.
540          * @exception   E_SYSTEM                A system error has occurred.
541          * @remarks             The specific error code can be accessed using the GetLastResult() method.
542          * @see                 SetTextColor()
543          */
544         Tizen::Graphics::Color GetTextColor(EditTextColor type) const;
545
546         /**
547          * Sets the background bitmap of the %EditField control for the specified status.
548          *
549          * @since               2.0
550          *
551          * @return              An error code
552          * @param[in]   status                  The status
553          * @param[in]   bitmap                  The background bitmap
554          * @exception   E_SUCCESS               The method is successful.
555          * @exception   E_SYSTEM                A system error has occurred.
556          */
557         result SetBackgroundBitmap(EditStatus status, const Tizen::Graphics::Bitmap& bitmap);
558
559         /**
560          * Sets the color of the %EditField control for the specified status.
561          *
562          * @since               2.0
563          *
564          * @return              An error code
565          * @param[in]   status                  The status
566          * @param[in]   color                   The color
567          * @exception   E_SUCCESS               The method is successful.
568          * @exception   E_SYSTEM                A system error has occurred.
569          * @see                 GetColor()
570          */
571         result SetColor(EditStatus status, const Tizen::Graphics::Color& color);
572
573         /**
574          * Sets the text color of the %EditField control for the specified text color type.
575          *
576          * @since               2.0
577          *
578          * @return              An error code
579          * @param[in]   type                    The text color type
580          * @param[in]   color                   The text color
581          * @exception   E_SUCCESS               The method is successful.
582          * @exception   E_SYSTEM                A system error has occurred.
583          * @see                 GetTextColor()
584          */
585         result SetTextColor(EditTextColor type, const Tizen::Graphics::Color& color);
586
587         /**
588          * Gets a portion of text that is displayed by the %EditField control.
589          *
590          * @since               2.0
591          *
592          * @return      The specified portion of the text, @n
593          *                              else an empty string if an error occurs
594          * @param[in]   start                   The starting index of the range
595          * @param[in]   end                             The last index of the range
596          * @exception   E_SUCCESS               The method is successful.
597          * @exception   E_OUT_OF_RANGE  The specified index is outside the bounds of the data structure, or @n
598          *                                                              the index is greater than the number of elements or less than @c 0.
599          * @exception   E_SYSTEM                A system error has occurred.
600          * @remarks     The specific error code can be accessed using the GetLastResult() method.
601          * @see         SetText()
602          */
603         Tizen::Base::String GetText(int start, int end) const;
604
605         /**
606          * Adds a keypad event listener. @n
607          * The added listener is notified when the keypad associated with the %EditField control is opened or closed.
608          *
609          * @since       2.0
610          *
611          * @param[in]   listener        The event listener to be added
612          * @see         RemoveKeypadEventListener()
613          */
614         void AddKeypadEventListener(IKeypadEventListener& listener);
615
616         /**
617          * Removes the specified keypad event listener. @n
618          * The removed listener cannot listen to events when they are fired.
619          *
620          * @since       2.0
621          *
622          * @param[in]   listener        The event listener to be removed
623          * @see         AddKeypadEventListener()
624          */
625         void RemoveKeypadEventListener(IKeypadEventListener& listener);
626
627         /**
628          * Adds a text block event listener. @n
629          * The added listener is notified when the text block is selected.
630          *
631          * @since               2.0
632          *
633          * @param[in]   listener        The event listener to be added
634          * @remarks             Programmatically modifying the text block does not cause the text block selection event to fire.
635          * @see                 RemoveTextBlockEventListener()
636          */
637         void AddTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
638
639         /**
640          * Removes the specified text block event listener. @n
641          * The removed listener cannot listen to events when they are fired.
642          *
643          * @since       2.0
644          *
645          * @param[in]   listener        The event listener to be removed
646          * @see                 AddTextBlockEventListener()
647          */
648         void RemoveTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
649
650         /**
651          * Adds the ITextEventListener instance. @n
652          * The added listener listens to events on the context of the specified event dispatcher when they are fired.
653          *
654          * @since               2.0
655          *
656          * @param[in]   listener    The listener to be added
657          */
658         void AddTextEventListener(Tizen::Ui::ITextEventListener& listener);
659
660         /**
661          * Removes the ITextEventListener instance. @n
662          * The removed listener cannot listen to events when they are fired.
663          *
664          * @since               2.0
665          *
666          * @param[in]   listener    The listener to be removed
667          */
668         void RemoveTextEventListener(Tizen::Ui::ITextEventListener& listener);
669
670         /**
671          * Adds the specified listener instance to listen to the scroll panel events.
672          *
673          * @since               2.0
674          *
675          * @param[in]   listener        The listener to be added
676          * @remarks     To listen to the scroll panel events, the parent of EditArea must be an instance of ScrollPanel. @n
677          *              When OnOverlayControlCreated() or OnOvelayControlClosed() is called, the application resets the bounds of the controls placed
678          *              within the ScrollPanel control. ScrollPanel is automatically drawn again after this method is called.
679          * @see                 RemoveScrollPanelEventListener()
680          */
681         void AddScrollPanelEventListener(Tizen::Ui::IScrollPanelEventListener& listener);
682
683         /**
684          * Removes the specified scroll panel event listener instance. @n
685          * The removed listener cannot listen to events when they are fired.
686          *
687          * @since               2.0
688          *
689          * @param[in]   listener        The listener to be removed
690          */
691         void RemoveScrollPanelEventListener(Tizen::Ui::IScrollPanelEventListener& listener);
692
693         /**
694          * Adds the specified listener instance. @n
695          * The added listener can listen to events on the context of the given event dispatcher when they are fired.
696          *
697          * @since               2.0
698          *
699          * @param[in]   listener        The event listener to be added
700          */
701         void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
702
703         /**
704          * Removes a listener instance. @n
705          * The removed listener cannot listen to events when they are fired.
706          *
707          * @since                       2.0
708          *
709          * @param[in]   listener        The event listener to remove
710          */
711         void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
712
713         /**
714          * Adds the specified listener instance for language events. @n
715          * The added listener is notified when the input language is changed.
716          *
717          * @since      2.0
718          *
719          * @param[in]  listener                         The listener to be added
720          * @remarks    The application can recognize when the language is changed from the keypad by adding Tizen::Ui::ILanguageEventListener.
721          * @see            RemoveLanguageEventListener()
722          */
723         void AddLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
724
725         /**
726          * Removes the specified listener instance. @n
727          * The removed listener cannot listen to events when they are fired.
728          *
729          * @since      2.0
730          *
731          * @param[in]  listener                         The listener to be removed
732          * @see            AddLanguageEventListener()
733          */
734         void RemoveLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
735
736         /**
737          * Gets the remaining length of the %EditField control.
738          *
739          * @since       2.0
740          *
741          * @return      The remaining length of the %EditField control, @n
742          *                      else @c -1 if an error occurs
743          */
744         int GetRemainingLength(void) const;
745
746         /**
747          * Enables or disables the lowercase mode.
748          *
749          * @since               2.0
750          *
751          * @param[in]   enable  Set to @c true to enable the lowercase mode, @n
752          *                      else @c false
753          */
754         void SetLowerCaseModeEnabled(bool enable);
755
756         /**
757          * Checks whether the lowercase mode is enabled.
758          *
759          * @since       2.0
760          *
761          * @return      @c true if the lowercase mode is enabled, @n
762          *                      else @c false
763          */
764         bool IsLowerCaseModeEnabled(void) const;
765
766         /**
767          * @if OSPDEPREC
768          * Sets the input mode category.
769          *
770          * @brief <i> [Deprecated]  </i>
771          * @deprecated We no longer provide a method to specify the list of styles which the user can set the keypad to, @n
772          *                         or the current mode to initially set the keypad to, from this list. It is recommended to use EditFieldStyle in the Construct() method instead.
773          * @since        2.0
774          *
775          * @return       An error code
776          * @param[in]    categories             The categories to be set @n
777          *                              Multiple input categories can be combined using bitwise OR operator (see Tizen::Ui::Controls::EditInputModeCategory).
778          * @param[in]    enable                 The category value to set
779          * @exception    E_SUCCESS                              The method is successful.
780          * @exception    E_INVALID_ARG                  A specified input mode category is invalid.
781          * @exception    E_INVALID_OPERATION    The current state of the instance prohibits the execution of the specified operation @n
782          *                                                                              The specified @c categories cannot be supported with the current keypad style.
783          * @exception    E_SYSTEM                               A system error has occurred.
784          * @endif
785          */
786         result SetInputModeCategory(unsigned long categories, bool enable);
787
788         /**
789          * @if OSPDEPREC
790          * Sets the current input mode category.
791          *
792          * @brief <i> [Deprecated]  </i>
793          * @deprecated We no longer provide a method to specify the list of styles which the user can set the keypad to, @n
794          *                         or the current mode to initially set the keypad to, from this list. It is recommended to use EditFieldStyle in the Construct() method instead.
795          * @since               2.0
796          *
797          * @return              An error code
798          * @param[in]   inputModeCategory   An item of input category
799          * @exception   E_SUCCESS                       The method is successful.
800          * @exception   E_SYSTEM                        A system error has occurred.
801          * @endif
802          */
803         result SetCurrentInputModeCategory(EditInputModeCategory inputModeCategory);
804
805         /**
806          * @if OSPDEPREC
807          * Gets the input mode category.
808          *
809          * @brief <i> [Deprecated]  </i>
810          * @deprecated This method is deprecated because we no longer provide a method to specify the list of styles which the user can set the keypad to.
811          * @since       2.0
812          *
813          * @return  A bitwise combination of Tizen::Ui::Controls::EditInputModeCategory, @n
814          *                      else EDIT_INPUTMODE_ALPHA if an error occurs
815          * @endif
816          */
817         unsigned long GetInputModeCategory(void) const;
818
819         /**
820          * @if OSPDEPREC
821          * Gets the current input mode category.
822          *
823          * @brief <i> [Deprecated]  </i>
824          * @deprecated This method is deprecated because we no longer provide a method to specify the list of styles which the user can set the keypad to.
825          * @since    2.0
826          *
827          * @return   The current input mode category
828          * @endif
829          */
830         EditInputModeCategory GetCurrentInputModeCategory(void) const;
831
832         /**
833          * Sets the cursor in the %EditField control at the specified position.
834          *
835          * @since               2.0
836          *
837          * @return              An error code
838          * @param[in]   position                The cursor position that is to be set
839          * @exception   E_SUCCESS               The method is successful.
840          * @exception   E_OUT_OF_RANGE  The specified @c position is less than @c 0 or greater than the maximum length.
841          * @exception   E_SYSTEM                A system error has occurred.
842          */
843         result SetCursorPosition(int position);
844
845         /**
846          * Gets the cursor position.
847          *
848          * @since                       2.0
849          *
850          * @return                      The current cursor position, @n
851          *                  else @c -1 if an error occurs
852          */
853         int GetCursorPosition(void) const;
854
855         /**
856          * Gets the text that is displayed by the %EditField control.
857          *
858          * @since       2.0
859          *
860          * @return      The text of the %EditField control, @n
861          *          else an empty string if an error occurs
862          */
863         Tizen::Base::String GetText(void) const;
864
865         /**
866          * Gets the length of the text that is displayed by the %EditField control.
867          *
868          * @since       2.0
869          *
870          * @return      The length of the text, @n
871          *          else @c -1 if an error occurs
872          */
873         int GetTextLength(void) const;
874
875         /**
876          * Sets the text of the %EditField control.
877          *
878          * @since               2.0
879          *
880          * @param[in]   text                    The text to be displayed by the %EditField control
881          * @exception   E_SUCCESS               The method is successful.
882          * @exception   E_INVALID_ARG   The specified input parameter is invalid. @n
883          *                                                              The length of the specified @c text exceeds the system limitation or the limit length.
884          * @exception   E_SYSTEM                A system error has occurred.
885          * @remarks     Use @htmlonly '\n' @endhtmlonly to denote the end of the line.
886          */
887         result SetText(const Tizen::Base::String& text);
888
889         /**
890          * Inserts the specified text at the current cursor position.
891          *
892          * @since               2.0
893          *
894          * @return              An error code
895          * @param[in]   text        The text to be inserted
896          * @exception   E_SUCCESS   The method is successful.
897          * @exception   E_SYSTEM    A system error has occurred.
898          * @remarks     Use @htmlonly '\n' @endhtmlonly to denote the end of the line.
899          */
900         result InsertTextAtCursorPosition(const Tizen::Base::String& text);
901
902         /**
903          * Appends the specified text at the end of the existing text.
904          *
905          * @since               2.0
906          *
907          * @return              An error code
908          * @param[in]   text        The text to be appended
909          * @exception   E_SUCCESS   The method is successful.
910          * @exception   E_SYSTEM    A system error has occurred.
911          * @remarks     Use @htmlonly '\n' @endhtmlonly to denote the end of the line.
912          */
913         result AppendText(const Tizen::Base::String& text);
914
915         /**
916          * Appends the specified character at the end of the existing text.
917          *
918          * @since               2.0
919          *
920          * @return      An error code
921          * @param[in]   character               The character to be appended
922          * @exception   E_SUCCESS               The method is successful.
923          * @exception   E_SYSTEM                A system error has occurred.
924          * @remarks             The method modifies the text buffer that is managed by the %EditField control. To display the
925          *              changes, the control must be drawn again.
926          */
927         result AppendCharacter(const Tizen::Base::Character& character);
928
929         /**
930          * Clears the text that is displayed by the %EditField control.
931          *
932          * @since               2.0
933          *
934          * @return              An error code
935          * @exception   E_SUCCESS               The method is successful.
936          * @exception   E_SYSTEM                A system error has occurred.
937          * @remarks             The method modifies the text buffer that is managed by the %EditField control. To display the
938          *              changes, the control must be drawn again.
939          */
940         result Clear(void);
941
942         /**
943          * Deletes a character at the current cursor position.
944          *
945          * @since               2.0
946          *
947          * @return              An error code
948          * @exception   E_SUCCESS               The method is successful.
949          * @exception   E_SYSTEM                A system error has occurred.
950          * @remarks             The method modifies the text buffer that is managed by the %EditField control. To display the
951          *              changes, the control must be drawn again.
952          */
953         result DeleteCharacterAtCursorPosition(void);
954
955         /**
956          * Gets the range of the current text block.
957          *
958          * @since        2.0
959          *
960          * @param[out]   start   The first index of the current text block
961          * @param[out]   end     The last index of the current text block
962          */
963         void GetCurrentTextRange(int& start, int& end) const;
964
965         /**
966          * Sets the guide text.
967          *
968          * @since               2.0
969          *
970          * @param[in]   guideText    The guide text
971          * @remarks             This is the default text that is displayed in the %EditField
972          *              control when the focus is given to it and no text is entered.
973          */
974         void SetGuideText(const Tizen::Base::String& guideText);
975
976         /**
977          * Gets the guide text.
978          *
979          * @since       2.0
980          *
981          * @return      The guide text, @n
982          *              else an empty string if an error occurs
983          * @exception   E_SUCCESS                       The method is successful.
984          * @exception   E_SYSTEM                        A system error has occurred.
985          * @remarks     The specific error code can be accessed using the GetLastResult() method.
986          * @see         SetGuideText()
987          */
988         Tizen::Base::String GetGuideText(void) const;
989
990         /**
991          * Gets the text color of the guide text.
992          *
993          * @since       2.0
994          *
995          * @return      The guide text color
996          * @exception   E_SUCCESS                       The method is successful.
997          * @exception   E_SYSTEM                        A system error has occurred.
998          * @remarks     The specific error code can be accessed using the GetLastResult() method.
999          * @see         SetGuideTextColor()
1000          */
1001         Tizen::Graphics::Color GetGuideTextColor(void) const;
1002
1003         /**
1004          * Sets the text color of the guide text.
1005          *
1006          * @since       2.0
1007          *
1008          * @return      An error code
1009          * @param[in]   color            The guide text color
1010          * @exception   E_SUCCESS                       The method is successful.
1011          * @exception   E_SYSTEM                        A system error has occurred.
1012          * @see         GetGuideTextColor()
1013          */
1014         result SetGuideTextColor(const Tizen::Graphics::Color& color);
1015
1016         /**
1017          * Gets the text color of the title for the specified status.
1018          *
1019          * @since               2.0
1020          *
1021          * @return              The title text color, @n
1022          *                              else RGBA(0,0,0,0) if an error occurs
1023          * @param[in]   status                  The state of the %EditField control
1024          * @exception   E_SUCCESS               The method is successful.
1025          * @exception   E_SYSTEM                A system error has occurred.
1026          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1027          * @see                 SetTitleTextColor()
1028          */
1029         Tizen::Graphics::Color GetTitleTextColor(EditStatus status) const;
1030
1031         /**
1032          * Sets the text color of the title for the specified status.
1033          *
1034          * @since       2.0
1035          *
1036          * @return          An error code
1037          * @param[in]   status                  The state of the %EditField control
1038          * @param[in]   color                   The title text color
1039          * @exception   E_SUCCESS               The method is successful.
1040          * @exception   E_SYSTEM                A system error has occurred.
1041          * @see         GetTitleTextColor()
1042          */
1043         result SetTitleTextColor(EditStatus status, const Tizen::Graphics::Color& color);
1044
1045         /**
1046          * Enables or disables the keypad.
1047          *
1048          * @since               2.0
1049          *
1050          * @param[in]   enable  Set to @c true to enable the keypad,
1051          *                      else @c false
1052          */
1053         void SetKeypadEnabled(bool enable);
1054
1055         /**
1056          * Checks whether the keypad is enabled.
1057          *
1058          * @since        2.0
1059          *
1060          * @return       @c true if the keypad is enabled, @n
1061          *               else @c false
1062          */
1063         bool IsKeypadEnabled(void) const;
1064
1065         /**
1066          * Checks whether the text prediction is enabled.
1067          *
1068          * @since 2.0
1069          * @return                @c true if the text prediction is enabled, @n
1070          *                                 else @c false
1071          * @see                      SetTextPredictionEnabled()
1072          */
1073         bool IsTextPredictionEnabled(void) const;
1074
1075         /**
1076          * Enables or disables the text prediction.
1077          *
1078          * @since 2.0
1079          * @param[in]           enable                       Set to @c true to enable the text prediction, @n
1080          *                                                                    else @c false
1081          * @return                An error code
1082          * @exception           E_SUCCESS                The method is successful.
1083          * @exception           E_UNSUPPORTED_OPERATION     This operation is not supported.
1084          * @see                      IsTextPredictionEnabled()
1085          */
1086         result SetTextPredictionEnabled(bool enable);
1087
1088         /**
1089          * Displays the keypad.
1090          *
1091          * @since               2.0
1092          *
1093          * @return              An error code
1094          * @exception   E_SUCCESS       The method is successful.
1095          * @exception   E_INVALID_STATE This instance is in an invalid state.
1096          * @exception   E_SYSTEM                A system error has occurred.
1097          * @remarks             This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1098          */
1099         result ShowKeypad(void);
1100
1101         /**
1102          * Gets the range of the current text block that is selected.
1103          *
1104          * @since               2.0
1105          *
1106          * @param[out]  start   The starting index of the current block
1107          * @param[out]  end     The end index of the current block
1108          */
1109         void GetBlockRange(int& start, int& end) const;
1110
1111         /**
1112          * Begins the text block from the current cursor position.
1113          *
1114          * @since               2.0
1115          *
1116          * @return              An error code
1117          * @exception   E_SUCCESS               The method is successful.
1118          * @exception   E_SYSTEM                A system error has occurred.
1119          * @remarks             Move the cursor position to the end of the text block.
1120          * @see         SetCursorPosition()
1121          * @see         ReleaseBlock()
1122          * @see                 IsBlocked()
1123          */
1124         result BeginBlock(void);
1125
1126         /**
1127          * Releases the selection of the current text block.
1128          *
1129          * @since               2.0
1130          *
1131          * @return              An error code
1132          * @exception   E_SUCCESS               The method is successful.
1133          * @exception   E_SYSTEM                A system error has occurred.
1134          * @see         BeginBlock()
1135          * @see                 IsBlocked()
1136          */
1137         result ReleaseBlock(void);
1138
1139         /**
1140          * Checks whether a portion of the text is blocked.
1141          *
1142          * @since       2.0
1143          *
1144          * @return      @c true if the text is blocked, @n
1145          *                      else @c false
1146          * @see     BeginBlock()
1147          * @see         ReleaseBlock()
1148          */
1149         bool IsBlocked(void) const;
1150
1151         /**
1152          * Copies the text block to the clipboard.
1153          *
1154          * @since               2.0
1155          *
1156          * @return              An error code
1157          * @exception   E_SUCCESS       The method is successful.
1158          * @exception   E_SYSTEM        A system error has occurred.
1159          * @see         Cut(), Paste(), Remove()
1160          */
1161         result Copy(void);
1162
1163         /**
1164          * Cuts the text block and copies it to the clipboard.
1165          *
1166          * @since               2.0
1167          *
1168          * @return              An error code
1169          * @exception   E_SUCCESS               The method is successful.
1170          * @exception   E_SYSTEM                A system error has occurred.
1171          * @see                 Copy(), Remove(), Paste()
1172          */
1173         result Cut(void);
1174
1175         /**
1176          * Pastes the copied text at the cursor position.
1177          *
1178          * @since               2.0
1179          *
1180          * @return              An error code
1181          * @exception   E_SUCCESS       The method is successful.
1182          * @exception   E_SYSTEM        A system error has occurred.
1183          * @see                 Copy(), Cut(), Remove()
1184          */
1185         result Paste(void);
1186
1187         /**
1188          * Removes the text that is marked by the text block.
1189          *
1190          * @since               2.0
1191          *
1192          * @return              An error code
1193          * @exception   E_SUCCESS               The method is successful.
1194          * @exception   E_SYSTEM                A system error has occurred.
1195          * @see                 Copy(), Cut(), Paste()
1196          */
1197         result Remove(void);
1198
1199         /**
1200          * Checks whether the text in the %EditField control is clipped.
1201          *
1202          * @since       2.0
1203          *
1204          * @return      @c true if the text is clipped, @n
1205          *                      else @c false
1206          * @remarks     'clipped' means that the text is copied to the clipboard.
1207          * @see         Copy(), Cut(), Paste(), Remove()
1208          */
1209         bool IsClipped(void) const;
1210
1211         /**
1212          * Sets the title of the %EditField control.
1213          *
1214          * @since               2.0
1215          *
1216          * @return              An error code
1217          * @param[in]   title                   The title to be set
1218          * @exception   E_SUCCESS               The method is successful.
1219          * @exception   E_SYSTEM                A system error has occurred.
1220          */
1221         result SetTitleText(const Tizen::Base::String& title);
1222
1223         /**
1224          * Gets the title text of the %EditField control.
1225          *
1226          * @since               2.0
1227          *
1228          * @return              The title text, @n
1229          *                              else an empty string if an error occurs
1230          */
1231         Tizen::Base::String GetTitleText(void) const;
1232
1233         /**
1234          * Sets the command button properties of the keypad.
1235          *
1236          * @since       2.0
1237          *
1238          * @return              An error code
1239          * @param[in]   position                        The position of the command button
1240          * @param[in]   text                            The label of the command button
1241          * @param[in]   actionId                        The action ID
1242          * @exception   E_SUCCESS           The method is successful.
1243          * @exception   E_SYSTEM            A system error has occurred.
1244          * @remarks             This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1245          */
1246         result SetOverlayKeypadCommandButton(CommandButtonPosition position, const Tizen::Base::String& text, int actionId);
1247
1248         /**
1249          * Gets the text of the specified command button.
1250          *
1251          * @since               2.0
1252          *
1253          * @return              The text of the specified command button
1254          * @param[in]   position    The position of the command button
1255          * @remarks             This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1256          */
1257         Tizen::Base::String GetOverlayKeypadCommandButtonText(CommandButtonPosition position) const;
1258
1259         /**
1260          * Gets the action ID of the specified command button.
1261          *
1262          * @since               2.0
1263          *
1264          * @return              The action ID of the specified command button
1265          * @param[in]   position    The position of the command button
1266          * @remarks             This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1267          */
1268         int GetOverlayKeypadCommandButtonActionId(CommandButtonPosition position) const;
1269
1270         /**
1271          * Sets the input language.
1272          *
1273          * @since      2.0
1274          *
1275          * @return     An error code
1276          * @param[in]  languageCode                             The language to be set
1277          * @exception  E_SUCCESS                                The method is successful.
1278          * @exception  E_OUT_OF_MEMORY                   The memory is insufficient.
1279          * @remarks     The application can set the language of the current keypad that is associated with the current %EditField. @n
1280          *             This method only works if the language to set is supported by the current preloaded keypad.
1281          */
1282         result SetCurrentLanguage(Tizen::Locales::LanguageCode languageCode);
1283
1284         /**
1285          * Gets the current input language.
1286          *
1287          * @since      2.0
1288          *
1289          * @return     An error code
1290          * @param[out] language               The current input language
1291          * @exception  E_SUCCESS                                The method is successful.
1292          * @remarks     The application can get the current language of the keypad that is associated with the current %EditField.
1293          */
1294         result GetCurrentLanguage(Tizen::Locales::LanguageCode& language) const;
1295
1296 protected:
1297         friend class _EditFieldImpl;
1298
1299 private:
1300         EditField(const EditField&);
1301         EditField& operator =(const EditField&);
1302
1303 }; // EditField
1304
1305 }}} // Tizen::Ui::Controls
1306
1307 #endif // _FUI_CTRL_EDIT_FIELD_H_