//-----------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using Windows7.Multitouch.Interop;
using System.Reflection;
using System.Threading;
using System.Drawing;
namespace Windows7.Multitouch
{
///
/// Wrapp HWND source such as System.Windows.Forms.Control, or System.Windows.Window
///
interface IHwndWrapper
{
///
/// The Underline Windows Handle
///
IntPtr Handle { get; }
///
/// The .NET object that wrap the Windows Handle (WinForm, WinForm Control, WPF Window, IntPtr of HWND)
///
object Source { get; }
///
/// The Win32 Handle has been created
///
event EventHandler HandleCreated;
///
/// /// The Win32 Handle has been destroyed
///
event EventHandler HandleDestroyed;
///
/// Check if the Win32 Handle is already created
///
bool IsHandleCreated { get; }
///
/// Computes the location of the specified screen point into client coordinates
///
/// The screen coordinate System.Drawing.Point to convert
/// A point that represents the converted point in client coordinates
Point PointToClient(Point point);
}
///
/// A Common interface foir timer.
/// The timer has to be in the UI thread context
///
public interface IGUITimer : IDisposable
{
///
/// Gets or sets whether the timer is running.
///
bool Enabled { get; set; }
///
/// Gets or sets the time, in milliseconds, before the Tick event is raised
///
int Interval { get; set; }
///
/// Occurs when the specified timer interval has elapsed and the timer is enabled.
///
event EventHandler Tick;
///
/// Starts the timer.
///
void Start();
///
/// Stops the timer.
///
void Stop();
}
///
/// Base class for handling Gesture and Touch event
///
///
/// A form can have one handler, either touch handler or gesture handler.
/// The form need to create the handler and register to events.
/// The code is not thread safe, we assume that the calling thread is the
/// UI thread. There is no blocking operation in the code.
///
public abstract class Handler
{
private readonly IHwndWrapper _hWndWrapper;
static private List