/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Runtime.InteropServices;
using Tizen.Internals;
namespace ElmSharp
{
///
/// The EvasKeyEventArgs is a EvasKey EventArgs.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public class EvasKeyEventArgs : EventArgs
{
IntPtr _nativeEventInfo;
///
/// BackButton name in platform.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public const string PlatformBackButtonName = "XF86Back";
///
/// MenuButton name in platform.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public const string PlatformMenuButtonName = "XF86Menu";
///
/// HomeButton name in platform.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public const string PlatformHomeButtonName = "XF86Home";
///
/// Gets the name of the key.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public string KeyName { get; private set; }
///
/// Sets or gets the flags.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public EvasEventFlag Flags
{
get
{
IntPtr offset = Marshal.OffsetOf("event_flags");
return (EvasEventFlag)Marshal.ReadIntPtr(_nativeEventInfo, (int)offset);
}
set
{
IntPtr offset = Marshal.OffsetOf("event_flags");
Marshal.WriteIntPtr(_nativeEventInfo, (int)offset, (IntPtr)value);
}
}
EvasKeyEventArgs(IntPtr info)
{
_nativeEventInfo = info;
var evt = Marshal.PtrToStructure(info);
KeyName = evt.keyname;
}
///
/// Creates and initializes a new instance of the EvasKeyEventArgs class.
///
/// The data information.
/// The object.
/// The information.
/// EvasKey eventArgs.
/// preview
[Obsolete("This has been deprecated in API12")]
static public EvasKeyEventArgs Create(IntPtr data, IntPtr obj, IntPtr info)
{
return new EvasKeyEventArgs(info);
}
///
/// Event structure for Key Down event callbacks.
///
[NativeStruct("Evas_Event_Key_Down", Include = "Elementary.h", PkgConfig = "elementary")]
[StructLayout(LayoutKind.Sequential)]
struct EvasEventKeyDown
{
///
/// Name string of the key pressed.
///
public string keyname;
///
/// Data to be passed to the event.
///
public IntPtr data;
///
/// Modifier keys pressed during the event.
///
public IntPtr modifiers;
///
/// Locks information.
///
public IntPtr locks;
///
/// Logical key: (example, shift+1 == exclamation).
///
public string key;
///
/// UTF-8 string, if this keystroke has produced a visible string to be added.
///
public string str;
///
/// UTF-8 string, if this keystroke has modified a string in the middle of being composed - this string replaces the previous one.
///
public string compose;
public uint timestamp;
///
/// Event_flags.
///
public EvasEventFlag event_flags;
///
///
///
public IntPtr dev;
///
/// Keycode.
///
public uint keycode;
};
}
///
/// Flags for the events.
///
/// preview
[Obsolete("This has been deprecated in API12")]
[Flags]
public enum EvasEventFlag
{
///
/// No fancy flags set.
///
None = 0,
///
/// 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.
///
OnHold = 1,
}
}