3 using Xamarin.Forms.Platform.Tizen;
6 using static Interop.InputMethod;
8 namespace Tizen.Uix.InputMethod
10 public class IMEWindow : Xamarin.Forms.Platform.Tizen.Native.Window
12 /* There can be only one single IME Window, so we are declaring the size variables as static */
13 static Xamarin.Forms.Size _portrait_size = new Xamarin.Forms.Size(0.0 ,0.0);
14 static Xamarin.Forms.Size _landscape_size = new Xamarin.Forms.Size(0.0, 0.0);
16 public static Xamarin.Forms.Size PortraitSize
18 get { return _portrait_size; }
21 _portrait_size = value;
22 ImeSetSize((int)PortraitSize.Width, (int)PortraitSize.Height,
23 (int)LandscapeSize.Width, (int)LandscapeSize.Height);
27 public static Xamarin.Forms.Size LandscapeSize
29 get { return _landscape_size; }
32 _landscape_size = value;
33 ImeSetSize((int)PortraitSize.Width, (int)PortraitSize.Height,
34 (int)LandscapeSize.Width, (int)LandscapeSize.Height);
38 public IMEWindow() : base()
40 if (_portrait_size.Width == 0 || _portrait_size.Height == 0)
42 Log.Warn(LogTag, "The width and/or height of portrait IME size contains value 0");
44 if (_landscape_size.Width == 0 || _landscape_size.Height == 0)
46 Log.Warn(LogTag, "The width and/or height of landscape IME size contains value 0");
49 ImeSetSize((int)PortraitSize.Width, (int)PortraitSize.Height,
50 (int)LandscapeSize.Width, (int)LandscapeSize.Height);
53 protected override IntPtr CreateHandle(EvasObject parent)
55 /* We are acquiring IME Window's pointer which is expected to be created
56 * when calling Create() function of the InputMethodEditor class */
57 IntPtr handle = ImeGetMainWindow();
58 Log.Info(LogTag, "ImeGetMainWindow returned : " + handle.ToString());
64 public class IMEApplication : Xamarin.Forms.Platform.Tizen.FormsApplication
66 protected IMEApplication()
70 public Xamarin.Forms.Size PortraitSize
72 get { return IMEWindow.PortraitSize; }
73 set { IMEWindow.PortraitSize = value; }
76 public Xamarin.Forms.Size LandscapeSize
78 get { return IMEWindow.LandscapeSize; }
79 set { IMEWindow.LandscapeSize = value; }
82 protected override void OnPreCreate()
86 Application.ClearCurrent();
88 /* Since the IMEWindow class acquires window handle from InputMethod module
89 * which is created internally when calling InputMethodEditor.Create() function,
90 * this needs to be called BEFORE creating new IMEWindow instance. */
91 InputMethod.InputMethodEditor.Create();
93 MainWindow = new IMEWindow();
94 MainWindow.IndicatorMode = IndicatorMode.Hide;
99 Log.Error("EXCEPTION", "Exception caught : " + e.ToString());
103 protected override void OnTerminate()
105 InputMethod.InputMethodEditor.Destroy();
109 protected override void OnPause()
114 protected override void OnResume()