1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
21 /// A class encapsulating the input method map.
23 /// <since_tizen> 3 </since_tizen>
24 public class InputMethod
26 private PanelLayoutType? _panelLayout = null;
27 private ActionButtonTitleType? _actionButton = null;
28 private AutoCapitalType? _autoCapital = null;
29 private int? _variation = null;
32 /// The default constructor.
34 /// <since_tizen> 3 </since_tizen>
40 /// SetType that can be changed in the system input method.
42 /// <since_tizen> 3 </since_tizen>
43 public enum CategoryType
46 /// Set the keyboard layout.
50 /// Set the action button title.
54 /// Set the auto capitalise of input.
58 /// Set the variation.
64 /// Autocapitalization Types.
66 /// <since_tizen> 3 </since_tizen>
67 public enum AutoCapitalType
70 /// No auto-capitalization when typing.
74 /// Autocapitalize each word typed.
78 /// Autocapitalize the start of each sentence.
82 /// Autocapitalize all letters.
88 /// Input panel (virtual keyboard) layout types..
90 /// <since_tizen> 3 </since_tizen>
91 public enum PanelLayoutType
110 /// Phone number layout.
126 /// Hexadecimal layout.
130 /// Command-line terminal layout including Esc, Alt, Ctrl key, and so on (no auto-correct, no auto-capitalization).
134 /// Like normal, but no auto-correct, no auto-capitalization etc.
138 /// Date and time layout.
148 /// Specifies what the Input Method "action" button functionality is set to.
150 /// <since_tizen> 3 </since_tizen>
151 public enum ActionButtonTitleType
180 [Obsolete("Deprecated in API8, will be removed in API10.")]
195 /// Unspecified action.
197 [Obsolete("Deprecated in API8, will be removed in API10.")]
202 [Obsolete("Deprecated in API8, will be removed in API10.")]
207 /// Available variation for the normal layout.
209 /// <since_tizen> 3 </since_tizen>
210 public enum NormalLayoutType
213 /// The plain normal layout.
217 /// Filename layout. sysbols such as '/' should be disabled.
221 /// The name of a person.
227 /// Available variation for the number only layout.
229 /// <since_tizen> 3 </since_tizen>
230 public enum NumberOnlyLayoutType
233 /// The plain normal number layout.
237 /// The number layout to allow a positive or negative sign at the start.
241 /// The number layout to allow decimal point to provide fractional value.
245 /// The number layout to allow decimal point and negative sign.
251 /// Available variation for the password layout.
253 /// <since_tizen> 3 </since_tizen>
254 public enum PasswordLayoutType
257 /// The normal password layout.
261 /// The password layout to allow only number.
267 /// Gets or sets the panel layout.
269 /// <since_tizen> 3 </since_tizen>
270 public PanelLayoutType PanelLayout
274 return _panelLayout ?? PanelLayoutType.Normal;
278 _panelLayout = value;
283 /// Gets or sets the action button.
285 /// <since_tizen> 3 </since_tizen>
286 public ActionButtonTitleType ActionButton
290 return _actionButton ?? ActionButtonTitleType.Default;
294 _actionButton = value;
299 /// Gets or sets the auto capital.
301 /// <since_tizen> 3 </since_tizen>
302 public AutoCapitalType AutoCapital
306 return _autoCapital ?? AutoCapitalType.None;
310 _autoCapital = value;
315 /// Gets or sets the variation.
317 /// <since_tizen> 3 </since_tizen>
322 return _variation ?? 0;
331 /// Gets or sets the variation for normal layout.
333 /// <since_tizen> 3 </since_tizen>
334 public NormalLayoutType NormalVariation
338 return (NormalLayoutType)(_variation ?? 0);
342 _variation = (int)value;
347 /// Gets or sets the variation for the number only layout.
349 /// <since_tizen> 3 </since_tizen>
350 public NumberOnlyLayoutType NumberOnlyVariation
354 return (NumberOnlyLayoutType)(_variation ?? 0);
358 _variation = (int)value;
363 /// Gets or sets the variation for the password layout.
365 /// <since_tizen> 3 </since_tizen>
366 public PasswordLayoutType PasswordVariation
370 return (PasswordLayoutType)(_variation ?? 0);
374 _variation = (int)value;
379 /// Gets the input method map.
381 /// <since_tizen> 3 </since_tizen>
382 public PropertyMap OutputMap
386 return ComposingInputMethodMap();
390 private PropertyMap ComposingInputMethodMap()
392 PropertyMap _outputMap = new PropertyMap();
393 if (_panelLayout != null) { _outputMap.Add("PANEL_LAYOUT", new PropertyValue((int)_panelLayout)); }
394 if (_actionButton != null)
396 // Temporarily specify the values to match the types of ecore_imf.
397 if (_actionButton == InputMethod.ActionButtonTitleType.Search) _actionButton = (InputMethod.ActionButtonTitleType.Search - 1); // 6
398 else if (_actionButton == InputMethod.ActionButtonTitleType.Send) _actionButton = (InputMethod.ActionButtonTitleType.Send - 1); // 7
399 else if (_actionButton == InputMethod.ActionButtonTitleType.SignIn) _actionButton = (InputMethod.ActionButtonTitleType.SignIn - 1); // 8
400 else if (_actionButton == InputMethod.ActionButtonTitleType.Unspecified || _actionButton == InputMethod.ActionButtonTitleType.None) _actionButton = InputMethod.ActionButtonTitleType.Default;
401 _outputMap.Add("BUTTON_ACTION", new PropertyValue((int)_actionButton));
403 if (_autoCapital != null) { _outputMap.Add("AUTO_CAPITALIZE", new PropertyValue((int)_autoCapital)); }
404 if (_variation != null) { _outputMap.Add("VARIATION", new PropertyValue((int)_variation)); }