1/*
2 * Copyright (C) 2009 Apple Inc.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef WindowsTouch_h
27#define WindowsTouch_h
28
29/*
30 * The following constants are used to determine multitouch and gesture behavior
31 * for Windows 7. For more information, see:
32 * http://msdn.microsoft.com/en-us/library/dd562197(VS.85).aspx
33 */
34
35// Value used in WebViewWndProc for Gestures
36#define WM_GESTURE 0x0119
37#define WM_GESTURENOTIFY 0x011A
38
39// Gesture Information Flags
40#define GF_BEGIN 0x00000001
41#define GF_INERTIA 0x00000002
42#define GF_END 0x00000004
43
44// Gesture IDs
45#define GID_BEGIN 1
46#define GID_END 2
47#define GID_ZOOM 3
48#define GID_PAN 4
49#define GID_ROTATE 5
50#define GID_TWOFINGERTAP 6
51#define GID_PRESSANDTAP 7
52#define GID_ROLLOVER GID_PRESSANDTAP
53
54// Zoom Gesture Confiration Flags
55#define GC_ZOOM 0x00000001
56
57// Pan Gesture Configuration Flags
58#define GC_PAN 0x00000001
59#define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002
60#define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004
61#define GC_PAN_WITH_GUTTER 0x00000008
62#define GC_PAN_WITH_INERTIA 0x00000010
63
64// Rotate Gesture Configuration Flags
65#define GC_ROTATE 0x00000001
66
67// Two finger tap configuration flags
68#define GC_TWOFINGERTAP 0x00000001
69
70// Press and tap Configuration Flags
71#define GC_PRESSANDTAP 0x00000001
72#define GC_ROLLOVER GC_PRESSANDTAP
73
74// GESTUREINFO struct definition
75typedef struct tagGESTUREINFO {
76    UINT cbSize;                    // size, in bytes, of this structure (including variable length Args field)
77    DWORD dwFlags;                  // see GF_* flags
78    DWORD dwID;                     // gesture ID, see GID_* defines
79    HWND hwndTarget;                // handle to window targeted by this gesture
80    POINTS ptsLocation;             // current location of this gesture
81    DWORD dwInstanceID;             // internally used
82    DWORD dwSequenceID;             // internally used
83    ULONGLONG ullArguments;         // arguments for gestures whose arguments fit in 8 BYTES
84    UINT cbExtraArgs;               // size, in bytes, of extra arguments, if any, that accompany this gesture
85} GESTUREINFO, *PGESTUREINFO;
86typedef GESTUREINFO const * PCGESTUREINFO;
87
88// GESTURECONFIG struct defintion
89typedef struct tagGESTURECONFIG {
90    DWORD dwID;                     // gesture ID
91    DWORD dwWant;                   // settings related to gesture ID that are to be turned on
92    DWORD dwBlock;                  // settings related to gesture ID that are to be turned off
93} GESTURECONFIG, *PGESTURECONFIG;
94
95/*
96 * Gesture notification structure
97 *   - The WM_GESTURENOTIFY message lParam contains a pointer to this structure.
98 *   - The WM_GESTURENOTIFY message notifies a window that gesture recognition is
99 *     in progress and a gesture will be generated if one is recognized under the
100 *     current gesture settings.
101 */
102typedef struct tagGESTURENOTIFYSTRUCT {
103    UINT cbSize;                    // size, in bytes, of this structure
104    DWORD dwFlags;                  // unused
105    HWND hwndTarget;                // handle to window targeted by the gesture
106    POINTS ptsLocation;             // starting location
107    DWORD dwInstanceID;             // internally used
108} GESTURENOTIFYSTRUCT, *PGESTURENOTIFYSTRUCT;
109
110DECLARE_HANDLE(HGESTUREINFO);
111
112#endif
113