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