2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.Runtime.InteropServices;
24 /// Enumeration for describing the InputPanel layout types.
26 /// <since_tizen> preview </since_tizen>
27 public enum InputPanelLayout
30 /// The InputPanel layout type default.
35 /// The InputPanel layout type number.
40 /// The InputPanel layout type email.
45 /// The InputPanel layout type URL.
50 /// The InputPanel layout type phone.
55 /// The InputPanel layout type IP.
60 /// The InputPanel layout type month.
65 /// The InputPanel layout type number.
70 /// The InputPanel layout type error type. Do not use it directly!
75 /// The InputPanel layout type hexadecimal.
80 /// The InputPanel layout type terminal type: Esc, Alt, Ctrl, etc.
85 /// The InputPanel layout type password.
90 /// The keyboard layout type date and time.
95 /// The InputPanel layout type emoticons.
101 /// Enumeration for defining the "Return" key types on the input panel (virtual keyboard).
103 /// <since_tizen> preview </since_tizen>
104 public enum InputPanelReturnKeyType
107 /// The Default key type.
112 /// The Done key type.
122 /// The Join key type.
127 /// The Login key type.
132 /// The Next key type.
137 /// The Search string or magnifier icon key type.
142 /// The Send key type.
147 /// The Sign-in key type.
153 /// Enumeration for defining the autocapitalization types.
155 /// <since_tizen> preview </since_tizen>
156 public enum AutoCapital
159 /// No autocapitalization when typing.
164 /// Autocapitalize each of the typed word.
169 /// Autocapitalize the start of each sentence.
174 /// Autocapitalize all the letters.
180 /// Enumeration for defining the entry's copy and paste policy.
182 /// <since_tizen> preview </since_tizen>
183 public enum CopyAndPasteMode
186 /// Copy and paste text with a markup tag.
191 /// Copy and paste text without an item (image) tag.
196 /// Copy and paste text without a markup tag.
202 /// Enumeration for the text format types.
204 /// <since_tizen> preview </since_tizen>
205 public enum TextFormat
219 /// Enumeration that defines the types of Input Hints.
221 /// <since_tizen> preview </since_tizen>
222 public enum InputHints
230 /// Suggest word auto-completion.
235 /// The typed text should not be stored.
241 /// Enumeration for defining the input panel (virtual keyboard) language modes.
243 /// <since_tizen> preview </since_tizen>
244 public enum InputPanelLanguage
247 /// Automatic language mode.
252 /// Alphabet language mode.
258 /// The Entry is a convenience widget that shows a box in which the user can enter text.
260 /// <since_tizen> preview </since_tizen>
261 public class Entry : Layout
264 SmartEvent _changedByUser;
265 SmartEvent _cursorChanged;
266 SmartEvent _activated;
268 Dictionary<Func<string, EvasObject>, Interop.Elementary.Elm_Entry_Item_Provider_Cb> _itemsProvider = new Dictionary<Func<string, EvasObject>, Interop.Elementary.Elm_Entry_Item_Provider_Cb>();
269 Dictionary<Func<Entry, string, string>, Interop.Elementary.Elm_Entry_Filter_Cb> _textFilters = new Dictionary<Func<Entry, string, string>, Interop.Elementary.Elm_Entry_Filter_Cb>();
272 /// Creates and initializes a new instance of the Entry class.
274 /// <param name="parent">The EvasObject to which the new Entry will be attached as a child.</param>
275 /// <since_tizen> preview </since_tizen>
276 public Entry(EvasObject parent) : base(parent)
278 _clicked = new SmartEvent(this, this.RealHandle, "clicked");
279 _clicked.On += (s, e) => Clicked?.Invoke(this, EventArgs.Empty);
281 _changedByUser = new SmartEvent(this, this.RealHandle, "changed,user");
282 _changedByUser.On += (s, e) => ChangedByUser?.Invoke(this, EventArgs.Empty);
284 _cursorChanged = new SmartEvent(this, this.RealHandle, "cursor,changed");
285 _cursorChanged.On += (s, e) => CursorChanged?.Invoke(this, EventArgs.Empty);
287 _activated = new SmartEvent(this, this.RealHandle, "activated");
288 _activated.On += (s, e) => Activated?.Invoke(this, EventArgs.Empty);
292 /// Activated will be triggered when the entry is activated.
294 /// <since_tizen> preview </since_tizen>
295 public event EventHandler Activated;
298 /// Clicked will be triggered when the entry is clicked.
300 /// <since_tizen> preview </since_tizen>
301 public event EventHandler Clicked;
304 /// ChangedByUser will be triggered when the entry is changed by user.
306 /// <since_tizen> preview </since_tizen>
307 public event EventHandler ChangedByUser;
310 /// CursorChanged will be triggered when the cursor in the entry is changed.
312 /// <since_tizen> preview </since_tizen>
313 public event EventHandler CursorChanged;
316 /// Sets or gets the entry to the single line mode.
318 /// <since_tizen> preview </since_tizen>
319 public bool IsSingleLine
323 return Interop.Elementary.elm_entry_single_line_get(RealHandle);
327 Interop.Elementary.elm_entry_single_line_set(RealHandle, value);
332 /// Sets or gets the entry to the password mode.
334 /// <since_tizen> preview </since_tizen>
335 public bool IsPassword
339 return Interop.Elementary.elm_entry_password_get(RealHandle);
343 Interop.Elementary.elm_entry_password_set(RealHandle, value);
348 /// Sets or gets whether the entry is editable.
350 /// <since_tizen> preview </since_tizen>
351 public bool IsEditable
355 return Interop.Elementary.elm_entry_editable_get(RealHandle);
359 Interop.Elementary.elm_entry_editable_set(RealHandle, value);
364 /// Sets or gets whether the entry is empty.
366 /// <since_tizen> preview </since_tizen>
371 return Interop.Elementary.elm_entry_is_empty(RealHandle);
376 /// Sets or gets the text currently shown in the object entry.
378 /// <since_tizen> preview </since_tizen>
379 public override string Text
383 return Interop.Elementary.elm_entry_entry_get(RealHandle);
387 Interop.Elementary.elm_entry_entry_set(RealHandle, value);
392 /// Sets or gets the style on top of the user style stack.
394 /// <remarks>If there are styles in the user style stack, the properties in the top style of the user style stack will replace the properties in current theme. The input style is specified in the format, tag='property=value' (i.e., DEFAULT='font=Sans font_size=60'hilight=' + font_weight=Bold').</remarks>
395 /// <since_tizen> preview </since_tizen>
396 public string TextStyle
400 return Interop.Elementary.elm_entry_text_style_user_peek(RealHandle);
404 Interop.Elementary.elm_entry_text_style_user_push(RealHandle, value);
409 /// Sets or gets the current position of the cursor in the entry.
411 /// <since_tizen> preview </since_tizen>
412 public int CursorPosition
416 return Interop.Elementary.elm_entry_cursor_pos_get(RealHandle);
420 Interop.Elementary.elm_entry_cursor_pos_set(RealHandle, value);
425 /// Sets or gets the scrollable state of the entry.
427 /// <since_tizen> preview </since_tizen>
428 public bool Scrollable
432 return Interop.Elementary.elm_entry_scrollable_get(RealHandle);
436 // HACK: Enabling the scrollable property of an entry causes its internal
437 // hierarchy to change, making the internal edje object inaccessible.
438 // Access it before the property is set, to cache the edje object's handle.
441 var dummy = EdjeObject;
443 Interop.Elementary.elm_entry_scrollable_set(RealHandle, value);
448 /// Sets or gets the autocapitalization type on the immodule.
450 /// <since_tizen> preview </since_tizen>
451 public AutoCapital AutoCapital
455 return (AutoCapital)Interop.Elementary.elm_entry_autocapital_type_get(RealHandle);
459 Interop.Elementary.elm_entry_autocapital_type_set(RealHandle, (Interop.Elementary.AutocapitalType)value);
464 /// Sets or gets the entry object's 'autosave' status.
466 /// <since_tizen> preview </since_tizen>
467 public bool IsAutoSave
471 return Interop.Elementary.elm_entry_autosave_get(RealHandle);
475 Interop.Elementary.elm_entry_autosave_set(RealHandle, value);
480 /// Sets or gets the entry text paste/drop mode.
482 /// <since_tizen> preview </since_tizen>
483 public CopyAndPasteMode CopyAndPasteMode
487 return (CopyAndPasteMode)Interop.Elementary.elm_entry_cnp_mode_get(RealHandle);
491 Interop.Elementary.elm_entry_cnp_mode_set(RealHandle, (Interop.Elementary.CopyAndPasteMode)value);
496 /// Gets the geometry of the cursor.
498 /// <since_tizen> preview </since_tizen>
499 public Rect CursorGeometry
504 Interop.Elementary.elm_entry_cursor_geometry_get(RealHandle, out x, out y, out w, out h);
505 return new Rect(x, y, w, h);
510 /// Gets whether a format node exists at the current cursor position.
512 /// <since_tizen> preview </since_tizen>
513 public bool IsCursorFormat
517 return Interop.Elementary.elm_entry_cursor_is_format_get(RealHandle);
522 /// Gets if the current cursor position holds a visible format node.
524 /// <since_tizen> preview </since_tizen>
525 public bool IsCursorVisibelFormat
529 return Interop.Elementary.elm_entry_cursor_is_visible_format_get(RealHandle);
534 /// Sets or gets the value of the input hint.
536 /// <since_tizen> preview </since_tizen>
537 public InputHints InputHint
541 return (InputHints)Interop.Elementary.elm_entry_input_hint_get(RealHandle);
545 Interop.Elementary.elm_entry_input_hint_set(RealHandle, (Interop.Elementary.InputHints)value);
550 /// Sets or gets the language mode of the input panel.
552 /// <since_tizen> preview </since_tizen>
553 public InputPanelLanguage InputPanelLanguage
557 return (InputPanelLanguage)Interop.Elementary.elm_entry_input_panel_language_get(RealHandle);
561 Interop.Elementary.elm_entry_input_panel_language_set(RealHandle, (Interop.Elementary.InputPanelLanguage)value);
566 /// Sets or gets the input panel layout variation of the entry.
568 /// <since_tizen> preview </since_tizen>
569 public int InputPanelVariation
573 return Interop.Elementary.elm_entry_input_panel_layout_variation_get(RealHandle);
577 Interop.Elementary.elm_entry_input_panel_layout_variation_set(RealHandle, value);
582 /// Sets or gets the line wrap type to use on multiline entries.
584 /// <since_tizen> preview </since_tizen>
585 public WrapType LineWrapType
589 return (WrapType)Interop.Elementary.elm_entry_line_wrap_get(RealHandle);
593 Interop.Elementary.elm_entry_line_wrap_set(RealHandle, (Interop.Elementary.WrapType)value);
598 /// Sets or gets whether the entry should allow to use the text prediction.
600 /// <since_tizen> preview </since_tizen>
601 public bool PredictionAllowed
605 return Interop.Elementary.elm_entry_prediction_allow_get(RealHandle);
609 Interop.Elementary.elm_entry_prediction_allow_set(RealHandle, value);
614 /// Sets or gets whether the return key on the input panel should be disabled or not.
616 /// <since_tizen> preview </since_tizen>
617 public bool InputPanelReturnKeyDisabled
621 return Interop.Elementary.elm_entry_input_panel_return_key_disabled_get(RealHandle);
625 Interop.Elementary.elm_entry_input_panel_return_key_disabled_set(RealHandle, value);
630 /// Sets or gets the attribute to show the input panel, in case of only an user's explicit Mouse Up event.
631 /// It doesn't request to show the input panel even though it has focus.
632 /// If true, the input panel will be shown only in case of the Mouse up event (Focus event will be ignored).
634 /// <since_tizen> preview </since_tizen>
635 public bool InputPanelShowByOnDemand
639 return Interop.Elementary.elm_entry_input_panel_show_on_demand_get(RealHandle);
643 Interop.Elementary.elm_entry_input_panel_show_on_demand_set(RealHandle, value);
648 /// Sets the file (and implicitly loads it) for the text to display and then edit.
650 /// <param name="file">The path to the file to load and save.</param>
651 /// <param name="textFormat">The file format.</param>
652 /// <since_tizen> preview </since_tizen>
653 public void SetFile(string file, TextFormat textFormat)
655 Interop.Elementary.elm_entry_file_set(RealHandle, file, (Interop.Elementary.TextFormat)textFormat);
659 /// Converts a markup (HTML-like) string into UTF-8.
661 /// <param name="markup">The string (in markup) to be converted.</param>
662 /// <returns>The converted string (in UTF-8).</returns>
663 /// <since_tizen> preview </since_tizen>
664 public static string ConvertMarkupToUtf8(string markup)
666 return Interop.Elementary.elm_entry_markup_to_utf8(markup);
670 /// Moves the cursor by one position to the right within the entry.
672 /// <returns></returns>
673 /// <since_tizen> preview </since_tizen>
674 public bool MoveCursorNext()
676 return Interop.Elementary.elm_entry_cursor_next(RealHandle);
680 /// Moves the cursor one place to the left within the entry.
682 /// <returns>TRUE on success, otherwise FALSE on failure.</returns>
683 /// <since_tizen> preview </since_tizen>
684 public bool MoveCursorPrev()
686 return Interop.Elementary.elm_entry_cursor_prev(RealHandle);
690 /// Moves the cursor one line up within the entry.
692 /// <returns>TRUE on success, otherwise FALSE on failure.</returns>
693 /// <since_tizen> preview </since_tizen>
694 public bool MoveCursorUp()
696 return Interop.Elementary.elm_entry_cursor_up(RealHandle);
700 /// Moves the cursor one line down within the entry.
702 /// <returns>TRUE on success, otherwise FALSE on failure.</returns>
703 /// <since_tizen> preview </since_tizen>
704 public bool MoveCursorDown()
706 return Interop.Elementary.elm_entry_cursor_down(RealHandle);
710 /// Moves the cursor to the beginning of the entry.
712 /// <since_tizen> preview </since_tizen>
713 public void MoveCursorBegin()
715 Interop.Elementary.elm_entry_cursor_begin_set(RealHandle);
719 /// Moves the cursor to the end of the entry.
721 /// <since_tizen> preview </since_tizen>
722 public void MoveCursorEnd()
724 Interop.Elementary.elm_entry_cursor_end_set(RealHandle);
728 /// Moves the cursor to the beginning of the current line.
730 /// <since_tizen> preview </since_tizen>
731 public void MoveCursorLineBegin()
733 Interop.Elementary.elm_entry_cursor_line_begin_set(RealHandle);
737 /// Moves the cursor to the end of the current line.
739 /// <since_tizen> preview </since_tizen>
740 public void MoveCursorLineEnd()
742 Interop.Elementary.elm_entry_cursor_line_end_set(RealHandle);
746 /// Sets the input panel layout of the entry.
748 /// <param name="layout">The layout type.</param>
749 /// <since_tizen> preview </since_tizen>
750 public void SetInputPanelLayout(InputPanelLayout layout)
752 Interop.Elementary.elm_entry_input_panel_layout_set(RealHandle, (Interop.Elementary.InputPanelLayout)layout);
756 /// Sets the attribute to show the input panel automatically.
758 /// <param name="enabled">If true, the input panel appears when the entry is clicked or has focus, otherwise false.</param>
759 /// <since_tizen> preview </since_tizen>
760 public void SetInputPanelEnabled(bool enabled)
762 Interop.Elementary.elm_entry_input_panel_enabled_set(RealHandle, enabled);
766 /// Sets the "return" key type. This type is used to set the string or icon on the "return" key of the input panel.
768 /// <param name="keyType">The type of "return" key on the input panel.</param>
769 /// <since_tizen> preview </since_tizen>
770 public void SetInputPanelReturnKeyType(InputPanelReturnKeyType keyType)
772 Interop.Elementary.elm_entry_input_panel_return_key_type_set(RealHandle, (Interop.Elementary.ReturnKeyType)keyType);
776 /// Hides the input panel (virtual keyboard).
779 /// Note that the input panel is shown or hidden automatically according to the focus state of the entry widget.
780 /// This API can be used in case of manually controlling by using SetInputPanelEnabled(false).
782 /// <since_tizen> preview </since_tizen>
783 public void HideInputPanel()
785 Interop.Elementary.elm_entry_input_panel_hide(RealHandle);
789 /// Selects all the text within the entry.
791 /// <since_tizen> preview </since_tizen>
792 public void SelectAll()
794 Interop.Elementary.elm_entry_select_all(RealHandle);
798 /// Drops any existing text selection within the entry.
800 /// <since_tizen> preview </since_tizen>
801 public void SelectNone()
803 Interop.Elementary.elm_entry_select_none(RealHandle);
807 /// Forces calculation of the entry size and text layout.
809 /// <since_tizen> preview </since_tizen>
810 public void ForceCalculation()
812 Interop.Elementary.elm_entry_calc_force(RealHandle);
816 /// Gets the string by the cursor at its current position.
818 /// <returns></returns>
819 /// <since_tizen> preview </since_tizen>
820 public string GetCursorContent()
822 return Interop.Elementary.elm_entry_cursor_content_get(RealHandle);
826 /// Begins a selection within the entry, as though the user was holding down the mouse button to make a selection.
828 /// <since_tizen> preview </since_tizen>
829 public void BeginCursorSelection()
831 Interop.Elementary.elm_entry_cursor_selection_begin(RealHandle);
835 /// Appends the text of the entry.
837 /// <param name="text">The text to be displayed.</param>
838 /// <since_tizen> preview </since_tizen>
839 public void AppendText(string text)
841 Interop.Elementary.elm_entry_entry_append(RealHandle, text);
845 /// Sets or gets the value of the HorizontalScrollBarVisiblePolicy.
848 /// ScrollBarVisiblePolicy.Auto means that the horizontal scrollbar is made visible if it is needed, or otherwise kept hidden.
849 /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
851 /// <since_tizen> preview </since_tizen>
852 public virtual ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy
857 Interop.Elementary.elm_scroller_policy_get(RealHandle, out policy, IntPtr.Zero);
858 return (ScrollBarVisiblePolicy)policy;
862 ScrollBarVisiblePolicy v = VerticalScrollBarVisiblePolicy;
863 Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)value, (int)v);
868 /// Sets or gets the value of VerticalScrollBarVisiblePolicy.
871 /// ScrollBarVisiblePolicy.Auto means that the vertical scrollbar is made visible if it is needed, or otherwise kept hidden.
872 /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
874 /// <since_tizen> preview </since_tizen>
875 public virtual ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy
880 Interop.Elementary.elm_scroller_policy_get(RealHandle, IntPtr.Zero, out policy);
881 return (ScrollBarVisiblePolicy)policy;
885 ScrollBarVisiblePolicy h = HorizontalScrollBarVisiblePolicy;
886 Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)h, (int)value);
891 /// Sets or gets the vertical bounce behavior.
892 /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
893 /// This is a visual way to indicate that the end has reached.
894 /// This is enabled by default for both the axis.
895 /// This API will be set if it is enabled for the given axis with boolean parameters for each axis.
897 /// <since_tizen> preview </since_tizen>
898 public bool VerticalBounce
903 Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v);
908 bool h = HorizontalBounce;
909 Interop.Elementary.elm_scroller_bounce_set(RealHandle, h, value);
914 /// Sets or gets the horizontal bounce behavior.
915 /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
916 /// This is a visual way to indicate that the end has reached.
917 /// This is enabled by default for both the axis.
918 /// This API will be set if it is enabled for the given axis with boolean parameters for each axis.
920 /// <since_tizen> preview </since_tizen>
921 public bool HorizontalBounce
926 Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v);
931 bool v = VerticalBounce;
932 Interop.Elementary.elm_scroller_bounce_set(RealHandle, value, v);
937 /// Inserts the given text into the entry at the current cursor position.
939 /// <param name="text">The text to be inserted.</param>
940 /// <since_tizen> preview </since_tizen>
941 public void InsertTextToCursor(string text)
943 Interop.Elementary.elm_entry_entry_insert(RealHandle, text);
947 /// Ends a selection within the entry as though the user had just released the mouse button while making a selection.
949 /// <since_tizen> preview </since_tizen>
950 public void EndCursorSelection()
952 Interop.Elementary.elm_entry_cursor_selection_end(RealHandle);
956 /// Writes any changes made to the file that is set by a file.
958 /// <since_tizen> preview </since_tizen>
959 public void SaveFile()
961 Interop.Elementary.elm_entry_file_save(RealHandle);
965 /// Show the input panel (virtual keyboard) based on the input panel property of the entry such as layout, autocapital types, and so on.
968 /// Note that the input panel is shown or hidden automatically according to the focus state of the entry widget.
969 /// This API can be used in the case of manual control by using the SetInputPanelEnabled(false).
971 /// <since_tizen> preview </since_tizen>
972 public void ShowInputPanel()
974 Interop.Elementary.elm_entry_input_panel_show(RealHandle);
978 /// This appends a custom item provider to the list for that entry.
980 /// <param name="func">This function is used to provide items.</param>
981 /// <since_tizen> preview </since_tizen>
982 public void AppendItemProvider(Func<string, EvasObject> func)
986 if (!_itemsProvider.ContainsKey(func))
988 Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback;
990 itemProviderCallback = (d, o, t) =>
992 return func?.Invoke(t);
994 Interop.Elementary.elm_entry_item_provider_append(RealHandle, itemProviderCallback, IntPtr.Zero);
995 _itemsProvider.Add(func, itemProviderCallback);
1001 /// This prepends a custom item provider to the list for that entry.
1003 /// <param name="func">This function is used to provide items.</param>
1004 /// <since_tizen> preview </since_tizen>
1005 public void PrependItemProvider(Func<string, EvasObject> func)
1007 if (!_itemsProvider.ContainsKey(func))
1009 Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback;
1011 itemProviderCallback = (d, o, t) =>
1013 return func?.Invoke(t);
1015 Interop.Elementary.elm_entry_item_provider_prepend(RealHandle, itemProviderCallback, IntPtr.Zero);
1016 _itemsProvider.Add(func, itemProviderCallback);
1021 /// This removes a custom item provider to the list for that entry.
1023 /// <param name="func">This function is used to provide items.</param>
1024 /// <since_tizen> preview </since_tizen>
1025 public void RemoveItemProvider(Func<string, EvasObject> func)
1027 if (_itemsProvider.ContainsKey(func))
1029 Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback;
1030 _itemsProvider.TryGetValue(func, out itemProviderCallback);
1032 Interop.Elementary.elm_entry_item_provider_remove(RealHandle, itemProviderCallback, IntPtr.Zero);
1033 _itemsProvider.Remove(func);
1038 /// Appends a markup filter function for text inserted in the entry.
1040 /// <param name="filter">This function type is used by entry filters to modify text.</param>
1041 /// <since_tizen> preview </since_tizen>
1042 public void AppendMarkUpFilter(Func<Entry, string, string> filter)
1044 if (!_textFilters.ContainsKey(filter))
1046 Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback = (IntPtr d, IntPtr e, ref IntPtr t) =>
1048 var text = Marshal.PtrToStringAnsi(t);
1050 var updateText = filter(this, text);
1052 if (updateText != text)
1054 Interop.Libc.Free(t);
1055 t = Marshal.StringToHGlobalAnsi(updateText);
1058 Interop.Elementary.elm_entry_markup_filter_append(RealHandle, textFilterCallback, IntPtr.Zero);
1059 _textFilters.Add(filter, textFilterCallback);
1064 /// Prepends a markup filter function for text inserted in the entry.
1066 /// <param name="filter">This function type is used by entry filters to modify text.</param>
1067 /// <since_tizen> preview </since_tizen>
1068 public void PrependMarkUpFilter(Func<Entry, string, string> filter)
1070 if (!_textFilters.ContainsKey(filter))
1072 Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback = (IntPtr d, IntPtr e, ref IntPtr t) =>
1074 var text = Marshal.PtrToStringAnsi(t);
1076 var updateText = filter(this, text);
1078 if (updateText != text)
1080 Interop.Libc.Free(t);
1081 t = Marshal.StringToHGlobalAnsi(updateText);
1084 Interop.Elementary.elm_entry_markup_filter_prepend(RealHandle, textFilterCallback, IntPtr.Zero);
1085 _textFilters.Add(filter, textFilterCallback);
1090 /// Removes a markup filter.
1092 /// <param name="filter">This function type is used by entry filters to modify text.</param>
1093 /// <since_tizen> preview </since_tizen>
1094 public void RemoveMarkUpFilter(Func<Entry, string, string> filter)
1096 if (_textFilters.ContainsKey(filter))
1098 Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback;
1099 _textFilters.TryGetValue(filter, out textFilterCallback);
1101 Interop.Elementary.elm_entry_markup_filter_remove(RealHandle, textFilterCallback, IntPtr.Zero);
1102 _textFilters.Remove(filter);
1107 /// This executes a "copy" action on the selected text in the entry.
1109 /// <since_tizen> preview </since_tizen>
1110 public void CopySelection()
1112 Interop.Elementary.elm_entry_selection_copy(RealHandle);
1116 /// This executes a "cut" action on the selected text in the entry.
1118 /// <since_tizen> preview </since_tizen>
1119 public void CutSelection()
1121 Interop.Elementary.elm_entry_selection_cut(RealHandle);
1125 /// This executes a "paste" action in the entry.
1127 /// <since_tizen> preview </since_tizen>
1128 public void PasteSelection()
1130 Interop.Elementary.elm_entry_selection_paste(RealHandle);
1134 /// This disables the entry's selection handlers.
1135 /// This works properly on the profile that provides selection handlers.
1137 /// <param name="disable">If true, the selection handlers are disabled.</param>
1138 /// <since_tizen> preview </since_tizen>
1139 public void DisableSelection(bool disable)
1141 Interop.Elementary.elm_entry_selection_handler_disabled_set(RealHandle, disable);
1145 /// Gets any selected text within the entry.
1147 /// <returns>Selection's value.</returns>
1148 /// <since_tizen> preview </since_tizen>
1149 public string GetSelection()
1151 return Interop.Elementary.elm_entry_selection_get(RealHandle);
1155 /// This selects a region of text within the entry.
1157 /// <param name="start">The start position.</param>
1158 /// <param name="end">The end position.</param>
1159 /// <since_tizen> preview </since_tizen>
1160 public void SetSelectionRegion(int start, int end)
1162 Interop.Elementary.elm_entry_select_region_set(RealHandle, start, end);
1166 /// Sets the visibility of the left-side widget of the entry.
1168 /// <param name="isDisplay">true if the object should be displayed, otherwise false.</param>
1169 /// <since_tizen> preview </since_tizen>
1170 public void SetIconVisible(bool isDisplay)
1172 Interop.Elementary.elm_entry_icon_visible_set(RealHandle, isDisplay);
1176 /// Sets whether the return key on the input panel is disabled automatically, when the entry has no text.
1178 /// <param name="enable">If enabled is true, the return key is automatically disabled when the entry has no text.</param>
1179 /// <since_tizen> preview </since_tizen>
1180 public void SetInputPanelReturnKeyAutoEnable(bool enable)
1182 Interop.Elementary.elm_entry_input_panel_return_key_autoenabled_set(RealHandle, enable);
1186 /// Creates a widget handle.
1188 /// <param name="parent">Parent EvasObject.</param>
1189 /// <returns>Handle IntPtr.</returns>
1190 /// <since_tizen> preview </since_tizen>
1191 protected override IntPtr CreateHandle(EvasObject parent)
1193 return Interop.Elementary.elm_entry_add(parent.Handle);