Add APIs for floating keyboard (#344)
authorInhong <tukkong123@naver.com>
Tue, 24 Jul 2018 10:40:42 +0000 (19:40 +0900)
committerGitHub <noreply@github.com>
Tue, 24 Jul 2018 10:40:42 +0000 (19:40 +0900)
src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs
src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs

index ca8468d..46048b2 100755 (executable)
@@ -248,6 +248,15 @@ internal static partial class Interop
         [DllImport(Libraries.InputMethod, EntryPoint = "ime_device_info_get_subclass")]
         internal static extern ErrorCode ImeDeviceInfoGetSubclass(IntPtr dev_info, out DeviceSubclass devSubClass);
 
+        [DllImport(Libraries.InputMethod, EntryPoint = "ime_set_floating_mode")]
+        internal static extern ErrorCode ImeSetFloatingMode(bool floating_mode);
+
+        [DllImport(Libraries.InputMethod, EntryPoint = "ime_set_floating_drag_start")]
+        internal static extern ErrorCode ImeSetFloatingDragStart();
+
+        [DllImport(Libraries.InputMethod, EntryPoint = "ime_set_floating_drag_end")]
+        internal static extern ErrorCode ImeSetFloatingDragEnd();
+
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void ImeCreateCb(IntPtr userData);
index 8d4a7f9..611d923 100755 (executable)
@@ -2066,5 +2066,78 @@ namespace Tizen.Uix.InputMethod
                 throw InputMethodExceptionFactory.CreateException(error);
             }
         }
+
+        /// <summary>
+        /// Sets the floating mode or not.
+        /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/ime
+        /// </privilege>
+        /// <param name="floating_mode">The floating mode On/Off.</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 isn't started yet.
+        /// </exception>
+        /// <since_tizen> 5 </since_tizen>
+        public static void SetFloatingMode(bool floating_mode)
+        {
+            ErrorCode error = ImeSetFloatingMode(floating_mode);
+            if (error != ErrorCode.None)
+            {
+                Log.Error(LogTag, "SetFloatingMode Failed with error " + error);
+                throw InputMethodExceptionFactory.CreateException(error);
+            }
+        }
+
+        /// <summary>
+        /// Allows the floating input panel window to move along with the mouse pointer when the mouse is pressed.
+        /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/ime
+        /// </privilege>
+        /// <remarks>
+        /// This function can be used in floating mode. If the floating mode is deactivated, calling this function has no effect.
+        /// </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 isn't started yet.
+        /// </exception>
+        /// <since_tizen> 5 </since_tizen>
+        public static void SetFloatingDragStart()
+        {
+            ErrorCode error = ImeSetFloatingDragStart();
+            if (error != ErrorCode.None)
+            {
+                Log.Error(LogTag, "SetFloatingDragStart Failed with error " + error);
+                throw InputMethodExceptionFactory.CreateException(error);
+            }
+        }
+
+        /// <summary>
+        /// Disallows the movement of the floating input panel window with the mouse pointer when the mouse is pressed.
+        /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/ime
+        /// </privilege>
+        /// <remarks>
+        /// This function can be used in floating mode. If the floating mode is deactivated, calling this function has no effect.
+        /// </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 isn't started yet.
+        /// </exception>
+        /// <since_tizen> 5 </since_tizen>
+        public static void SetFloatingDragEnd()
+        {
+            ErrorCode error = ImeSetFloatingDragEnd();
+            if (error != ErrorCode.None)
+            {
+                Log.Error(LogTag, "SetFloatingDragEnd Failed with error " + error);
+                throw InputMethodExceptionFactory.CreateException(error);
+            }
+        }
     }
 }