1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
15 /// The key structure is used to store a key press.
17 public class Key : global::System.IDisposable
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20 protected bool swigCMemOwn;
22 internal Key(global::System.IntPtr cPtr, bool cMemoryOwn)
24 swigCMemOwn = cMemoryOwn;
25 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Key obj)
30 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33 //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam)
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;
44 isDisposeQueued = true;
45 DisposeQueue.Instance.Add(this);
51 //Throw excpetion if Dispose() is called in separate thread.
52 if (!Window.IsInstalled())
54 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
59 Dispose(DisposeTypes.Implicit);
63 Dispose(DisposeTypes.Explicit);
64 System.GC.SuppressFinalize(this);
68 protected virtual void Dispose(DisposeTypes type)
75 if(type == DisposeTypes.Explicit)
78 //Release your own managed resources here.
79 //You should release all of your own disposable objects here.
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.
86 if (swigCPtr.Handle != global::System.IntPtr.Zero)
91 NDalicPINVOKE.delete_Key(swigCPtr);
93 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
99 internal static Key GetKeyFromPtr(global::System.IntPtr cPtr)
101 Key ret = new Key(cPtr, false);
102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106 public string DeviceName
110 string ret = NDalicPINVOKE.GetDeviceName(swigCPtr);
111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 /// Name given to the key pressed
119 public string KeyPressedName
123 return keyPressedName;
127 /* duplicated with KeyPressedName : removed
128 public string KeyPressed
138 /// Keycode for the key pressed.
149 /// Special keys like shift, alt and control which modify the next key pressed.
151 public int KeyModifier
160 /// The time (in ms) that the key event occurred.
171 /// State of the key event.
173 public Key.StateType State
181 public DeviceClassType DeviceClass
185 int ret = NDalicPINVOKE.GetDeviceClass(swigCPtr);
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187 return (DeviceClassType)ret;
193 /// Default Constructor.
195 public Key() : this(NDalicPINVOKE.new_Key__SWIG_0(), true)
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 /// Checks to see if Shift key modifier has been supplied.
217 /// <returns>True if shift modifier</returns>
218 public bool IsShiftModifier()
220 bool ret = NDalicPINVOKE.Key_IsShiftModifier(swigCPtr);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 /// Checks to see if Ctrl (control) key modifier has been supplied.
228 /// <returns>True if ctrl modifier</returns>
229 public bool IsCtrlModifier()
231 bool ret = NDalicPINVOKE.Key_IsCtrlModifier(swigCPtr);
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237 /// Checks to see if Alt key modifier has been supplied.
239 /// <returns>True if alt modifier</returns>
240 public bool IsAltModifier()
242 bool ret = NDalicPINVOKE.Key_IsAltModifier(swigCPtr);
243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 private string keyPressedName
251 NDalicPINVOKE.Key_keyPressedName_set(swigCPtr, value);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256 string ret = NDalicPINVOKE.Key_keyPressedName_get(swigCPtr);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 private string keyPressed
266 NDalicPINVOKE.Key_keyPressed_set(swigCPtr, value);
267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271 string ret = NDalicPINVOKE.Key_keyPressed_get(swigCPtr);
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281 NDalicPINVOKE.Key_keyCode_set(swigCPtr, value);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 int ret = NDalicPINVOKE.Key_keyCode_get(swigCPtr);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 private int keyModifier
296 NDalicPINVOKE.Key_keyModifier_set(swigCPtr, value);
297 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 int ret = NDalicPINVOKE.Key_keyModifier_get(swigCPtr);
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311 NDalicPINVOKE.Key_time_set(swigCPtr, value);
312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316 uint ret = NDalicPINVOKE.Key_time_get(swigCPtr);
317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322 private Key.StateType state
326 NDalicPINVOKE.Key_state_set(swigCPtr, (int)value);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331 Key.StateType ret = (Key.StateType)NDalicPINVOKE.Key_state_get(swigCPtr);
332 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 /// Enumeration for specifying the state of the key event.
340 public enum StateType