diff options
-rw-r--r--[-rwxr-xr-x] | ElmSharp.Test/ElmSharp.Test.csproj | 15 | ||||
-rw-r--r-- | ElmSharp.Test/TC/EntryTest1.cs | 86 | ||||
-rw-r--r-- | ElmSharp.Test/TC/EntryTest3.cs | 102 | ||||
-rw-r--r--[-rwxr-xr-x] | ElmSharp/ElmSharp/Entry.cs | 590 | ||||
-rw-r--r-- | ElmSharp/Interop/Interop.Elementary.Entry.cs | 207 |
5 files changed, 958 insertions, 42 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj index 9014a3e..31b0e5b 100755..100644 --- a/ElmSharp.Test/ElmSharp.Test.csproj +++ b/ElmSharp.Test/ElmSharp.Test.csproj @@ -46,6 +46,7 @@ <Compile Include="TC\BackgroundTest2.cs" /> <Compile Include="TC\BackgroundTest3.cs" /> <Compile Include="TC\EcoreTimerTest1.cs" /> + <Compile Include="TC\EntryTest3.cs" /> <Compile Include="TC\EvasMapTest2.cs" /> <Compile Include="TC\GenListTest10.cs" /> <Compile Include="TC\ImageTest4.cs" /> @@ -126,12 +127,6 @@ <None Include="test.sh" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\ElmSharp\ElmSharp.csproj"> - <Project>{7b15af72-70cc-11e6-ae37-eb727f0bd84e}</Project> - <Name>ElmSharp</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> <Content Include="res\btn_delete.png" /> <Content Include="res\picture.png"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> @@ -184,6 +179,12 @@ <Content Include="shared\res\ElmSharp.Test.png" /> <Content Include="tizen-manifest.xml" /> </ItemGroup> + <ItemGroup> + <Reference Include="ElmSharp, Version=1.2.0.0, Culture=neutral, PublicKeyToken=3836ec6cd2c91e8b, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ElmSharp\bin\Debug\netstandard1.3\ElmSharp.dll</HintPath> + </Reference> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. @@ -214,4 +215,4 @@ </FlavorProperties> </VisualStudio> </ProjectExtensions> -</Project> +</Project>
\ No newline at end of file diff --git a/ElmSharp.Test/TC/EntryTest1.cs b/ElmSharp.Test/TC/EntryTest1.cs index c77101a..2dc8437 100644 --- a/ElmSharp.Test/TC/EntryTest1.cs +++ b/ElmSharp.Test/TC/EntryTest1.cs @@ -65,18 +65,100 @@ namespace ElmSharp.Test Entry entry3 = new Entry(window) { + AlignmentX = -1, + AlignmentY = 0, + WeightX = 1, + WeightY = 1, IsSingleLine = true, Scrollable = true, }; entry3.SetPartText("guide", "<span color=#808080FF font_size=28 align=left valign=top wrap=mixed>Enter a System.Double</span>"); - entry3.Geometry = new Rect(0, 163, 720, 37); + //entry3.Geometry = new Rect(0, 163, 720, 37); entry3.Show(); + var capital1 = new Entry(window) + { + AlignmentX = -1, + AlignmentY = 0, + WeightX = 1, + WeightY = 1, + Text = "Auto Capital : Word", + AutoCapital = AutoCapital.Word + }; + + var capital2 = new Entry(window) + { + AlignmentX = -1, + AlignmentY = 0, + WeightX = 1, + WeightY = 1, + Text = "Auto Capital : Sentence", + AutoCapital = AutoCapital.Sentence + }; + + var capital3 = new Entry(window) + { + AlignmentX = -1, + AlignmentY = 0, + WeightX = 1, + WeightY = 1, + Text = "Auto Capital : All", + AutoCapital = AutoCapital.All + }; + + var getText = new Entry(window) + { + AlignmentX = -1, + AlignmentY = 0, + WeightX = 1, + WeightY = 1, + Text = "get cursor content test", + }; + + var label = new Label(window) + { + AlignmentX = -1, + AlignmentY = 0, + WeightX = 1, + WeightY = 1, + }; + + getText.CursorChanged += (s, e) => + { + label.Text = getText.GetCursorContent(); + }; + + //var autoSave = new Entry(window) + //{ + // AlignmentX = -1, + // AlignmentY = 0, + // WeightX = 1, + // WeightY = 1, + // Text = "Auto Save", + // IsAutoSave = true + //}; + + var btn = new Button(window) + { + }; + box.PackEnd(entry1); box.PackEnd(entry2); + box.PackEnd(entry3); + box.PackEnd(capital1); + box.PackEnd(capital2); + box.PackEnd(capital3); + box.PackEnd(getText); + box.PackEnd(label); entry1.Show(); entry2.Show(); + entry3.Show(); + capital1.Show(); + capital2.Show(); + capital3.Show(); + getText.Show(); + label.Show(); } } -} +}
\ No newline at end of file diff --git a/ElmSharp.Test/TC/EntryTest3.cs b/ElmSharp.Test/TC/EntryTest3.cs new file mode 100644 index 0000000..755f887 --- /dev/null +++ b/ElmSharp.Test/TC/EntryTest3.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp; + +namespace ElmSharp.Test +{ + class EntryTest3 : TestCaseBase + { + public override string TestName => "EntryTest3"; + public override string TestDescription => "To test basic operation of Entry"; + + public override void Run(Window window) + { + Background bg = new Background(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = Color.Yellow + }; + bg.Show(); + window.AddResizeObject(bg); + + Conformant conformant = new Conformant(window); + conformant.Show(); + Box box = new Box(window); + conformant.SetContent(box); + box.Show(); + + Entry entry = new Entry(window) + { + AlignmentX = -1, + AlignmentY = 1, + WeightX = 1, + WeightY = 1, + IsSingleLine = true, + Text = "Hello, Tizen" + }; + + var btn = new Button(window) + { + AlignmentX = -1, + AlignmentY = 1, + WeightX = 1, + WeightY = 1, + Text = "Set Filter" + }; + btn.Show(); + + //var filter = new Entry.TextFilter(SetFilter); + btn.Clicked += (s, e) => + { + entry.AppendMarkUpFilter(SetFilter); + }; + + var btn1 = new Button(window) + { + AlignmentX = -1, + AlignmentY = 1, + WeightX = 1, + WeightY = 1, + Text = "Remove Filter" + }; + btn1.Show(); + btn1.Clicked += (s, e) => + { + entry.RemoveMarkUpFilter(SetFilter); + }; + + //entry.AppendMarkUpFilter(new Entry.Filter(SetFilter)); + + entry.Show(); + box.PackEnd(entry); + box.PackEnd(btn); + box.PackEnd(btn1); + } + + public string SetFilter(Entry entry, string text) + { + if (text.Equals("a") || text.Equals("b") || text.Equals("c") || text.Equals("d")) + return text; + else + return "Tizen"; + } + } +}
\ No newline at end of file diff --git a/ElmSharp/ElmSharp/Entry.cs b/ElmSharp/ElmSharp/Entry.cs index 8413592..420f624 100755..100644 --- a/ElmSharp/ElmSharp/Entry.cs +++ b/ElmSharp/ElmSharp/Entry.cs @@ -15,6 +15,8 @@ */ using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; namespace ElmSharp { @@ -103,34 +105,42 @@ namespace ElmSharp /// Default key type /// </summary> Default, + /// <summary> /// Done key type /// </summary> Done, + /// <summary> /// Go key type /// </summary> Go, + /// <summary> /// Join key type /// </summary> Join, + /// <summary> /// Login key type /// </summary> Login, + /// <summary> /// Next key type /// </summary> Next, + /// <summary> /// Search string or magnifier icon key type /// </summary> Search, + /// <summary> /// Send key type /// </summary> Send, + /// <summary> /// Sign-in key type /// </summary> @@ -138,6 +148,106 @@ namespace ElmSharp } /// <summary> + /// Enumeration that defines the autocapitalization types. + /// </summary> + public enum AutoCapital + { + /// <summary> + /// No autocapitalization when typing + /// </summary> + None, + + /// <summary> + /// Autocapitalize each typed word + /// </summary> + Word, + + /// <summary> + /// Autocapitalize the start of each sentence + /// </summary> + Sentence, + + /// <summary> + /// Autocapitalize all letters + /// </summary> + All + } + + /// <summary> + /// Enumeration that defines the entry's copy & paste policy. + /// </summary> + public enum CopyAndPasteMode + { + /// <summary> + /// Copy & paste text with markup tag + /// </summary> + Markup, + + /// <summary> + /// Copy & paste text without item(image) tag + /// </summary> + NoImage, + + /// <summary> + /// Copy & paste text without markup tag + /// </summary> + PlainText + } + + /// <summary> + /// Enumeration that defines the text format types. + /// </summary> + public enum TextFormat + { + /// <summary> + /// Plain type + /// </summary> + Plain, + + /// <summary> + /// Markup type + /// </summary> + Markup + } + + /// <summary> + /// Enumeration that defines the types of Input Hints. + /// </summary> + public enum InputHints + { + /// <summary> + /// No active hints + /// </summary> + None, + + /// <summary> + /// suggest word auto completion + /// </summary> + AutoComplete, + + /// <summary> + /// typed text should not be stored. + /// </summary> + SensitiveData, + } + + /// <summary> + /// Enumeration that defines the input panel (virtual keyboard) language modes. + /// </summary> + public enum InputPanelLanguage + { + /// <summary> + /// Automatic language mode + /// </summary> + Automatic, + + /// <summary> + /// Alphabet language mode + /// </summary> + Alphabet, + } + + /// <summary> /// The entry is a convenience widget that shows a box in which the user can enter text. /// </summary> public class Entry : Layout @@ -147,6 +257,9 @@ namespace ElmSharp SmartEvent _cursorChanged; SmartEvent _activated; + Dictionary<Func<string, EvasObject>, Interop.Elementary.Elm_Entry_Item_Provider_Cb> _itemsProvider = new Dictionary<Func<string, EvasObject>, Interop.Elementary.Elm_Entry_Item_Provider_Cb>(); + Dictionary<Func<Entry, string, string>, Interop.Elementary.Elm_Entry_Filter_Cb> _textFilters = new Dictionary<Func<Entry, string, string>, Interop.Elementary.Elm_Entry_Filter_Cb>(); + /// <summary> /// Creates and initializes a new instance of the Entry class. /// </summary> @@ -241,6 +354,7 @@ namespace ElmSharp return Interop.Elementary.elm_entry_is_empty(RealHandle); } } + /// <summary> /// Sets or gets text currently shown in the object entry. /// </summary> @@ -310,6 +424,203 @@ namespace ElmSharp } /// <summary> + /// Sets or Gets the autocapitalization type on the immodule. + /// </summary> + public AutoCapital AutoCapital + { + get + { + return (AutoCapital)Interop.Elementary.elm_entry_autocapital_type_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_autocapital_type_set(RealHandle, (Interop.Elementary.AutocapitalType)value); + } + } + + /// <summary> + /// Sets or Gets the entry object's 'autosave' status. + /// </summary> + public bool IsAutoSave + { + get + { + return Interop.Elementary.elm_entry_autosave_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_autosave_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or Gets entry text paste/drop mode. + /// </summary> + public CopyAndPasteMode CopyAndPasteMode + { + get + { + return (CopyAndPasteMode)Interop.Elementary.elm_entry_cnp_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_cnp_mode_set(RealHandle, (Interop.Elementary.CopyAndPasteMode)value); + } + } + + /// <summary> + /// Gets the geometry of the cursor. + /// </summary> + public Rect CursorGeometry + { + get + { + int x, y, w, h; + Interop.Elementary.elm_entry_cursor_geometry_get(RealHandle, out x, out y, out w, out h); + return new Rect(x, y, w, h); + } + } + + /// <summary> + /// Gets whether a format node exists at the current cursor position. + /// </summary> + public bool IsCursorFormat + { + get + { + return Interop.Elementary.elm_entry_cursor_is_format_get(RealHandle); + } + } + + /// <summary> + /// Gets if the current cursor position holds a visible format node. + /// </summary> + public bool IsCursorVisibelFormat + { + get + { + return Interop.Elementary.elm_entry_cursor_is_visible_format_get(RealHandle); + } + } + + /// <summary> + /// Sets or Gets the value of input hint. + /// </summary> + public InputHints InputHint + { + get + { + return (InputHints)Interop.Elementary.elm_entry_input_hint_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_hint_set(RealHandle, (Interop.Elementary.InputHints)value); + } + } + + /// <summary> + /// Sets or gets the language mode of the input panel. + /// </summary> + public InputPanelLanguage InputPanelLanguage + { + get + { + return (InputPanelLanguage)Interop.Elementary.elm_entry_input_panel_language_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_language_set(RealHandle, (Interop.Elementary.InputPanelLanguage)value); + } + } + + /// <summary> + /// Sets or gets the input panel layout variation of the entry. + /// </summary> + public int InputPanelVariation + { + get + { + return Interop.Elementary.elm_entry_input_panel_layout_variation_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_layout_variation_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or gets the line wrap type to use on multi-line entries. + /// </summary> + public WrapType LineWrapType + { + get + { + return (WrapType)Interop.Elementary.elm_entry_line_wrap_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_line_wrap_set(RealHandle, (Interop.Elementary.WrapType)value); + } + } + + /// <summary> + /// Sets or gets whether the entry should allow to use the text prediction. + /// </summary> + public bool PredictionAllowed + { + get + { + return Interop.Elementary.elm_entry_prediction_allow_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_prediction_allow_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or gets whether the return key on the input panel should be disabled or not. + /// </summary> + public bool InputPanelReturnKeyDisabled + { + get + { + return Interop.Elementary.elm_entry_input_panel_return_key_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_return_key_disabled_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or gets the attribute to show the input panel in case of only an user's explicit Mouse Up event. + /// It doesn't request to show the input panel even though it has focus. + /// If true, the input panel will be shown in case of only Mouse up event. (Focus event will be ignored.) + /// </summary> + public bool InputPanelShowByOnDemand + { + get + { + return Interop.Elementary.elm_entry_input_panel_show_on_demand_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_show_on_demand_set(RealHandle, value); + } + } + + /// <summary> + /// Sets the file (and implicitly loads it) for the text to display and then edit. + /// </summary> + /// <param name="file">The path to the file to load and save</param> + /// <param name="textFormat">The file format</param> + public void SetFile(string file, TextFormat textFormat) + { + Interop.Elementary.elm_entry_file_set(RealHandle, file, (Interop.Elementary.TextFormat)textFormat); + } + + /// <summary> /// Converts a markup (HTML-like) string into UTF-8. /// </summary> /// <param name="markup">The string (in markup) to be converted</param> @@ -415,6 +726,18 @@ namespace ElmSharp } /// <summary> + /// Hides the input panel (virtual keyboard). + /// </summary> + /// <remark> + /// Note that the input panel is shown or hidden automatically according to the focus state of the entry widget. + /// This API can be used in case of manually controlling by using SetInputPanelEnabled(false). + /// </remark> + public void HideInputPanel() + { + Interop.Elementary.elm_entry_input_panel_hide(RealHandle); + } + + /// <summary> /// Selects all the text within the entry. /// </summary> public void SelectAll() @@ -439,16 +762,279 @@ namespace ElmSharp color.A); } + /// <summary> + /// Forces calculation of the entry size and text layouting. + /// </summary> + public void ForceCalculation() + { + Interop.Elementary.elm_entry_calc_force(RealHandle); + } + + /// <summary> + /// Gets the string by the cursor at its current position. + /// </summary> + /// <returns></returns> + public string GetCursorContent() + { + return Interop.Elementary.elm_entry_cursor_content_get(RealHandle); + } + + /// <summary> + /// Begins a selection within the entry as though the user were holding down the mouse button to make a selection. + /// </summary> + public void BeginCursorSelection() + { + Interop.Elementary.elm_entry_cursor_selection_begin(RealHandle); + } + + /// <summary> + /// Appends the text of the entry. + /// </summary> + /// <param name="text">The text to be displayed</param> + public void AppendText(string text) + { + Interop.Elementary.elm_entry_entry_append(RealHandle, text); + } + + /// <summary> + /// Inserts the given text into the entry at the current cursor position. + /// </summary> + /// <param name="text"></param> + public void InsertTextToCursor(string text) + { + Interop.Elementary.elm_entry_entry_insert(RealHandle, text); + } + + /// <summary> + /// Ends a selection within the entry as though the user had just released the mouse button while making a selection. + /// </summary> + public void EndCursorSelection() + { + Interop.Elementary.elm_entry_cursor_selection_end(RealHandle); + } + + /// <summary> + /// Writes any changes made to the file that is set by File. + /// </summary> + public void SaveFile() + { + Interop.Elementary.elm_entry_file_save(RealHandle); + } + + /// <summary> + /// Show the input panel (virtual keyboard) based on the input panel property of entry such as layout, autocapital types, and so on. + /// </summary> + /// <remarks> + /// Note that input panel is shown or hidden automatically according to the focus state of entry widget. + /// This API can be used in the case of manually controlling by using SetInputPanelEnabled(false). + /// </remarks> + public void ShowInputPanel() + { + Interop.Elementary.elm_entry_input_panel_show(RealHandle); + } + + /// <summary> + /// This appends a custom item provider to the list for that entry. + /// </summary> + /// <param name="func">This function is used to provide items.</param> + public void AppendItemProvider(Func<string, EvasObject> func) + { + if (func != null) + { + if (!_itemsProvider.ContainsKey(func)) + { + Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback; + + itemProviderCallback = (d, o, t) => + { + return func?.Invoke(t); + }; + Interop.Elementary.elm_entry_item_provider_append(RealHandle, itemProviderCallback, IntPtr.Zero); + _itemsProvider.Add(func, itemProviderCallback); + } + } + } + + /// <summary> + /// This prepends a custom item provider to the list for that entry. + /// </summary> + /// <param name="func">This function is used to provide items.</param> + public void PrependItemProvider(Func<string, EvasObject> func) + { + if (!_itemsProvider.ContainsKey(func)) + { + Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback; + + itemProviderCallback = (d, o, t) => + { + return func?.Invoke(t); + }; + Interop.Elementary.elm_entry_item_provider_prepend(RealHandle, itemProviderCallback, IntPtr.Zero); + _itemsProvider.Add(func, itemProviderCallback); + } + } + + /// <summary> + /// This removes a custom item provider to the list for that entry. + /// </summary> + /// <param name="itemProvider">This function is used to provide items.</param> + public void RemoveItemProvider(Func<string, EvasObject> func) + { + if (_itemsProvider.ContainsKey(func)) + { + Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback; + _itemsProvider.TryGetValue(func, out itemProviderCallback); + + Interop.Elementary.elm_entry_item_provider_remove(RealHandle, itemProviderCallback, IntPtr.Zero); + _itemsProvider.Remove(func); + } + } + + /// <summary> + /// Append a markup filter function for text inserted in the entry. + /// </summary> + /// <param name="filter">This function type is used by entry filters to modify text.</param> + public void AppendMarkUpFilter(Func<Entry, string, string> filter) + { + if (!_textFilters.ContainsKey(filter)) + { + Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback = (IntPtr d, IntPtr e, ref IntPtr t) => + { + var text = Marshal.PtrToStringAnsi(t); + + var updateText = filter(this, text); + + if (updateText != text) + { + Interop.Libc.Free(t); + t = Marshal.StringToHGlobalAnsi(updateText); + } + }; + Interop.Elementary.elm_entry_markup_filter_append(RealHandle, textFilterCallback, IntPtr.Zero); + _textFilters.Add(filter, textFilterCallback); + } + } + + /// <summary> + /// Prepend a markup filter function for text inserted in the entry. + /// </summary> + /// <param name="filter">This function type is used by entry filters to modify text.</param> + public void PrependMarkUpFilter(Func<Entry, string, string> filter) + { + if (!_textFilters.ContainsKey(filter)) + { + Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback = (IntPtr d, IntPtr e, ref IntPtr t) => + { + var text = Marshal.PtrToStringAnsi(t); + + var updateText = filter(this, text); + + if (updateText != text) + { + Interop.Libc.Free(t); + t = Marshal.StringToHGlobalAnsi(updateText); + } + }; + Interop.Elementary.elm_entry_markup_filter_prepend(RealHandle, textFilterCallback, IntPtr.Zero); + _textFilters.Add(filter, textFilterCallback); + } + } + + /// <summary> + /// Remove a markup filter + /// </summary> + /// <param name="filter">This function type is used by entry filters to modify text.</param> + public void RemoveMarkUpFilter(Func<Entry, string, string> filter) + { + if (_textFilters.ContainsKey(filter)) + { + Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback; + _textFilters.TryGetValue(filter, out textFilterCallback); + + Interop.Elementary.elm_entry_markup_filter_remove(RealHandle, textFilterCallback, IntPtr.Zero); + _textFilters.Remove(filter); + } + } + + /// <summary> + /// This executes a "copy" action on the selected text in the entry. + /// </summary> + public void CopySelection() + { + Interop.Elementary.elm_entry_selection_copy(RealHandle); + } + + /// <summary> + /// This executes a "cut" action on the selected text in the entry. + /// </summary> + public void CutSelection() + { + Interop.Elementary.elm_entry_selection_cut(RealHandle); + } + + /// <summary> + /// This executes a "paste" action in the entry. + /// </summary> + public void PasteSelection() + { + Interop.Elementary.elm_entry_selection_paste(RealHandle); + } + + /// <summary> + /// This disabled the entry's selection. + /// </summary> + /// <param name="disable">If true, the selection are disabled.</param> + public void DisableSelection(bool disable) + { + Interop.Elementary.elm_entry_selection_handler_disabled_set(RealHandle, disable); + } + + /// <summary> + /// Get any selected text within the entry. + /// </summary> + /// <returns>Selection's value</returns> + public string GetSelection() + { + return Interop.Elementary.elm_entry_selection_get(RealHandle); + } + + /// <summary> + /// This selects a region of text within the entry. + /// </summary> + /// <param name="start">The starting position.</param> + /// <param name="end">The end position.</param> + public void SetSelectionRegion(int start, int end) + { + Interop.Elementary.elm_entry_select_region_set(RealHandle, start, end); + } + + /// <summary> + /// Sets the visibility of the left-side widget of the entry + /// </summary> + /// <param name="isDisplay">true if the object should be displayed, false if not.</param> + public void SetIconVisible(bool isDisplay) + { + Interop.Elementary.elm_entry_icon_visible_set(RealHandle, isDisplay); + } + + /// <summary> + /// Set whether the return key on the input panel is disabled automatically when entry has no text. + /// </summary> + /// <param name="enable">If enabled is true, the return key is automatically disabled when the entry has no text.</param> + public void SetInputPanelReturnKeyAutoEnable(bool enable) + { + Interop.Elementary.elm_entry_input_panel_return_key_autoenabled_set(RealHandle, enable); + } + protected override IntPtr CreateHandle(EvasObject parent) { IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); - RealHandle = Interop.Elementary.elm_entry_add(handle); Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); return handle; } } -} +}
\ No newline at end of file diff --git a/ElmSharp/Interop/Interop.Elementary.Entry.cs b/ElmSharp/Interop/Interop.Elementary.Entry.cs index b45a75f..4d0d428 100644 --- a/ElmSharp/Interop/Interop.Elementary.Entry.cs +++ b/ElmSharp/Interop/Interop.Elementary.Entry.cs @@ -55,6 +55,48 @@ internal static partial class Interop Emoticon } + internal enum WrapType + { + None, + Char, + Word, + Mixed, + } + + internal enum AutocapitalType + { + None, + Word, + Sentence, + AllCharacter, + } + + internal enum InputHints + { + None, + AutoComplete, + SensitiveData, + } + + internal enum InputPanelLanguage + { + Automatic, + Alphabet, + } + + internal enum CopyAndPasteMode + { + Markup, + NoImage, + PlainText + } + + internal enum TextFormat + { + PlainUtf8, + MarkupUtf8 + } + [DllImport(Libraries.Elementary)] internal static extern IntPtr elm_entry_add(IntPtr obj); @@ -83,6 +125,21 @@ internal static partial class Interop internal static extern void elm_entry_entry_set(IntPtr obj, string value); [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_entry_append(IntPtr obj, string value); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_entry_insert(IntPtr obj, string value); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_file_get(IntPtr obj, out string file, out TextFormat format); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_file_set(IntPtr obj, string file, TextFormat format); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_file_save(IntPtr obj); + + [DllImport(Libraries.Elementary)] internal static extern bool elm_entry_password_get(IntPtr obj); [DllImport(Libraries.Elementary)] @@ -110,6 +167,9 @@ internal static partial class Interop internal static extern void elm_entry_cursor_end_set(IntPtr obj); [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_cursor_content_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] internal static extern void elm_entry_cursor_line_begin_set(IntPtr obj); [DllImport(Libraries.Elementary)] @@ -122,6 +182,21 @@ internal static partial class Interop internal static extern void elm_entry_cursor_pos_set(IntPtr obj, int pos); [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_geometry_get(IntPtr obj, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_is_format_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_is_visible_format_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_selection_begin(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_selection_end(IntPtr obj); + + [DllImport(Libraries.Elementary)] internal static extern string elm_entry_markup_to_utf8(IntPtr text); [DllImport(Libraries.Elementary)] @@ -134,6 +209,9 @@ internal static partial class Interop internal static extern void elm_entry_input_panel_enabled_set(IntPtr obj, bool enabled); [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_input_panel_enabled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] internal static extern void elm_entry_input_panel_return_key_type_set(IntPtr obj, ReturnKeyType keyType); [DllImport(Libraries.Elementary)] @@ -176,33 +254,81 @@ internal static partial class Interop internal static extern void elm_entry_input_panel_imdata_set(IntPtr obj, IntPtr data, int len); [DllImport(Libraries.Elementary)] + internal static extern int elm_entry_input_panel_layout_variation_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] internal static extern void elm_entry_input_panel_layout_variation_set(IntPtr obj, int variation); [DllImport(Libraries.Elementary)] - internal static extern void elm_entry_line_wrap_set(IntPtr obj, Elm_Wrap_Type wrap); + internal static extern WrapType elm_entry_line_wrap_get(IntPtr obj); [DllImport(Libraries.Elementary)] - internal static extern void elm_entry_markup_filter_remove(IntPtr obj, Elm_Entry_Filter_Cb func, IntPtr data); + internal static extern void elm_entry_line_wrap_set(IntPtr obj, WrapType wrap); + + [DllImport(Libraries.Elementary)] + internal static extern AutocapitalType elm_entry_autocapital_type_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_autocapital_type_set(IntPtr obj, AutocapitalType autoCapitalType); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_autosave_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_autosave_set(IntPtr obj, bool autosave); + + [DllImport(Libraries.Elementary)] + internal static extern CopyAndPasteMode elm_entry_cnp_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cnp_mode_set(IntPtr obj, CopyAndPasteMode mode); [DllImport(Libraries.Elementary)] - internal static extern void elm_entry_autocapital_type_set(IntPtr obj, Elm_Autocapital_Type autocapitalYype); + internal static extern void elm_entry_calc_force(IntPtr obj); [DllImport(Libraries.Elementary)] internal static extern IntPtr elm_entry_imf_context_get(IntPtr obj); [DllImport(Libraries.Elementary)] - internal static extern void elm_entry_input_hint_set(IntPtr obj, Elm_Input_Hints hints); + internal static extern InputHints elm_entry_input_hint_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_hint_set(IntPtr obj, InputHints hints); + + [DllImport(Libraries.Elementary)] + internal static extern InputPanelLanguage elm_entry_input_panel_language_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_language_set(IntPtr obj, InputPanelLanguage lang); [DllImport(Libraries.Elementary)] - internal static extern void elm_entry_input_panel_language_set(IntPtr obj, Elm_Input_Panel_Lang lang); + internal static extern bool elm_entry_input_panel_return_key_disabled_get(IntPtr obj); [DllImport(Libraries.Elementary)] internal static extern void elm_entry_input_panel_return_key_disabled_set(IntPtr obj, bool disabled); [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_return_key_autoenabled_set(IntPtr obj, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_input_panel_show_on_demand_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_show_on_demand_set(IntPtr obj, bool onDemand); + + [DllImport(Libraries.Elementary)] internal static extern void elm_entry_markup_filter_append(IntPtr obj, Elm_Entry_Filter_Cb func, IntPtr data); [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_markup_filter_prepend(IntPtr obj, Elm_Entry_Filter_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_markup_filter_remove(IntPtr obj, Elm_Entry_Filter_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_prediction_allow_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] internal static extern void elm_entry_prediction_allow_set(IntPtr obj, bool prediction); [DllImport(Libraries.Elementary)] @@ -212,35 +338,54 @@ internal static partial class Interop internal static extern string elm_entry_utf8_to_markup(string str); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void Elm_Entry_Filter_Cb(IntPtr data, IntPtr obj, string[] text); + internal delegate void Elm_Entry_Filter_Cb(IntPtr data, IntPtr obj, ref IntPtr text); - internal enum Elm_Wrap_Type - { - ELM_WRAP_NONE, - ELM_WRAP_CHAR, - ELM_WRAP_WORD, - ELM_WRAP_MIXED, - } + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_entry_anchor_hover_parent_get(IntPtr obj); - internal enum Elm_Autocapital_Type - { - ELM_AUTOCAPITAL_TYPE_NONE, - ELM_AUTOCAPITAL_TYPE_WORD, - ELM_AUTOCAPITAL_TYPE_SENTENCE, - ELM_AUTOCAPITAL_TYPE_ALLCHARACTER, - } + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_anchor_hover_parent_set(IntPtr obj, IntPtr parent); - internal enum Elm_Input_Hints - { - ELM_INPUT_HINT_NONE, - ELM_INPUT_HINT_AUTO_COMPLETE, - ELM_INPUT_HINT_SENSITIVE_DATA, - } + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_anchor_hover_end(IntPtr obj); - internal enum Elm_Input_Panel_Lang - { - ELM_INPUT_PANEL_LANG_AUTOMATIC, - ELM_INPUT_PANEL_LANG_ALPHABET, - } + [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_anchor_hover_style_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_anchor_hover_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_icon_visible_set(IntPtr obj, bool setting); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate IntPtr Elm_Entry_Item_Provider_Cb(IntPtr data, IntPtr entry, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_item_provider_append(IntPtr obj, Elm_Entry_Item_Provider_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_item_provider_prepend(IntPtr obj, Elm_Entry_Item_Provider_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_item_provider_remove(IntPtr obj, Elm_Entry_Item_Provider_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_copy(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_cut(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_paste(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_handler_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_selection_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_select_region_set(IntPtr obj, int start, int end); } }
\ No newline at end of file |