2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
23 /// The EvasKeyEventArgs is an EvasKey EventArgs
25 /// <since_tizen> preview </since_tizen>
26 public class EvasKeyEventArgs : EventArgs
28 IntPtr _nativeEventInfo;
31 /// BackButton name in Platform
33 /// <since_tizen> preview </since_tizen>
34 public const string PlatformBackButtonName = "XF86Back";
37 /// MenuButton name in Platform
39 /// <since_tizen> preview </since_tizen>
40 public const string PlatformMenuButtonName = "XF86Menu";
43 /// HomeButton name in Platform
45 /// <since_tizen> preview </since_tizen>
46 public const string PlatformHomeButtonName = "XF86Home";
49 /// Gets the name of Key
51 /// <since_tizen> preview </since_tizen>
52 public string KeyName { get; private set; }
55 /// Sets or gets the flags.
57 /// <since_tizen> preview </since_tizen>
58 public EvasEventFlag Flags
62 IntPtr offset = Marshal.OffsetOf<EvasEventKeyDown>("event_flags");
63 return (EvasEventFlag)Marshal.ReadIntPtr(_nativeEventInfo, (int)offset);
67 IntPtr offset = Marshal.OffsetOf<EvasEventKeyDown>("event_flags");
68 Marshal.WriteIntPtr(_nativeEventInfo, (int)offset, (IntPtr)value);
72 EvasKeyEventArgs(IntPtr info)
74 _nativeEventInfo = info;
75 var evt = Marshal.PtrToStructure<EvasEventKeyDown>(info);
76 KeyName = evt.keyname;
80 /// Creates and initializes a new instance of the EvasKeyEventArgs class.
82 /// <param name="data">data info</param>
83 /// <param name="obj"> object </param>
84 /// <param name="info">information </param>
85 /// <returns>EvasKey eventArgs</returns>
86 /// <since_tizen> preview </since_tizen>
87 static public EvasKeyEventArgs Create(IntPtr data, IntPtr obj, IntPtr info)
89 return new EvasKeyEventArgs(info);
93 /// Event structure for Key Down event callbacks.
95 [StructLayout(LayoutKind.Sequential)]
96 struct EvasEventKeyDown
99 /// Name string of the key pressed
101 public string keyname;
104 /// Data to be passed to the event
109 /// Modifier keys pressed during the event
111 public IntPtr modifiers;
119 /// Logical key: (example, shift+1 == exclamation)
124 /// UTF8 string if this keystroke has produced a visible string to be ADDED
129 /// UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one
131 public string compose;
133 public uint timestamp;
138 public EvasEventFlag event_flags;
155 /// <since_tizen> preview </since_tizen>
157 public enum EvasEventFlag
160 /// No fancy flags set
165 ///This event is being delivered but should be put "on hold" until the on hold flag is unset. the event should be used for informational purposes and maybe some indications visually, but not actually perform anything