2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiCtrlEditField.h
20 * @brief This is the header file for the %EditField class.
22 * This header file contains the declarations of the %EditField class and its helper classes.
25 #ifndef _FUI_CTRL_EDIT_FIELD_H_
26 #define _FUI_CTRL_EDIT_FIELD_H_
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 <FUiCtrlIEditTextFilter.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>
48 namespace Tizen { namespace Locales
53 namespace Tizen { namespace Ui { namespace Controls
58 * @brief This class defines a common behavior for an %EditField control.
62 * The %EditField class displays a single-line text editor.
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>.
66 * The following example demonstrates how to use the %EditField class.
69 // Sample code for EditFieldSample.h
73 : public Tizen::Ui::Controls::Form
74 , public Tizen::Ui::ITextEventListener
78 : __pEditField(null){}
80 bool Initialize(void);
81 virtual result OnInitializing(void);
84 virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
85 virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
88 Tizen::Ui::Controls::EditField* __pEditField;
93 // Sample code for EditFieldSample.cpp
94 #include <FGraphics.h>
96 #include "EditFieldSample.h"
98 using namespace Tizen::Graphics;
99 using namespace Tizen::Ui::Controls;
102 EditFieldSample::Initialize(void)
104 Construct(FORM_STYLE_NORMAL);
109 EditFieldSample::OnInitializing(void)
111 result r = E_SUCCESS;
113 // Creates an instance of EditField
114 __pEditField = new EditField();
115 __pEditField->Construct(Rectangle(50, 100, 400, 150));
116 __pEditField->AddTextEventListener(*this);
118 //Adds the edit field to the Form
119 AddControl(*__pEditField);
124 // ITextEventListener implementation
126 EditFieldSample::OnTextValueChanged(const Tizen::Ui::Control& source)
132 EditFieldSample::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
140 class _OSP_EXPORT_ EditField
141 : public Tizen::Ui::Control
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.
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.
156 virtual ~EditField(void);
159 * Initializes this instance of the %EditField control with the specified parameters.
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
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.
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);
189 * Initializes this instance of the %EditField control with the specified parameters.
193 * @return An error code
194 * @param[in] rect An instance of the Graphics::FloatRectangle class @n
195 * This instance represents the x and y coordinates of the top-left corner of the created window along with
196 * the width and height of the control.
197 * @param[in] style The style of the %EditField control
198 * @param[in] inputStyle The input style of the %EditField control
199 * @param[in] showTitle Set to @c true to display the title, @n
201 * @param[in] limitLength The limit for the length of the text in the %EditField control
202 * @param[in] groupStyle The table view style of the %EditField control
203 * @exception E_SUCCESS The method is successful.
204 * @exception E_INVALID_ARG The specified @c limitLength is less than or equal to @c 0, or @n
205 * either the @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 * The title is not supported by 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 has been used
210 * earlier. 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, %EditField is constructed with the minimum size.
212 * @remarks Following are the input styles used for creating the 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 the same as that of a parent form.
216 result Construct(const Tizen::Graphics::FloatRectangle& rect, EditFieldStyle style = EDIT_FIELD_STYLE_NORMAL, InputStyle inputStyle = INPUT_STYLE_FULLSCREEN, bool showTitle = false, int limitLength = 100, GroupStyle groupStyle = GROUP_STYLE_NONE);
219 * Initializes this instance of the %EditField control.
223 * @return An error code
224 * @param[in] rect The bounds of %EditField
225 * @param[in] style The style of the %EditField control
226 * @param[in] inputStyle The input style of the %EditField control
227 * @param[in] titleStyle The title style
228 * @param[in] enableClear Set to @c true to enable the clear button, @n
230 * @param[in] limitLength The limit of the length of text in the %EditField control
231 * @param[in] groupStyle The table view style of the %EditField control
232 * @exception E_SUCCESS The method is successful.
233 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
234 * The specified @c limitLength is less than or equal to @c 0. @n
235 * The specified @c rect.width or the @c rect.height is less than @c 0.
236 * @exception E_UNSUPPORTED_OPTION The specified option is not supported. @n
237 * Title is not supported in small style %EditField.
238 * @exception E_SYSTEM A system error has occurred.
239 * @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.
240 * The %EditField style of SMALL property cannot be used together with group styles. @n
241 * If the specified size is less than the minimum size, EditFied() is constructed with the minimum size.
242 * @remarks Following are the input styles used for creating different orientations of a keypad: @n
243 * - INPUT_STYLE_FULLSCREEN: The orientation is decided by the G-sensor value.@n
244 * - INPUT_STYLE_OVERLAY: The orientation is similar to the parent Form.
246 result Construct(const Tizen::Graphics::Rectangle& rect, EditFieldStyle style, InputStyle inputStyle, EditFieldTitleStyle titleStyle, bool enableClear = false, int limitLength = 100, GroupStyle groupStyle = GROUP_STYLE_NONE);
249 * Initializes this instance of the %EditField control.
253 * @return An error code
254 * @param[in] rect The bounds of %EditField
255 * @param[in] style The style of the %EditField control
256 * @param[in] inputStyle The input style of the %EditField control
257 * @param[in] titleStyle The title style
258 * @param[in] enableClear Set to @c true to enable the clear button, @n
260 * @param[in] limitLength The limit of the length of text in the %EditField control
261 * @param[in] groupStyle The table view style of the %EditField control
262 * @exception E_SUCCESS The method is successful.
263 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
264 * The specified @c limitLength is less than or equal to @c 0. @n
265 * The specified @c rect.width or the @c rect.height is less than @c 0.
266 * @exception E_UNSUPPORTED_OPTION The specified option is not supported. @n
267 * Title is not supported in small style %EditField.
268 * @exception E_SYSTEM A system error has occurred.
269 * @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.
270 * The %EditField style of SMALL property cannot be used together with group styles. @n
271 * If the specified size is less than the minimum size, EditFied() is constructed with the minimum size.
272 * @remarks Following are the input styles used for creating different orientations of a keypad: @n
273 * - INPUT_STYLE_FULLSCREEN: The orientation is decided by the G-sensor value.@n
274 * - INPUT_STYLE_OVERLAY: The orientation is similar to the parent Form.
276 result Construct(const Tizen::Graphics::FloatRectangle& rect, EditFieldStyle style, InputStyle inputStyle, EditFieldTitleStyle titleStyle, bool enableClear = false, int limitLength = 100, GroupStyle groupStyle = GROUP_STYLE_NONE);
280 * Gets the horizontal text alignment of the %EditField control.
284 * @return The horizontal text alignment
285 * @exception E_SUCCESS The method is successful.
286 * @exception E_SYSTEM A system error has occurred.
287 * @remarks The specific error code can be accessed using the GetLastResult() method.
288 * @see SetTextAlignment()
290 HorizontalAlignment GetTextAlignment(void) const;
293 * Sets the horizontal text alignment of the %EditField control.
297 * @return An error code
298 * @exception E_SUCCESS The method is successful.
299 * @exception E_SYSTEM A system error has occurred.
300 * @see GetTextAlignment()
302 result SetTextAlignment(HorizontalAlignment alignment);
305 * Checks whether the view mode is enabled.
309 * @return @c true if the view mode is enabled, @n
311 * @exception E_SUCCESS The method is successful.
312 * @exception E_SYSTEM A system error has occurred.
313 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
314 * In the view mode, the auto-detected links are displayed as linked text.
315 * @see SetViewModeEnabled()
317 bool IsViewModeEnabled(void) const;
320 * Enables or disables the view mode.
324 * @return An error code
325 * @param[in] enable Set to @c true to enable the view mode, @n
327 * @exception E_SUCCESS The method is successful.
328 * @exception E_SYSTEM A system error has occurred.
329 * @remarks In the view mode, the auto-detected links are displayed as linked text.
330 * @see IsViewModeEnabled()
332 result SetViewModeEnabled(bool enable);
335 * Sets the auto-link mask.
339 * @return An error code
340 * @param[in] autoLinks The auto-link mask @n
341 * Multiple link types can be combined using bitwise OR operator (see Tizen::Base::Utility::LinkType). @n
342 * For more information, see <a href="../org.tizen.native.appprogramming/html/guide/ui/auto_link_detection.htm">AutoLink Detection</a>.
343 * @exception E_SUCCESS The method is successful.
344 * @exception E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation @n
345 * The input style is not @c INPUT_STYLE_OVERLAY.
346 * @exception E_SYSTEM A system error has occurred.
347 * @remarks When @c autoLinks is set to @c 0, the auto-link detection is disabled.
348 * @see Tizen::Base::Utility::LinkType
349 * @see GetAutoLinkMask()
350 * @see IsViewModeEnabled()
351 * @see SetViewModeEnabled()
353 result SetAutoLinkMask(unsigned long autoLinks);
356 * Gets the auto-link mask.
360 * @return The auto-link mask
361 * @exception E_SUCCESS The method is successful.
362 * @exception E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation @n
363 * The input style is not @c INPUT_STYLE_OVERLAY.
364 * @exception E_SYSTEM A system error has occurred.
365 * @remarks The specific error code can be accessed using the GetLastResult() method.
366 * @see SetAutoLinkMask()
368 unsigned long GetAutoLinkMask(void) const;
371 * Adds a link event listener.
375 * @param[in] listener The event listener to add
376 * @remarks This method is supported when the input style is @c INPUT_STYLE_OVERLAY. @n
377 * The added listener is notified when the links are selected by the user.
378 * @see RemoveUiLinkEventListener()
380 void AddUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
383 * Removes the specified link event listener. @n
384 * The removed listener cannot listen to events when they are fired.
388 * @param[in] listener The event listener to remove
389 * @remarks This method is supported when the input style is @c INPUT_STYLE_OVERLAY.
390 * @see AddUiLinkEventListener()
392 void RemoveUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
395 * Gets the margin value of the specified margin type.
399 * @return The margin value of the specified margin type, @n
400 * else @c -1 if an error occurs
401 * @param[in] marginType The margin type
402 * @exception E_SUCCESS The method is successful.
403 * @exception E_SYSTEM A system error has occurred.
404 * @remarks The specific error code can be accessed using the GetLastResult() method.
407 int GetMargin(EditMarginType marginType) const;
410 * Gets the margin value of the specified margin type.
414 * @return The margin value of the specified margin type, @n
415 * else @c -1 if an error occurs
416 * @param[in] marginType The margin type
417 * @exception E_SUCCESS The method is successful.
418 * @exception E_SYSTEM A system error has occurred.
419 * @remarks The specific error code can be accessed using the GetLastResult() method.
422 float GetMarginF(EditMarginType marginType) const;
425 * Sets the margin for the specified margin type.
429 * @return An error code
430 * @param[in] marginType The margin type
431 * @param[in] margin The margin to set
432 * @exception E_SUCCESS The method is successful.
433 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
434 * The specified @c margin cannot be a negative integer.
435 * @exception E_SYSTEM A system error has occurred.
438 result SetMargin(EditMarginType marginType, int margin);
441 * Sets the margin for the specified margin type.
445 * @return An error code
446 * @param[in] marginType The margin type
447 * @param[in] margin The margin to set
448 * @exception E_SUCCESS The method is successful.
449 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
450 * The specified @c margin cannot be a negative integer.
451 * @exception E_SYSTEM A system error has occurred.
454 result SetMargin(EditMarginType marginType, float margin);
457 * Enables or disables the keypad action.
460 * @return An error code
461 * @param[in] enable Set to @c true to enable the keypad action, @n
463 * @exception E_SUCCESS The method is successful.
464 * @exception E_UNSUPPORTED_OPERATION The underlying input method does not support this operation.
465 * @remarks Depending on the value of input param, the enter key have a enable or disable look accordingly.
467 result SetKeypadActionEnabled(bool enable);
470 * Checks whether the keypad action is enabled.
473 * @return @c true if the keypad action is enabled, @n
476 bool IsKeypadActionEnabled(void) const;
479 * Gets the keypad action type.
483 * @return The keypad action
484 * @exception E_SUCCESS The method is successful.
485 * @exception E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
486 * The input style is not @c INPUT_STYLE_OVERLAY.
487 * @exception E_SYSTEM A system error has occurred.
488 * @remarks The specific error code can be accessed using the GetLastResult() method.
489 * @see SetKeypadAction()
491 Tizen::Ui::KeypadAction GetKeypadAction(void) const;
494 * Sets the keypad action type.
498 * @return An error code
499 * @param[in] keypadAction The keypad action
500 * @exception E_SUCCESS The method is successful.
501 * @exception E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
502 * The input style is not @c INPUT_STYLE_OVERLAY.
503 * @exception E_SYSTEM A system error has occurred.
504 * @remarks Based on the specified value of @c keypadAction, the enter key label of the keypad changes accordingly.
505 * @see GetKeypadAction()
507 result SetKeypadAction(Tizen::Ui::KeypadAction keypadAction);
510 * Sets the visibility of the command buttons of the overlay style keypad.
514 * @return An error code
515 * @param[in] visible Set to @c true to set the visibility of the overlay keypad command buttons, @n
517 * @exception E_SUCCESS The method is successful.
518 * @exception E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
519 * The input style is not @c INPUT_STYLE_OVERLAY.
520 * @exception E_SYSTEM A system error has occurred.
522 result SetOverlayKeypadCommandButtonVisible(bool visible);
525 * Checks whether the command buttons of the overlay style keypad are visible.
529 * @return @c true if the overlay command buttons are visible, @n
531 * @exception E_SUCCESS The method is successful.
532 * @exception E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
533 * The input style is not @c INPUT_STYLE_OVERLAY.
534 * @exception E_SYSTEM A system error has occurred.
535 * @remarks The specific error code can be accessed using the GetLastResult() method.
537 bool IsOverlayCommandButtonVisible(void) const;
544 * @return An error code
545 * @exception E_SUCCESS The method is successful.
546 * @exception E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
547 * The input style is not @c INPUT_STYLE_OVERLAY.
548 * @exception E_SYSTEM A system error has occurred.
551 result HideKeypad(void);
554 * Gets the position of the ellipsis.
558 * @return The ellipsis position
559 * @exception E_SUCCESS The method is successful.
560 * @exception E_SYSTEM A system error has occurred.
561 * @remarks The specific error code can be accessed using the GetLastResult() method.
562 * @see SetEllipsisPosition()
564 EllipsisPosition GetEllipsisPosition(void) const;
567 * Sets the position of the ellipsis.
571 * @return An error code
572 * @param[in] position The ellipsis position
573 * @exception E_SUCCESS The method is successful.
574 * @exception E_SYSTEM A system error has occurred.
575 * @see GetEllipsisPosition()
577 result SetEllipsisPosition(EllipsisPosition position);
580 * Gets the text size.
584 * @return The size of the text, @n
585 * else @c -1 if an error occurs
586 * @exception E_SUCCESS The method is successful.
587 * @exception E_SYSTEM A system error has occurred.
588 * @remarks The specific error code can be accessed using the GetLastResult() method.
591 int GetTextSize(void) const;
594 * Gets the text size.
598 * @return The size of the text, @n
599 * else @c -1 if an error occurs
600 * @exception E_SUCCESS The method is successful.
601 * @exception E_SYSTEM A system error has occurred.
602 * @remarks The specific error code can be accessed using the GetLastResult() method.
605 float GetTextSizeF(void) const;
608 * Sets the text size.
612 * @return An error code
613 * @param[in] size The text size
614 * @exception E_SUCCESS The method is successful.
615 * @exception E_INVALID_ARG The specified input parameter is invalid. @n
616 * The @c size cannot be a negative integer.
617 * @exception E_SYSTEM A system error has occurred.
620 result SetTextSize(int size);
623 * Sets the text size.
627 * @return An error code
628 * @param[in] size The text size
629 * @exception E_SUCCESS The method is successful.
630 * @exception E_INVALID_ARG The specified input parameter is invalid. @n
631 * The @c size cannot be a negative integer.
632 * @exception E_SYSTEM A system error has occurred.
633 * @see GetTextSizeF()
635 result SetTextSize(float size);
638 * Gets the color of the %EditField control for the specified status.
642 * @return The color, @n
643 * else RGBA(0,0,0,0) if an error occurs
644 * @param[in] status The status
645 * @exception E_SUCCESS The method is successful.
646 * @exception E_SYSTEM A system error has occurred.
647 * @remarks The specific error code can be accessed using the GetLastResult() method.
649 Tizen::Graphics::Color GetColor(EditStatus status) const;
652 * Gets the text color of the specified text color type.
656 * @return The color, @n
657 * else RGBA(0,0,0,0) if an error occurs
658 * @param[in] type The text color type
659 * @exception E_SUCCESS The method is successful.
660 * @exception E_SYSTEM A system error has occurred.
661 * @remarks The specific error code can be accessed using the GetLastResult() method.
662 * @see SetTextColor()
664 Tizen::Graphics::Color GetTextColor(EditTextColor type) const;
667 * Sets the background bitmap of the %EditField control for the specified status.
671 * @return An error code
672 * @param[in] status The status
673 * @param[in] bitmap The background bitmap
674 * @exception E_SUCCESS The method is successful.
675 * @exception E_SYSTEM A system error has occurred.
677 result SetBackgroundBitmap(EditStatus status, const Tizen::Graphics::Bitmap& bitmap);
680 * Sets the color of the %EditField control for the specified status.
684 * @return An error code
685 * @param[in] status The status
686 * @param[in] color The color
687 * @exception E_SUCCESS The method is successful.
688 * @exception E_SYSTEM A system error has occurred.
691 result SetColor(EditStatus status, const Tizen::Graphics::Color& color);
694 * Sets the text color of the %EditField control for the specified text color type.
698 * @return An error code
699 * @param[in] type The text color type
700 * @param[in] color The text color
701 * @exception E_SUCCESS The method is successful.
702 * @exception E_SYSTEM A system error has occurred.
703 * @see GetTextColor()
705 result SetTextColor(EditTextColor type, const Tizen::Graphics::Color& color);
708 * Gets a portion of text that is displayed by the %EditField control.
712 * @return The specified portion of the text, @n
713 * else an empty string if an error occurs
714 * @param[in] start The starting index of the range
715 * @param[in] end The last index of the range
716 * @exception E_SUCCESS The method is successful.
717 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, or @n
718 * the index is greater than the number of elements or less than @c 0.
719 * @exception E_SYSTEM A system error has occurred.
720 * @remarks The specific error code can be accessed using the GetLastResult() method.
723 Tizen::Base::String GetText(int start, int end) const;
726 * Adds a keypad event listener. @n
727 * The added listener is notified when the keypad associated with the %EditField control is opened or closed.
731 * @param[in] listener The event listener to add
732 * @see RemoveKeypadEventListener()
734 void AddKeypadEventListener(IKeypadEventListener& listener);
737 * Removes the specified keypad event listener. @n
738 * The removed listener cannot listen to events when they are fired.
742 * @param[in] listener The event listener to remove
743 * @see AddKeypadEventListener()
745 void RemoveKeypadEventListener(IKeypadEventListener& listener);
748 * Adds a text block event listener. @n
749 * The added listener is notified when the text block is selected.
753 * @param[in] listener The event listener to add
754 * @remarks Programmatically modifying the text block does not cause the text block selection event to fire.
755 * @see RemoveTextBlockEventListener()
757 void AddTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
760 * Removes the specified text block event listener. @n
761 * The removed listener cannot listen to events when they are fired.
765 * @param[in] listener The event listener to remove
766 * @see AddTextBlockEventListener()
768 void RemoveTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
771 * Adds the ITextEventListener instance. @n
772 * The added listener listens to events on the context of the specified event dispatcher when they are fired.
776 * @param[in] listener The listener to add
778 void AddTextEventListener(Tizen::Ui::ITextEventListener& listener);
781 * Removes the ITextEventListener instance. @n
782 * The removed listener cannot listen to events when they are fired.
786 * @param[in] listener The listener to remove
788 void RemoveTextEventListener(Tizen::Ui::ITextEventListener& listener);
791 * Adds the specified listener instance to listen to the scroll panel events.
795 * @param[in] listener The listener to add
796 * @remarks To listen to the scroll panel events, the parent of EditArea must be an instance of ScrollPanel. @n
797 * When OnOverlayControlCreated() or OnOvelayControlClosed() is called, the application resets the bounds of the controls placed
798 * within the ScrollPanel control. ScrollPanel is automatically drawn again after this method is called.
799 * @see RemoveScrollPanelEventListener()
801 void AddScrollPanelEventListener(Tizen::Ui::IScrollPanelEventListener& listener);
804 * Removes the specified scroll panel event listener instance. @n
805 * The removed listener cannot listen to events when they are fired.
809 * @param[in] listener The listener to remove
811 void RemoveScrollPanelEventListener(Tizen::Ui::IScrollPanelEventListener& listener);
814 * Adds the specified listener instance. @n
815 * The added listener can listen to events on the context of the given event dispatcher when they are fired.
819 * @param[in] listener The event listener to add
821 void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
824 * Removes a listener instance. @n
825 * The removed listener cannot listen to events when they are fired.
829 * @param[in] listener The event listener to remove
831 void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
834 * Adds the specified listener instance for language events. @n
835 * The added listener is notified when the input language is changed.
839 * @param[in] listener The listener to add
840 * @remarks The application can recognize when the language is changed from the keypad by adding Tizen::Ui::ILanguageEventListener.
841 * @see RemoveLanguageEventListener()
843 void AddLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
846 * Removes the specified listener instance. @n
847 * The removed listener cannot listen to events when they are fired.
851 * @param[in] listener The listener to remove
852 * @see AddLanguageEventListener()
854 void RemoveLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
857 * Gets the remaining length of the %EditField control.
861 * @return The remaining length of the %EditField control, @n
862 * else @c -1 if an error occurs
864 int GetRemainingLength(void) const;
867 * Enables or disables the lowercase mode.
871 * @param[in] enable Set to @c true to enable the lowercase mode, @n
874 void SetLowerCaseModeEnabled(bool enable);
877 * Checks whether the lowercase mode is enabled.
881 * @return @c true if the lowercase mode is enabled, @n
884 bool IsLowerCaseModeEnabled(void) const;
888 * Sets the input mode category.
890 * @brief <i> [Deprecated] </i>
891 * @deprecated We no longer provide a method to specify the list of styles which the user can set the keypad to, @n
892 * or the current mode to initially set the keypad to, from this list. It is recommended to use EditFieldStyle in the Construct() method instead.
895 * @return An error code
896 * @param[in] categories The categories to set @n
897 * Multiple input categories can be combined using bitwise OR operator (see Tizen::Ui::Controls::EditInputModeCategory).
898 * @param[in] enable The category value to set
899 * @exception E_SUCCESS The method is successful.
900 * @exception E_INVALID_ARG A specified input mode category is invalid.
901 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @n
902 * The specified @c categories cannot be supported with the current keypad style.
903 * @exception E_SYSTEM A system error has occurred.
906 result SetInputModeCategory(unsigned long categories, bool enable);
910 * Sets the current input mode category.
912 * @brief <i> [Deprecated] </i>
913 * @deprecated We no longer provide a method to specify the list of styles which the user can set the keypad to, @n
914 * or the current mode to initially set the keypad to, from this list. It is recommended to use EditFieldStyle in the Construct() method instead.
917 * @return An error code
918 * @param[in] inputModeCategory An item of input category
919 * @exception E_SUCCESS The method is successful.
920 * @exception E_SYSTEM A system error has occurred.
923 result SetCurrentInputModeCategory(EditInputModeCategory inputModeCategory);
927 * Gets the input mode category.
929 * @brief <i> [Deprecated] </i>
930 * @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.
933 * @return A bitwise combination of Tizen::Ui::Controls::EditInputModeCategory, @n
934 * else EDIT_INPUTMODE_ALPHA if an error occurs
937 unsigned long GetInputModeCategory(void) const;
941 * Gets the current input mode category.
943 * @brief <i> [Deprecated] </i>
944 * @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.
947 * @return The current input mode category
950 EditInputModeCategory GetCurrentInputModeCategory(void) const;
953 * Sets the cursor in the %EditField control at the specified position.
957 * @return An error code
958 * @param[in] position The cursor position to set
959 * @exception E_SUCCESS The method is successful.
960 * @exception E_OUT_OF_RANGE The specified @c position is less than @c 0 or greater than the maximum length.
961 * @exception E_SYSTEM A system error has occurred.
963 result SetCursorPosition(int position);
966 * Gets the cursor position.
970 * @return The current cursor position, @n
971 * else @c -1 if an error occurs
973 int GetCursorPosition(void) const;
976 * Gets the text that is displayed by the %EditField control.
980 * @return The text of the %EditField control, @n
981 * else an empty string if an error occurs
983 Tizen::Base::String GetText(void) const;
986 * Gets the length of the text that is displayed by the %EditField control.
990 * @return The length of the text, @n
991 * else @c -1 if an error occurs
993 int GetTextLength(void) const;
996 * Sets the text of the %EditField control.
1000 * @param[in] text The text to display by the %EditField control
1001 * @exception E_SUCCESS The method is successful.
1002 * @exception E_INVALID_ARG The specified input parameter is invalid. @n
1003 * The length of the specified @c text exceeds the system limitation or the limit length.
1004 * @exception E_SYSTEM A system error has occurred.
1005 * @remarks Use @htmlonly '\n' @endhtmlonly to denote the end of the line.
1007 result SetText(const Tizen::Base::String& text);
1010 * Inserts the specified text at the current cursor position.
1014 * @return An error code
1015 * @param[in] text The text to insert
1016 * @exception E_SUCCESS The method is successful.
1017 * @exception E_SYSTEM A system error has occurred.
1018 * @remarks Use @htmlonly '\n' @endhtmlonly to denote the end of the line.
1020 result InsertTextAtCursorPosition(const Tizen::Base::String& text);
1023 * Appends the specified text at the end of the existing text.
1027 * @return An error code
1028 * @param[in] text The text to append
1029 * @exception E_SUCCESS The method is successful.
1030 * @exception E_SYSTEM A system error has occurred.
1031 * @remarks Use @htmlonly '\n' @endhtmlonly to denote the end of the line.
1033 result AppendText(const Tizen::Base::String& text);
1036 * Appends the specified character at the end of the existing text.
1040 * @return An error code
1041 * @param[in] character The character to append
1042 * @exception E_SUCCESS The method is successful.
1043 * @exception E_SYSTEM A system error has occurred.
1044 * @remarks The method modifies the text buffer that is managed by the %EditField control. To display the
1045 * changes, the control must be drawn again.
1047 result AppendCharacter(const Tizen::Base::Character& character);
1050 * Clears the text that is displayed by the %EditField control.
1054 * @return An error code
1055 * @exception E_SUCCESS The method is successful.
1056 * @exception E_SYSTEM A system error has occurred.
1057 * @remarks The method modifies the text buffer that is managed by the %EditField control. To display the
1058 * changes, the control must be drawn again.
1063 * Deletes a character at the current cursor position.
1067 * @return An error code
1068 * @exception E_SUCCESS The method is successful.
1069 * @exception E_SYSTEM A system error has occurred.
1070 * @remarks The method modifies the text buffer that is managed by the %EditField control. To display the
1071 * changes, the control must be drawn again.
1073 result DeleteCharacterAtCursorPosition(void);
1076 * Gets the range of the current text block.
1080 * @param[out] start The first index of the current text block
1081 * @param[out] end The last index of the current text block
1083 void GetCurrentTextRange(int& start, int& end) const;
1086 * Sets the guide text.
1090 * @param[in] guideText The guide text
1091 * @remarks This is the default text that is displayed in the %EditField
1092 * control when the focus is given to it and no text is entered.
1094 void SetGuideText(const Tizen::Base::String& guideText);
1097 * Gets the guide text.
1101 * @return The guide text, @n
1102 * else an empty string if an error occurs
1103 * @exception E_SUCCESS The method is successful.
1104 * @exception E_SYSTEM A system error has occurred.
1105 * @remarks The specific error code can be accessed using the GetLastResult() method.
1106 * @see SetGuideText()
1108 Tizen::Base::String GetGuideText(void) const;
1111 * Gets the text color of the guide text.
1115 * @return The guide text color
1116 * @exception E_SUCCESS The method is successful.
1117 * @exception E_SYSTEM A system error has occurred.
1118 * @remarks The specific error code can be accessed using the GetLastResult() method.
1119 * @see SetGuideTextColor()
1121 Tizen::Graphics::Color GetGuideTextColor(void) const;
1124 * Sets the text color of the guide text.
1128 * @return An error code
1129 * @param[in] color The guide text color
1130 * @exception E_SUCCESS The method is successful.
1131 * @exception E_SYSTEM A system error has occurred.
1132 * @see GetGuideTextColor()
1134 result SetGuideTextColor(const Tizen::Graphics::Color& color);
1137 * Gets the text color of the title for the specified status.
1141 * @return The title text color, @n
1142 * else RGBA(0,0,0,0) if an error occurs
1143 * @param[in] status The state of the %EditField control
1144 * @exception E_SUCCESS The method is successful.
1145 * @exception E_SYSTEM A system error has occurred.
1146 * @remarks The specific error code can be accessed using the GetLastResult() method.
1147 * @see SetTitleTextColor()
1149 Tizen::Graphics::Color GetTitleTextColor(EditStatus status) const;
1152 * Sets the text color of the title for the specified status.
1156 * @return An error code
1157 * @param[in] status The state of the %EditField control
1158 * @param[in] color The title text color
1159 * @exception E_SUCCESS The method is successful.
1160 * @exception E_SYSTEM A system error has occurred.
1161 * @see GetTitleTextColor()
1163 result SetTitleTextColor(EditStatus status, const Tizen::Graphics::Color& color);
1166 * Enables or disables the keypad.
1170 * @param[in] enable Set to @c true to enable the keypad,
1173 void SetKeypadEnabled(bool enable);
1176 * Checks whether the keypad is enabled.
1180 * @return @c true if the keypad is enabled, @n
1183 bool IsKeypadEnabled(void) const;
1186 * Checks whether the text prediction is enabled.
1189 * @return @c true if the text prediction is enabled, @n
1191 * @see SetTextPredictionEnabled()
1193 bool IsTextPredictionEnabled(void) const;
1196 * Enables or disables the text prediction.
1199 * @param[in] enable Set to @c true to enable the text prediction, @n
1201 * @return An error code
1202 * @exception E_SUCCESS The method is successful.
1203 * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
1204 * @see IsTextPredictionEnabled()
1206 result SetTextPredictionEnabled(bool enable);
1209 * Displays the keypad.
1213 * @return An error code
1214 * @exception E_SUCCESS The method is successful.
1215 * @exception E_INVALID_STATE This instance is in an invalid state.
1216 * @exception E_SYSTEM A system error has occurred.
1217 * @remarks This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1219 result ShowKeypad(void);
1222 * Gets the range of the current text block that is selected.
1226 * @param[out] start The starting index of the current block
1227 * @param[out] end The end index of the current block
1229 void GetBlockRange(int& start, int& end) const;
1232 * Begins the text block from the current cursor position.
1236 * @return An error code
1237 * @exception E_SUCCESS The method is successful.
1238 * @exception E_SYSTEM A system error has occurred.
1239 * @remarks Move the cursor position to the end of the text block.
1240 * @see SetCursorPosition()
1241 * @see ReleaseBlock()
1244 result BeginBlock(void);
1247 * Releases the selection of the current text block.
1251 * @return An error code
1252 * @exception E_SUCCESS The method is successful.
1253 * @exception E_SYSTEM A system error has occurred.
1257 result ReleaseBlock(void);
1260 * Checks whether a portion of the text is blocked.
1264 * @return @c true if the text is blocked, @n
1267 * @see ReleaseBlock()
1269 bool IsBlocked(void) const;
1272 * Copies the text block to the clipboard.
1276 * @return An error code
1277 * @exception E_SUCCESS The method is successful.
1278 * @exception E_SYSTEM A system error has occurred.
1279 * @see Cut(), Paste(), Remove()
1284 * Cuts the text block and copies it to the clipboard.
1288 * @return An error code
1289 * @exception E_SUCCESS The method is successful.
1290 * @exception E_SYSTEM A system error has occurred.
1291 * @see Copy(), Remove(), Paste()
1296 * Pastes the copied text at the cursor position.
1300 * @return An error code
1301 * @exception E_SUCCESS The method is successful.
1302 * @exception E_SYSTEM A system error has occurred.
1303 * @see Copy(), Cut(), Remove()
1308 * Removes the text that is marked by the text block.
1312 * @return An error code
1313 * @exception E_SUCCESS The method is successful.
1314 * @exception E_SYSTEM A system error has occurred.
1315 * @see Copy(), Cut(), Paste()
1317 result Remove(void);
1320 * Checks whether the text in the %EditField control is clipped.
1324 * @return @c true if the text is clipped, @n
1326 * @remarks 'clipped' means that the text is copied to the clipboard.
1327 * @see Copy(), Cut(), Paste(), Remove()
1329 bool IsClipped(void) const;
1332 * Sets the title of the %EditField control.
1336 * @return An error code
1337 * @param[in] title The title to set
1338 * @exception E_SUCCESS The method is successful.
1339 * @exception E_SYSTEM A system error has occurred.
1341 result SetTitleText(const Tizen::Base::String& title);
1344 * Gets the title text of the %EditField control.
1348 * @return The title text, @n
1349 * else an empty string if an error occurs
1351 Tizen::Base::String GetTitleText(void) const;
1354 * Sets the command button properties of the keypad.
1358 * @return An error code
1359 * @param[in] position The position of the command button
1360 * @param[in] text The label of the command button
1361 * @param[in] actionId The action ID
1362 * @exception E_SUCCESS The method is successful.
1363 * @exception E_SYSTEM A system error has occurred.
1364 * @remarks This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1366 result SetOverlayKeypadCommandButton(CommandButtonPosition position, const Tizen::Base::String& text, int actionId);
1369 * Gets the text of the specified command button.
1373 * @return The text of the specified command button
1374 * @param[in] position The position of the command button
1375 * @remarks This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1377 Tizen::Base::String GetOverlayKeypadCommandButtonText(CommandButtonPosition position) const;
1380 * Gets the action ID of the specified command button.
1384 * @return The action ID of the specified command button
1385 * @param[in] position The position of the command button
1386 * @remarks This method is supported only when the input style is INPUT_STYLE_OVERLAY.
1388 int GetOverlayKeypadCommandButtonActionId(CommandButtonPosition position) const;
1391 * Sets the input language.
1395 * @return An error code
1396 * @param[in] languageCode The language to set
1397 * @exception E_SUCCESS The method is successful.
1398 * @exception E_OUT_OF_MEMORY The memory is insufficient.
1399 * @remarks The application can set the language of the current keypad that is associated with the current %EditField. @n
1400 * This method only works if the language to set is supported by the current preloaded keypad.
1402 result SetCurrentLanguage(Tizen::Locales::LanguageCode languageCode);
1405 * Gets the current input language.
1409 * @return An error code
1410 * @param[out] language The current input language
1411 * @exception E_SUCCESS The method is successful.
1412 * @remarks The application can get the current language of the keypad that is associated with the current %EditField.
1414 result GetCurrentLanguage(Tizen::Locales::LanguageCode& language) const;
1417 * Sets the text filter.
1421 * @param[in] pFilter The filter
1422 * @remarks The %EditField control checks with the registered filter to decide whether the user-entered text should be replaced.
1424 void SetEditTextFilter(IEditTextFilter* pFilter);
1427 * Sends opaque command to the input method.
1431 * @param[in] command The opaque command
1432 * @remarks This method can be used to provide domain-specific features that are only known between certain input methods and their clients.
1433 * This method may not work, depending on the active Input Method.
1435 void SendOpaqueCommand (const Tizen::Base::String& command);
1438 friend class _EditFieldImpl;
1441 EditField(const EditField&);
1442 EditField& operator =(const EditField&);
1446 }}} // Tizen::Ui::Controls
1448 #endif // _FUI_CTRL_EDIT_FIELD_H_