1/*
2 * Copyright (C) 2009 Google 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 are
6 * met:
7 *
8 *     * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *     * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 *     * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef WebCursorInfo_h
32#define WebCursorInfo_h
33
34#include "WebImage.h"
35#include "WebPoint.h"
36
37#if WEBKIT_IMPLEMENTATION
38namespace WebCore { class Cursor; }
39#endif
40
41#ifdef WIN32
42typedef struct HICON__* HICON;
43typedef HICON HCURSOR;
44#endif
45
46namespace WebKit {
47
48struct WebCursorInfo {
49    enum Type {
50        TypePointer,
51        TypeCross,
52        TypeHand,
53        TypeIBeam,
54        TypeWait,
55        TypeHelp,
56        TypeEastResize,
57        TypeNorthResize,
58        TypeNorthEastResize,
59        TypeNorthWestResize,
60        TypeSouthResize,
61        TypeSouthEastResize,
62        TypeSouthWestResize,
63        TypeWestResize,
64        TypeNorthSouthResize,
65        TypeEastWestResize,
66        TypeNorthEastSouthWestResize,
67        TypeNorthWestSouthEastResize,
68        TypeColumnResize,
69        TypeRowResize,
70        TypeMiddlePanning,
71        TypeEastPanning,
72        TypeNorthPanning,
73        TypeNorthEastPanning,
74        TypeNorthWestPanning,
75        TypeSouthPanning,
76        TypeSouthEastPanning,
77        TypeSouthWestPanning,
78        TypeWestPanning,
79        TypeMove,
80        TypeVerticalText,
81        TypeCell,
82        TypeContextMenu,
83        TypeAlias,
84        TypeProgress,
85        TypeNoDrop,
86        TypeCopy,
87        TypeNone,
88        TypeNotAllowed,
89        TypeZoomIn,
90        TypeZoomOut,
91        TypeGrab,
92        TypeGrabbing,
93        TypeCustom
94    };
95
96    Type type;
97    WebPoint hotSpot;
98    WebImage customImage;
99
100#ifdef WIN32
101    // On Windows, TypeCustom may alternatively reference an externally
102    // defined HCURSOR.  If type is TypeCustom and externalHandle is non-
103    // null, then customData should be ignored.  The WebCursorInfo is not
104    // responsible for managing the lifetime of this cursor handle.
105    HCURSOR externalHandle;
106#endif
107
108    explicit WebCursorInfo(Type type = TypePointer)
109        : type(type)
110    {
111#ifdef WIN32
112        externalHandle = 0;
113#endif
114    }
115
116#if WEBKIT_IMPLEMENTATION
117    explicit WebCursorInfo(const WebCore::Cursor&);
118#endif
119};
120
121} // namespace WebKit
122
123#endif
124