Release 4.0.0-preview1-00235
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / InputMethod.cs
1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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.
14 //
15
16 namespace Tizen.NUI
17 {
18
19     /// <summary>
20     /// A class encapsulating the input method map.
21     /// </summary>
22     public class InputMethod
23     {
24         private PanelLayoutType? _panelLayout = null;
25         private ActionButtonTitleType? _actionButton = null;
26         private AutoCapitalType? _autoCapital = null;
27         private int? _variation = null;
28
29         /// <summary>
30         /// The default constructor.
31         /// </summary>
32         public InputMethod()
33         {
34         }
35
36         /// <summary>
37         /// Gets or sets the panel layout.
38         /// </summary>
39         public PanelLayoutType PanelLayout
40         {
41             get
42             {
43                 return _panelLayout ?? PanelLayoutType.Normal;
44             }
45             set
46             {
47                 _panelLayout = value;
48             }
49         }
50
51         /// <summary>
52         /// Gets or sets the action button.
53         /// </summary>
54         public ActionButtonTitleType ActionButton
55         {
56             get
57             {
58                 return _actionButton ?? ActionButtonTitleType.Default;
59             }
60             set
61             {
62                 _actionButton = value;
63             }
64         }
65
66         /// <summary>
67         /// Gets or sets the auto capital.
68         /// </summary>
69         public AutoCapitalType AutoCapital
70         {
71             get
72             {
73                 return _autoCapital ?? AutoCapitalType.None;
74             }
75             set
76             {
77                 _autoCapital = value;
78             }
79         }
80
81         /// <summary>
82         /// Gets or sets the variation.
83         /// </summary>
84         public int Variation
85         {
86             get
87             {
88                 return _variation ?? 0;
89             }
90             set
91             {
92                 _variation = value;
93             }
94         }
95
96         /// <summary>
97         /// Gets or sets the variation for normal layout.
98         /// </summary>
99         public NormalLayoutType NormalVariation
100         {
101             get
102             {
103                 return (NormalLayoutType) (_variation ?? 0);
104             }
105             set
106             {
107                 _variation = (int)value;
108             }
109         }
110
111         /// <summary>
112         /// Gets or sets the variation for the number only layout.
113         /// </summary>
114         public NumberOnlyLayoutType NumberOnlyVariation
115         {
116             get
117             {
118                 return (NumberOnlyLayoutType) (_variation ?? 0);
119             }
120             set
121             {
122                 _variation = (int)value;
123             }
124         }
125
126         /// <summary>
127         /// Gets or sets the variation for the password layout.
128         /// </summary>
129         public PasswordLayoutType PasswordVariation
130         {
131             get
132             {
133                 return (PasswordLayoutType) (_variation ?? 0);
134             }
135             set
136             {
137                 _variation = (int)value;
138             }
139         }
140
141         private PropertyMap ComposingInputMethodMap()
142         {
143             PropertyMap _outputMap = new PropertyMap();
144             if (_panelLayout != null) { _outputMap.Add("PANEL_LAYOUT", new PropertyValue((int)_panelLayout)); }
145             if (_actionButton != null) { _outputMap.Add("ACTION_BUTTON", new PropertyValue((int)_actionButton)); }
146             if (_autoCapital != null) { _outputMap.Add("AUTO_CAPITALISE", new PropertyValue((int)_autoCapital)); }
147             if (_variation != null) { _outputMap.Add("VARIATION", new PropertyValue((int)_variation)); }
148             return _outputMap;
149         }
150
151         /// <summary>
152         /// Gets the input method map.
153         /// </summary>
154         public PropertyMap OutputMap
155         {
156             get
157             {
158                 return ComposingInputMethodMap();
159             }
160         }
161
162         /// <summary>
163         /// SetType that can be changed in the system input method.
164         /// </summary>
165         public enum CategoryType
166         {
167             /// <summary>
168             /// Set the keyboard layout.
169             /// </summary>
170             PanelLayout,
171             /// <summary>
172             /// Set the action button title.
173             /// </summary>
174             ActionButtonTitle,
175             /// <summary>
176             /// Set the auto capitalise of input.
177             /// </summary>
178             AutoCapitalise,
179             /// <summary>
180             /// Set the variation.
181             /// </summary>
182             Variation
183         }
184
185         /// <summary>
186         /// Autocapitalization Types.
187         /// </summary>
188         public enum AutoCapitalType
189         {
190             /// <summary>
191             /// No auto-capitalization when typing.
192             /// </summary>
193             None,
194             /// <summary>
195             /// Autocapitalize each word typed.
196             /// </summary>
197             Word,
198             /// <summary>
199             /// Autocapitalize the start of each sentence.
200             /// </summary>
201             Sentence,
202             /// <summary>
203             /// Autocapitalize all letters.
204             /// </summary>
205             Allcharacter
206         }
207
208         /// <summary>
209         /// Input panel (virtual keyboard) layout types..
210         /// </summary>
211         public enum PanelLayoutType
212         {
213             /// <summary>
214             /// Default layout.
215             /// </summary>
216             Normal,
217             /// <summary>
218             /// Number layout.
219             /// </summary>
220             Number,
221             /// <summary>
222             /// Email layout.
223             /// </summary>
224             Email,
225             /// <summary>
226             /// URL layout.
227             /// </summary>
228             URL,
229             /// <summary>
230             /// Phone number layout.
231             /// </summary>
232             PhoneNumber,
233             /// <summary>
234             /// IP layout.
235             /// </summary>
236             IP,
237             /// <summary>
238             /// Month layout.
239             /// </summary>
240             Month,
241             /// <summary>
242             /// Number layout.
243             /// </summary>
244             NumberOnly,
245             /// <summary>
246             /// Hexadecimal layout.
247             /// </summary>
248             HEX,
249             /// <summary>
250             /// Command-line terminal layout including Esc, Alt, Ctrl key, and so on (no auto-correct, no auto-capitalization).
251             /// </summary>
252             Terminal,
253             /// <summary>
254             /// Like normal, but no auto-correct, no auto-capitalization etc.
255             /// </summary>
256             Password,
257             /// <summary>
258             /// Date and time layout.
259             /// </summary>
260             Datetime,
261             /// <summary>
262             /// Emoticon layout.
263             /// </summary>
264             Emoticon
265         }
266
267         /// <summary>
268         /// Specifies what the Input Method "action" button functionality is set to.
269         /// </summary>
270         public enum ActionButtonTitleType
271         {
272             /// <summary>
273             /// Default action.
274             /// </summary>
275             Default,
276             /// <summary>
277             /// Done.
278             /// </summary>
279             Done,
280             /// <summary>
281             /// Go action.
282             /// </summary>
283             Go,
284             /// <summary>
285             /// Join action.
286             /// </summary>
287             Join,
288             /// <summary>
289             /// Login action.
290             /// </summary>
291             Login,
292             /// <summary>
293             /// Next action.
294             /// </summary>
295             Next,
296             /// <summary>
297             /// Previous action.
298             /// </summary>
299             Previous,
300             /// <summary>
301             /// Search action.
302             /// </summary>
303             Search,
304             /// <summary>
305             /// Send action.
306             /// </summary>
307             Send,
308             /// <summary>
309             /// Sign in action.
310             /// </summary>
311             SignIn,
312             /// <summary>
313             /// Unspecified action.
314             /// </summary>
315             Unspecified,
316             /// <summary>
317             /// Nothing to do.
318             /// </summary>
319             None
320         }
321
322         /// <summary>
323         /// Available variation for the normal layout.
324         /// </summary>
325         public enum NormalLayoutType
326         {
327             /// <summary>
328             /// The plain normal layout.
329             /// </summary>
330             Normal,
331             /// <summary>
332             /// Filename layout. sysbols such as '/' should be disabled.
333             /// </summary>
334             WithFilename,
335             /// <summary>
336             /// The name of a person.
337             /// </summary>
338             WithPersonName
339         }
340
341         /// <summary>
342         /// Available variation for the number only layout.
343         /// </summary>
344         public enum NumberOnlyLayoutType
345         {
346             /// <summary>
347             /// The plain normal number layout.
348             /// </summary>
349             Normal,
350             /// <summary>
351             /// The number layout to allow a positive or negative sign at the start.
352             /// </summary>
353             WithSigned,
354             /// <summary>
355             /// The number layout to allow decimal point to provide fractional value.
356             /// </summary>
357             WithDecimal,
358             /// <summary>
359             /// The number layout to allow decimal point and negative sign.
360             /// </summary>
361             WithSignedAndDecimal
362         }
363
364         /// <summary>
365         /// Available variation for the password layout.
366         /// </summary>
367         public enum PasswordLayoutType
368         {
369             /// <summary>
370             /// The normal password layout.
371             /// </summary>
372             Normal,
373             /// <summary>
374             /// The password layout to allow only number.
375             /// </summary>
376             WithNumberOnly
377         }
378
379     }
380 }