[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / EvasKeyEventArgs.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19
20 using Tizen.Internals;
21
22 namespace ElmSharp
23 {
24     /// <summary>
25     /// The EvasKeyEventArgs is a EvasKey EventArgs.
26     /// </summary>
27     /// <since_tizen> preview </since_tizen>
28     [Obsolete("This has been deprecated in API12")]
29     public class EvasKeyEventArgs : EventArgs
30     {
31         IntPtr _nativeEventInfo;
32
33         /// <summary>
34         /// BackButton name in platform.
35         /// </summary>
36         /// <since_tizen> preview </since_tizen>
37         [Obsolete("This has been deprecated in API12")]
38         public const string PlatformBackButtonName = "XF86Back";
39
40         /// <summary>
41         /// MenuButton name in platform.
42         /// </summary>
43         /// <since_tizen> preview </since_tizen>
44         [Obsolete("This has been deprecated in API12")]
45         public const string PlatformMenuButtonName = "XF86Menu";
46
47         /// <summary>
48         /// HomeButton name in platform.
49         /// </summary>
50         /// <since_tizen> preview </since_tizen>
51         [Obsolete("This has been deprecated in API12")]
52         public const string PlatformHomeButtonName = "XF86Home";
53
54         /// <summary>
55         /// Gets the name of the key.
56         /// </summary>
57         /// <since_tizen> preview </since_tizen>
58         [Obsolete("This has been deprecated in API12")]
59         public string KeyName { get; private set; }
60
61         /// <summary>
62         /// Sets or gets the flags.
63         /// </summary>
64         /// <since_tizen> preview </since_tizen>
65         [Obsolete("This has been deprecated in API12")]
66         public EvasEventFlag Flags
67         {
68             get
69             {
70                 IntPtr offset = Marshal.OffsetOf<EvasEventKeyDown>("event_flags");
71                 return (EvasEventFlag)Marshal.ReadIntPtr(_nativeEventInfo, (int)offset);
72             }
73             set
74             {
75                 IntPtr offset = Marshal.OffsetOf<EvasEventKeyDown>("event_flags");
76                 Marshal.WriteIntPtr(_nativeEventInfo, (int)offset, (IntPtr)value);
77             }
78         }
79
80         EvasKeyEventArgs(IntPtr info)
81         {
82             _nativeEventInfo = info;
83             var evt = Marshal.PtrToStructure<EvasEventKeyDown>(info);
84             KeyName = evt.keyname;
85         }
86
87         /// <summary>
88         /// Creates and initializes a new instance of the EvasKeyEventArgs class.
89         /// </summary>
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)
97         {
98             return new EvasKeyEventArgs(info);
99         }
100
101         /// <summary>
102         /// Event structure for Key Down event callbacks.
103         /// </summary>
104         [NativeStruct("Evas_Event_Key_Down", Include = "Elementary.h", PkgConfig = "elementary")]
105         [StructLayout(LayoutKind.Sequential)]
106         struct EvasEventKeyDown
107         {
108             /// <summary>
109             /// Name string of the key pressed.
110             /// </summary>
111             public string keyname;
112
113             /// <summary>
114             /// Data to be passed to the event.
115             /// </summary>
116             public IntPtr data;
117
118             /// <summary>
119             /// Modifier keys pressed during the event.
120             /// </summary>
121             public IntPtr modifiers;
122
123             /// <summary>
124             /// Locks information.
125             /// </summary>
126             public IntPtr locks;
127
128             /// <summary>
129             /// Logical key: (example, shift+1 == exclamation).
130             /// </summary>
131             public string key;
132
133             /// <summary>
134             /// UTF-8 string, if this keystroke has produced a visible string to be added.
135             /// </summary>
136             public string str;
137
138             /// <summary>
139             /// UTF-8 string, if this keystroke has modified a string in the middle of being composed - this string replaces the previous one.
140             /// </summary>
141             public string compose;
142
143             public uint timestamp;
144
145             /// <summary>
146             /// Event_flags.
147             /// </summary>
148             public EvasEventFlag event_flags;
149
150             /// <summary>
151             ///
152             /// </summary>
153             public IntPtr dev;
154
155             /// <summary>
156             /// Keycode.
157             /// </summary>
158             public uint keycode;
159         };
160     }
161
162     /// <summary>
163     /// Flags for the events.
164     /// </summary>
165     /// <since_tizen> preview </since_tizen>
166     [Obsolete("This has been deprecated in API12")]
167     [Flags]
168     public enum EvasEventFlag
169     {
170         /// <summary>
171         /// No fancy flags set.
172         /// </summary>
173         None = 0,
174
175         /// <summary>
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.
177         /// </summary>
178         OnHold = 1,
179     }
180 }