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