2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using static Interop.InputMethodManager;
20 namespace Tizen.Uix.InputMethodManager
23 /// This class provides the function for launching the input method editor (IME) list and selector settings. A user can manage the installed IMEs in the system.
24 /// The input method editor (IME) is an input panel that lets users provide an input and the platform to receive the text data entered.
25 /// The manager is a module for managing the installed IMEs.
26 /// IME developers can use this module to open the installed IME list or the selector menu after their IME installation, and then guide to select the installed IME.
28 public static class Manager
31 /// Requests to open the installed IME list menu.
32 /// This API provides the installed IME list menu for IME developers who might want to open it to enable their IME.
35 /// http://tizen.org/privilege/imemanager
37 /// <exception cref="T:System.InvalidOperationException">
38 /// This exception can occur if:
39 /// 1) The application does not have the privilege to call this function.
40 /// 2) Operation failed.
42 public static void ShowIMEList()
44 ErrorCode error = ImeManagerShowImeList();
45 if (error != ErrorCode.None)
47 Log.Error(LogTag, "ShowIMEList Failed with error " + error);
48 throw InputMethodManagerExceptionFactory.CreateException(error);
53 /// Requests to open the IME selector menu.
54 /// This API provides the IME selector menu for the IME or other application developers who might want to change the default IME.
57 /// http://tizen.org/privilege/imemanager
59 /// <exception cref="T:System.InvalidOperationException">
60 /// This exception can occur if:
61 /// 1) The application does not have the privilege to call this function.
62 /// 2) Operation failed.
64 public static void ShowIMESelector()
66 ErrorCode error = ImeManagerShowImeSelector();
67 if (error != ErrorCode.None)
69 Log.Error(LogTag, "ShowIMESelector Failed with error " + error);
70 throw InputMethodManagerExceptionFactory.CreateException(error);
75 /// Checks if the specific IME is enabled or disabled in the system keyboard setting.
76 /// The IME developers can use this property to check if their IME is enabled or not.
79 /// http://tizen.org/privilege/imemanager
81 /// <param name="appId">The application ID of the IME.</param>
82 /// <returns>The On (enabled) and Off (disabled) state of the IME.</returns>
83 /// <exception cref="T:System.ArgumentException">
84 /// This exception can occur if an invalid parameter is provided.
86 /// <exception cref="T:System.InvalidOperationException">
87 /// This exception can occur if:
88 /// 1) The application does not have the privilege to call this function.
89 /// 2) Operation failed.
91 public static bool IsIMEEnabled(string appId)
94 ErrorCode error = ImeManagerIsImeEnabled(appId, out isIMEEnabled);
95 if (error != ErrorCode.None)
97 Log.Error(LogTag, "IsIMEEnabled Failed with error " + error);
98 throw InputMethodManagerExceptionFactory.CreateException(error);
105 /// Checks which IME is the current activated (selected) IME.
108 /// http://tizen.org/privilege/imemanager
111 /// The current activated (selected) IME.
113 /// <exception cref="T:System.InvalidOperationException">
114 /// This exception can occur if:
115 /// 1) The application does not have the privilege to call this function.
116 /// 2) Operation failed.
118 public static string GetActiveIME()
121 ErrorCode error = ImeManagerGetActiveIme(out activeIME);
122 if (error != ErrorCode.None)
124 Log.Error(LogTag, "GetActiveIME Failed with error " + error);
125 throw InputMethodManagerExceptionFactory.CreateException(error);
132 /// Gets the number of IMEs that are enabled (usable).
135 /// http://tizen.org/privilege/imemanager
138 /// The number of enabled IMEs.
140 /// <exception cref="T:System.InvalidOperationException">
141 /// This exception can occur if:
142 /// 1) The application does not have the privilege to call this function.
143 /// 2) Operation failed.
145 public static int GetEnabledIMECount()
147 int activeIME = ImeManagerGetEnabledImeCount();
148 ErrorCode error = (ErrorCode)Tizen.Internals.Errors.ErrorFacts.GetLastResult();
149 if (error != ErrorCode.None)
151 Log.Error(LogTag, "GetEnabledIMECount Failed with error " + error);
152 throw InputMethodManagerExceptionFactory.CreateException(error);