From 31a3218abb57152d1a8971f07cd760cdfd3ea3d2 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 1 Aug 2017 13:49:28 +0900 Subject: [PATCH] Move IMEApplication class to xamarin-forms Change-Id: I9e28dcd9450102e56bc6da7af23ec7ad60141be2 --- .../Tizen.Uix.InputMethod/EditorWindow.cs | 7 +- .../Tizen.Uix.InputMethod/IMEApplication.cs | 119 --------------------- 2 files changed, 6 insertions(+), 120 deletions(-) delete mode 100644 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/IMEApplication.cs diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs index c3326a6..82153a7 100755 --- a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs @@ -39,6 +39,11 @@ namespace Tizen.Uix.InputMethod return _handle; } + public IntPtr GetHandle() + { + return _handle; + } + /// /// This API updates the input panel window's size information. /// @@ -64,4 +69,4 @@ namespace Tizen.Uix.InputMethod } } } -} \ No newline at end of file +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/IMEApplication.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/IMEApplication.cs deleted file mode 100644 index 7ba45aa..0000000 --- a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/IMEApplication.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using Xamarin.Forms; -using Xamarin.Forms.Platform.Tizen; -using Tizen; -using ElmSharp; -using static Interop.InputMethod; - -namespace Tizen.Uix.InputMethod -{ - public class IMEWindow : Xamarin.Forms.Platform.Tizen.Native.Window - { - /* There can be only one single IME Window, so we are declaring the size variables as static */ - static Xamarin.Forms.Size _portrait_size = new Xamarin.Forms.Size(0.0 ,0.0); - static Xamarin.Forms.Size _landscape_size = new Xamarin.Forms.Size(0.0, 0.0); - - public static Xamarin.Forms.Size PortraitSize - { - get { return _portrait_size; } - internal set - { - _portrait_size = value; - ImeSetSize((int)PortraitSize.Width, (int)PortraitSize.Height, - (int)LandscapeSize.Width, (int)LandscapeSize.Height); - } - } - - public static Xamarin.Forms.Size LandscapeSize - { - get { return _landscape_size; } - internal set - { - _landscape_size = value; - ImeSetSize((int)PortraitSize.Width, (int)PortraitSize.Height, - (int)LandscapeSize.Width, (int)LandscapeSize.Height); - } - } - - public IMEWindow() : base() - { - if (_portrait_size.Width == 0 || _portrait_size.Height == 0) - { - Log.Warn(LogTag, "The width and/or height of portrait IME size contains value 0"); - } - if (_landscape_size.Width == 0 || _landscape_size.Height == 0) - { - Log.Warn(LogTag, "The width and/or height of landscape IME size contains value 0"); - } - - ImeSetSize((int)PortraitSize.Width, (int)PortraitSize.Height, - (int)LandscapeSize.Width, (int)LandscapeSize.Height); - } - - protected override IntPtr CreateHandle(EvasObject parent) - { - /* We are acquiring IME Window's pointer which is expected to be created - * when calling Create() function of the InputMethodEditor class */ - IntPtr handle = ImeGetMainWindow(); - Log.Info(LogTag, "ImeGetMainWindow returned : " + handle.ToString()); - - return handle; - } - } - - public class IMEApplication : Xamarin.Forms.Platform.Tizen.FormsApplication - { - protected IMEApplication() - { - } - - public Xamarin.Forms.Size PortraitSize - { - get { return IMEWindow.PortraitSize; } - set { IMEWindow.PortraitSize = value; } - } - - public Xamarin.Forms.Size LandscapeSize - { - get { return IMEWindow.LandscapeSize; } - set { IMEWindow.LandscapeSize = value; } - } - - protected override void OnPreCreate() - { - try - { - Application.ClearCurrent(); - - /* Since the IMEWindow class acquires window handle from InputMethod module - * which is created internally when calling InputMethodEditor.Create() function, - * this needs to be called BEFORE creating new IMEWindow instance. */ - InputMethod.InputMethodEditor.Create(); - - MainWindow = new IMEWindow(); - MainWindow.IndicatorMode = IndicatorMode.Hide; - MainWindow.Show(); - } - catch (Exception e) - { - Log.Error("EXCEPTION", "Exception caught : " + e.ToString()); - } - } - - protected override void OnTerminate() - { - InputMethod.InputMethodEditor.Destroy(); - base.OnTerminate(); - } - - protected override void OnPause() - { - base.OnPause(); - } - - protected override void OnResume() - { - base.OnResume(); - } - } -} -- 2.7.4