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;
20 using Tizen.Internals;
25 /// The EvasKeyEventArgs is a EvasKey EventArgs.
27 /// <since_tizen> preview </since_tizen>
28 [Obsolete("This has been deprecated in API12")]
29 public class EvasKeyEventArgs : EventArgs
31 IntPtr _nativeEventInfo;
34 /// BackButton name in platform.
36 /// <since_tizen> preview </since_tizen>
37 [Obsolete("This has been deprecated in API12")]
38 public const string PlatformBackButtonName = "XF86Back";
41 /// MenuButton name in platform.
43 /// <since_tizen> preview </since_tizen>
44 [Obsolete("This has been deprecated in API12")]
45 public const string PlatformMenuButtonName = "XF86Menu";
48 /// HomeButton name in platform.
50 /// <since_tizen> preview </since_tizen>
51 [Obsolete("This has been deprecated in API12")]
52 public const string PlatformHomeButtonName = "XF86Home";
55 /// Gets the name of the key.
57 /// <since_tizen> preview </since_tizen>
58 [Obsolete("This has been deprecated in API12")]
59 public string KeyName { get; private set; }
62 /// Sets or gets the flags.
64 /// <since_tizen> preview </since_tizen>
65 [Obsolete("This has been deprecated in API12")]
66 public EvasEventFlag Flags
70 IntPtr offset = Marshal.OffsetOf<EvasEventKeyDown>("event_flags");
71 return (EvasEventFlag)Marshal.ReadIntPtr(_nativeEventInfo, (int)offset);
75 IntPtr offset = Marshal.OffsetOf<EvasEventKeyDown>("event_flags");
76 Marshal.WriteIntPtr(_nativeEventInfo, (int)offset, (IntPtr)value);
80 EvasKeyEventArgs(IntPtr info)
82 _nativeEventInfo = info;
83 var evt = Marshal.PtrToStructure<EvasEventKeyDown>(info);
84 KeyName = evt.keyname;
88 /// Creates and initializes a new instance of the EvasKeyEventArgs class.
90 /// <param name="data">The data information.</param>
91 /// <param name="obj">The object.</param>
92 /// <param name="info">The information.</param>
93 /// <returns>EvasKey eventArgs.</returns>
94 /// <since_tizen> preview </since_tizen>
95 [Obsolete("This has been deprecated in API12")]
96 static public EvasKeyEventArgs Create(IntPtr data, IntPtr obj, IntPtr info)
98 return new EvasKeyEventArgs(info);
102 /// Event structure for Key Down event callbacks.
104 [NativeStruct("Evas_Event_Key_Down", Include = "Elementary.h", PkgConfig = "elementary")]
105 [StructLayout(LayoutKind.Sequential)]
106 struct EvasEventKeyDown
109 /// Name string of the key pressed.
111 public string keyname;
114 /// Data to be passed to the event.
119 /// Modifier keys pressed during the event.
121 public IntPtr modifiers;
124 /// Locks information.
129 /// Logical key: (example, shift+1 == exclamation).
134 /// UTF-8 string, if this keystroke has produced a visible string to be added.
139 /// UTF-8 string, if this keystroke has modified a string in the middle of being composed - this string replaces the previous one.
141 public string compose;
143 public uint timestamp;
148 public EvasEventFlag event_flags;
163 /// Flags for the events.
165 /// <since_tizen> preview </since_tizen>
166 [Obsolete("This has been deprecated in API12")]
168 public enum EvasEventFlag
171 /// No fancy flags set.
176 /// 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.