/*
* 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;
namespace ElmSharp
{
///
/// Enumeration of device type generated events.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public enum InputDeviceType
{
///
/// Touch Screen device.
///
TouchScreen = (1 << 0),
///
/// Keyboard device.
///
Keyboard = (1 << 1),
///
/// Mouse Device.
///
///
/// Since 3.0.
///
Pointer = (1 << 2),
}
///
/// Enumeration of pointer event types.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public enum InputPointerType
{
///
/// Mouse button press.
///
MouseDown,
///
/// Mouse button release.
///
MouseUp,
///
/// Mouse move
///
Move,
}
///
/// Enumeration of touch event types.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public enum InputTouchType
{
///
/// Finger press. It is same a behavior put your finger on touch screen.
///
Begin = 1,
///
/// Finger move. It is same a behavior move your finger on touch screen.
///
Update,
///
/// Finger release. It is same a behavior release your finger on touch screen.
///
End,
}
///
/// InputGenerator provides functions to initialize/deinitialize input devices and to generation touch / key events.
///
///
/// http://tizen.org/privilege/inputgenerator
///
///
/// This is not for use by third-party applications.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public class InputGenerator : IDisposable
{
IntPtr _handle = IntPtr.Zero;
bool _isDisposed = false;
///
/// Creates and initializes a new instance of the InputGenerator class.
///
/// The device type want to generate events
/// preview
[Obsolete("This has been deprecated in API12")]
public InputGenerator(InputDeviceType deviceType)
{
_handle = Interop.Eutil.efl_util_input_initialize_generator((int)deviceType);
}
///
/// Creates and initializes a new instance of the InputGenerator class with given name.
///
/// The device type want to generate events
/// The device name (maximum 31 characters)
/// preview
[Obsolete("This has been deprecated in API12")]
public InputGenerator(InputDeviceType deviceType, string name)
{
_handle = Interop.Eutil.efl_util_input_initialize_generator_with_name((int)deviceType, name);
}
///
/// Destroys the InputGenerator object.
///
~InputGenerator()
{
Dispose(false);
}
///
/// Destroys the current object.
///
/// preview
[Obsolete("This has been deprecated in API12")]
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
///
/// Releases all the resources currently used by this instance.
///
///
/// true if the managed resources should be disposed,
/// otherwise false.
///
/// preview
[Obsolete("This has been deprecated in API12")]
protected virtual void Dispose(bool disposing)
{
if (_isDisposed)
return;
if (disposing)
{
Interop.Eutil.efl_util_input_deinitialize_generator(_handle);
}
_isDisposed = true;
}
///
/// Generates all of key events using a opened device.
///
/// The key name want to generate.
/// The value that select key press or release. (0: release, 1: press)
/// preview
[Obsolete("This has been deprecated in API12")]
public void GenerateKeyEvent(string key, int pressed)
{
Interop.Eutil.efl_util_input_generate_key(_handle, key, pressed);
}
///
/// Generate a pointer event using a opened device
///
/// The number of button.
/// The pointer type.
/// x coordination to move.
/// y coordination to move.
/// preview
[Obsolete("This has been deprecated in API12")]
public void GenerateMouseEvent(int buttons, InputPointerType type, int x, int y)
{
Interop.Eutil.efl_util_input_generate_pointer(_handle, buttons, (int)type, x, y);
}
///
/// Generate a touch event using a opened device
///
/// The index of touched finger.
/// The touch type.
/// The x axis of touch point.
/// The y axis of touch point.
/// preview
[Obsolete("This has been deprecated in API12")]
public void GenerateTouchEvent(int index, InputTouchType type, int x, int y)
{
Interop.Eutil.efl_util_input_generate_touch(_handle, index, (int)type, x, y);
}
}
}