[Inputmethod] Add new APIs to update input panel event (#582)
authorInhong <tukkong123@naver.com>
Fri, 7 Dec 2018 00:39:25 +0000 (09:39 +0900)
committerGitHub <noreply@github.com>
Fri, 7 Dec 2018 00:39:25 +0000 (09:39 +0900)
src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs
src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs
src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs

index 46048b2..9b373f3 100755 (executable)
@@ -44,6 +44,19 @@ internal static partial class Interop
             OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory
         };
 
+        internal enum ImeEventType
+        {
+            Language = 1,    /* The language of the input panel */
+            ShiftMode = 2,   /* The shift key state of the input panel */
+            Geometry = 3     /* The size of the input panel */
+        };
+
+        internal enum ImeShiftMode
+        {
+            Off,
+            On
+        };
+
         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
         internal struct ImeCallbackStruct
         {
@@ -257,6 +270,8 @@ internal static partial class Interop
         [DllImport(Libraries.InputMethod, EntryPoint = "ime_set_floating_drag_end")]
         internal static extern ErrorCode ImeSetFloatingDragEnd();
 
+        [DllImport(Libraries.InputMethod, EntryPoint = "ime_update_input_panel_event")]
+        internal static extern ErrorCode ImeUpdateInputPanelEvent(ImeEventType type, uint value);
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void ImeCreateCb(IntPtr userData);
index 279354b..b75fc9e 100755 (executable)
@@ -38,6 +38,8 @@ namespace Tizen.Uix.InputMethod
         /// <summary>
         /// This API creates a handle for the editor window.
         /// </summary>
+        /// <param name="parent">Parent EvasObject.</param>
+        /// <returns>Handle IntPtr.</returns>
         /// <since_tizen> 4 </since_tizen>
         protected override IntPtr CreateHandle(EvasObject parent)
         {
@@ -47,6 +49,7 @@ namespace Tizen.Uix.InputMethod
         /// <summary>
         /// This API gets a handle for the editor window.
         /// </summary>
+        /// <returns>Handle IntPtr.</returns>
         /// <since_tizen> 4 </since_tizen>
         public IntPtr GetHandle()
         {
index 3039dae..4e967ac 100755 (executable)
@@ -1042,6 +1042,8 @@ namespace Tizen.Uix.InputMethod
             /// <summary>
             /// Compares whether the ContextIds are equal.
             /// </summary>
+            /// <param name="other">The ContextIds to test for equality.</param>
+            /// <returns>true if the ContextIds is the same; otherwise, false.</returns>
             /// <since_tizen> 4 </since_tizen>
             public bool Equals(ContextId other)
             {
@@ -2139,5 +2141,75 @@ namespace Tizen.Uix.InputMethod
                 throw InputMethodExceptionFactory.CreateException(error);
             }
         }
+
+        /// <summary>
+        /// Notifies the changed language of the input panel to the the associated text input UI control.
+        /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/ime
+        /// </privilege>
+        /// <remarks>
+        /// LanguageRequestedCallback is raised after this API is called when the App requests changed language information.
+        /// </remarks>
+        /// <exception cref="InvalidOperationException">
+        /// This can occur due to the following reasons:
+        /// 1) The application does not have the privilege to call this function.
+        /// 2) The IME main loop has not yet started.
+        /// </exception>
+        /// <since_tizen> 6 </since_tizen>
+        public static void SendLanguageUpdated()
+        {
+            ErrorCode error = ImeUpdateInputPanelEvent(ImeEventType.Language, 0);
+            if (error != ErrorCode.None)
+            {
+                Log.Error(LogTag, "SendLanguageUpdated Failed with error " + error);
+                throw InputMethodExceptionFactory.CreateException(error);
+            }
+        }
+
+        /// <summary>
+        /// Sends the changed shift mode of the input panel to the the associated text input UI control.
+        /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/ime
+        /// </privilege>
+        /// <param name="enable"><c>true</c> if shift button is clicked, otherwise <c>false</c>.</param>
+        /// <exception cref="InvalidOperationException">
+        /// This can occur due to the following reasons:
+        /// 1) The application does not have the privilege to call this function.
+        /// 2) The IME main loop has not yet started.
+        /// </exception>
+        /// <since_tizen> 6 </since_tizen>
+        public static void SendShiftModeUpdated(bool enable)
+        {
+            ErrorCode error = ImeUpdateInputPanelEvent(ImeEventType.ShiftMode, enable ? (uint)ImeShiftMode.On : (uint)ImeShiftMode.Off);
+            if (error != ErrorCode.None)
+            {
+                Log.Error(LogTag, "SendInputPanelEvent Failed with error " + error);
+                throw InputMethodExceptionFactory.CreateException(error);
+            }
+        }
+
+        /// <summary>
+        /// Notifies the changed geometry of input panel window to the associated text input UI control.
+        /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/ime
+        /// </privilege>
+        /// <exception cref="InvalidOperationException">
+        /// This can occur due to the following reasons:
+        /// 1) The application does not have the privilege to call this function.
+        /// 2) The IME main loop has not yet started.
+        /// </exception>
+        /// <since_tizen> 6 </since_tizen>
+        public static void SendCustomGeometryUpdated()
+        {
+            ErrorCode error = ImeUpdateInputPanelEvent(ImeEventType.Geometry, 0);
+            if (error != ErrorCode.None)
+            {
+                Log.Error(LogTag, "SendCustomGeometryUpdated Failed with error " + error);
+                throw InputMethodExceptionFactory.CreateException(error);
+            }
+        }
     }
 }