Revert "[Tizen] Remove multiple ..."
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Key.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 namespace Tizen.NUI
12 {
13
14     /// <summary>
15     /// The key structure is used to store a key press.
16     /// </summary>
17     public class Key : global::System.IDisposable
18     {
19         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20         protected bool swigCMemOwn;
21
22         internal Key(global::System.IntPtr cPtr, bool cMemoryOwn)
23         {
24             swigCMemOwn = cMemoryOwn;
25             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
26         }
27
28         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Key obj)
29         {
30             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
31         }
32
33         //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) 
34
35         //A Flag to check who called Dispose(). (By User or DisposeQueue)
36         private bool isDisposeQueued = false;
37         //A Flat to check if it is already disposed.
38         protected bool disposed = false;
39
40         ~Key()
41         {
42             if(!isDisposeQueued)
43             {
44                 isDisposeQueued = true;
45                 DisposeQueue.Instance.Add(this);
46             }
47         }
48
49         public void Dispose()
50         {
51             //Throw excpetion if Dispose() is called in separate thread.
52             if (!Window.IsInstalled())
53             {
54                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
55             }
56
57             if (isDisposeQueued)
58             {
59                 Dispose(DisposeTypes.Implicit);
60             }
61             else
62             {
63                 Dispose(DisposeTypes.Explicit);
64                 System.GC.SuppressFinalize(this);
65             }
66         }
67
68         protected virtual void Dispose(DisposeTypes type)
69         {
70             if (disposed)
71             {
72                 return;
73             }
74
75             if(type == DisposeTypes.Explicit)
76             {
77                 //Called by User
78                 //Release your own managed resources here.
79                 //You should release all of your own disposable objects here.
80             }
81
82             //Release your own unmanaged resources here.
83             //You should not access any managed member here except static instance.
84             //because the execution order of Finalizes is non-deterministic.
85
86             if (swigCPtr.Handle != global::System.IntPtr.Zero)
87             {
88                 if (swigCMemOwn)
89                 {
90                     swigCMemOwn = false;
91                     NDalicPINVOKE.delete_Key(swigCPtr);
92                 }
93                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
94             }
95             disposed = true;
96         }
97
98
99         internal static Key GetKeyFromPtr(global::System.IntPtr cPtr)
100         {
101             Key ret = new Key(cPtr, false);
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103             return ret;
104         }
105
106         public string DeviceName
107         {
108             get
109             {
110                 string ret = NDalicPINVOKE.GetDeviceName(swigCPtr);
111                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112                 return ret;
113             }
114         }
115
116         /// <summary>
117         /// Name given to the key pressed
118         /// </summary>
119         public string KeyPressedName
120         {
121             get
122             {
123                 return keyPressedName;
124             }
125         }
126
127         /* duplicated with KeyPressedName : removed
128         public string KeyPressed
129         {
130             get
131             {
132                 return keyPressed;
133             }
134         }
135         */
136
137         /// <summary>
138         /// Keycode for the key pressed.
139         /// </summary>
140         public int KeyCode
141         {
142             get
143             {
144                 return keyCode;
145             }
146         }
147
148         /// <summary>
149         /// Special keys like shift, alt and control which modify the next key pressed.
150         /// </summary>
151         public int KeyModifier
152         {
153             get
154             {
155                 return keyModifier;
156             }
157         }
158
159         /// <summary>
160         /// The time (in ms) that the key event occurred.
161         /// </summary>
162         public uint Time
163         {
164             get
165             {
166                 return time;
167             }
168         }
169
170         /// <summary>
171         /// State of the key event.
172         /// </summary>
173         public Key.StateType State
174         {
175             get
176             {
177                 return state;
178             }
179         }
180
181         public DeviceClassType DeviceClass
182         {
183             get
184             {
185                 int ret = NDalicPINVOKE.GetDeviceClass(swigCPtr);
186                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187                 return (DeviceClassType)ret;
188             }
189         }
190
191
192         /// <summary>
193         /// Default Constructor.
194         /// </summary>
195         public Key() : this(NDalicPINVOKE.new_Key__SWIG_0(), true)
196         {
197             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198         }
199
200         /// <summary>
201         /// Constructor.
202         /// </summary>
203         /// <param name="keyName">The name of the key pressed or command from the IMF, if later then the some following parameters will be needed</param>
204         /// <param name="keyString">A string of input characters or key pressed</param>
205         /// <param name="keyCode">The unique key code for the key pressed</param>
206         /// <param name="keyModifier">The key modifier for special keys like shift and alt</param>
207         /// <param name="timeStamp">The time (in ms) that the key event occurred</param>
208         /// <param name="keyState">The state of the key event</param>
209         internal Key(string keyName, string keyString, int keyCode, int keyModifier, uint timeStamp, Key.StateType keyState) : this(NDalicPINVOKE.new_Key__SWIG_1(keyName, keyString, keyCode, keyModifier, timeStamp, (int)keyState), true)
210         {
211             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212         }
213
214         /// <summary>
215         /// Checks to see if Shift key modifier has been supplied.
216         /// </summary>
217         /// <returns>True if shift modifier</returns>
218         public bool IsShiftModifier()
219         {
220             bool ret = NDalicPINVOKE.Key_IsShiftModifier(swigCPtr);
221             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222             return ret;
223         }
224
225         /// <summary>
226         /// Checks to see if Ctrl (control) key modifier has been supplied.
227         /// </summary>
228         /// <returns>True if ctrl modifier</returns>
229         public bool IsCtrlModifier()
230         {
231             bool ret = NDalicPINVOKE.Key_IsCtrlModifier(swigCPtr);
232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233             return ret;
234         }
235
236         /// <summary>
237         /// Checks to see if Alt key modifier has been supplied.
238         /// </summary>
239         /// <returns>True if alt modifier</returns>
240         public bool IsAltModifier()
241         {
242             bool ret = NDalicPINVOKE.Key_IsAltModifier(swigCPtr);
243             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244             return ret;
245         }
246
247         private string keyPressedName
248         {
249             set
250             {
251                 NDalicPINVOKE.Key_keyPressedName_set(swigCPtr, value);
252                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253             }
254             get
255             {
256                 string ret = NDalicPINVOKE.Key_keyPressedName_get(swigCPtr);
257                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258                 return ret;
259             }
260         }
261
262         private string keyPressed
263         {
264             set
265             {
266                 NDalicPINVOKE.Key_keyPressed_set(swigCPtr, value);
267                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268             }
269             get
270             {
271                 string ret = NDalicPINVOKE.Key_keyPressed_get(swigCPtr);
272                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273                 return ret;
274             }
275         }
276
277         private int keyCode
278         {
279             set
280             {
281                 NDalicPINVOKE.Key_keyCode_set(swigCPtr, value);
282                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283             }
284             get
285             {
286                 int ret = NDalicPINVOKE.Key_keyCode_get(swigCPtr);
287                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288                 return ret;
289             }
290         }
291
292         private int keyModifier
293         {
294             set
295             {
296                 NDalicPINVOKE.Key_keyModifier_set(swigCPtr, value);
297                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298             }
299             get
300             {
301                 int ret = NDalicPINVOKE.Key_keyModifier_get(swigCPtr);
302                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303                 return ret;
304             }
305         }
306
307         private uint time
308         {
309             set
310             {
311                 NDalicPINVOKE.Key_time_set(swigCPtr, value);
312                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313             }
314             get
315             {
316                 uint ret = NDalicPINVOKE.Key_time_get(swigCPtr);
317                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318                 return ret;
319             }
320         }
321
322         private Key.StateType state
323         {
324             set
325             {
326                 NDalicPINVOKE.Key_state_set(swigCPtr, (int)value);
327                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328             }
329             get
330             {
331                 Key.StateType ret = (Key.StateType)NDalicPINVOKE.Key_state_get(swigCPtr);
332                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333                 return ret;
334             }
335         }
336
337         /// <summary>
338         /// Enumeration for specifying the state of the key event.
339         /// </summary>
340         public enum StateType
341         {
342             Down,
343             Up,
344             Last
345         }
346
347     }
348 }