Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / Cursor.h
bloba6cc7ed334158456224b4de433d69066f4592e28
1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
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.
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.
26 #ifndef Cursor_h
27 #define Cursor_h
29 #include "platform/PlatformExport.h"
30 #include "platform/geometry/IntPoint.h"
31 #include "platform/graphics/Image.h"
32 #include "wtf/Assertions.h"
33 #include "wtf/RefPtr.h"
35 namespace blink {
37 class PLATFORM_EXPORT Cursor {
38 WTF_MAKE_FAST_ALLOCATED(Cursor);
39 public:
40 enum Type {
41 Pointer = 0,
42 Cross,
43 Hand,
44 IBeam,
45 Wait,
46 Help,
47 EastResize,
48 NorthResize,
49 NorthEastResize,
50 NorthWestResize,
51 SouthResize,
52 SouthEastResize,
53 SouthWestResize,
54 WestResize,
55 NorthSouthResize,
56 EastWestResize,
57 NorthEastSouthWestResize,
58 NorthWestSouthEastResize,
59 ColumnResize,
60 RowResize,
61 MiddlePanning,
62 EastPanning,
63 NorthPanning,
64 NorthEastPanning,
65 NorthWestPanning,
66 SouthPanning,
67 SouthEastPanning,
68 SouthWestPanning,
69 WestPanning,
70 Move,
71 VerticalText,
72 Cell,
73 ContextMenu,
74 Alias,
75 Progress,
76 NoDrop,
77 Copy,
78 None,
79 NotAllowed,
80 ZoomIn,
81 ZoomOut,
82 Grab,
83 Grabbing,
84 Custom
87 static const Cursor& fromType(Cursor::Type);
89 Cursor()
90 // This is an invalid Cursor and should never actually get used.
91 : m_type(static_cast<Type>(-1))
95 Cursor(Image*, bool hotSpotSpecified, const IntPoint& hotSpot);
97 // Hot spot is in image pixels.
98 Cursor(Image*, bool hotSpotSpecified, const IntPoint& hotSpot, float imageScaleFactor);
100 Cursor(const Cursor&);
101 ~Cursor();
102 Cursor& operator=(const Cursor&);
104 explicit Cursor(Type);
105 Type type() const
107 ASSERT(m_type >= 0 && m_type <= Custom);
108 return m_type;
110 Image* image() const { return m_image.get(); }
111 const IntPoint& hotSpot() const { return m_hotSpot; }
112 // Image scale in image pixels per logical (UI) pixel.
113 float imageScaleFactor() const { return m_imageScaleFactor; }
115 private:
116 Type m_type;
117 RefPtr<Image> m_image;
118 IntPoint m_hotSpot;
119 float m_imageScaleFactor;
122 PLATFORM_EXPORT IntPoint determineHotSpot(Image*, bool hotSpotSpecified, const IntPoint& specifiedHotSpot);
124 PLATFORM_EXPORT const Cursor& pointerCursor();
125 PLATFORM_EXPORT const Cursor& crossCursor();
126 PLATFORM_EXPORT const Cursor& handCursor();
127 PLATFORM_EXPORT const Cursor& moveCursor();
128 PLATFORM_EXPORT const Cursor& iBeamCursor();
129 PLATFORM_EXPORT const Cursor& waitCursor();
130 PLATFORM_EXPORT const Cursor& helpCursor();
131 PLATFORM_EXPORT const Cursor& eastResizeCursor();
132 PLATFORM_EXPORT const Cursor& northResizeCursor();
133 PLATFORM_EXPORT const Cursor& northEastResizeCursor();
134 PLATFORM_EXPORT const Cursor& northWestResizeCursor();
135 PLATFORM_EXPORT const Cursor& southResizeCursor();
136 PLATFORM_EXPORT const Cursor& southEastResizeCursor();
137 PLATFORM_EXPORT const Cursor& southWestResizeCursor();
138 PLATFORM_EXPORT const Cursor& westResizeCursor();
139 PLATFORM_EXPORT const Cursor& northSouthResizeCursor();
140 PLATFORM_EXPORT const Cursor& eastWestResizeCursor();
141 PLATFORM_EXPORT const Cursor& northEastSouthWestResizeCursor();
142 PLATFORM_EXPORT const Cursor& northWestSouthEastResizeCursor();
143 PLATFORM_EXPORT const Cursor& columnResizeCursor();
144 PLATFORM_EXPORT const Cursor& rowResizeCursor();
145 PLATFORM_EXPORT const Cursor& middlePanningCursor();
146 PLATFORM_EXPORT const Cursor& eastPanningCursor();
147 PLATFORM_EXPORT const Cursor& northPanningCursor();
148 PLATFORM_EXPORT const Cursor& northEastPanningCursor();
149 PLATFORM_EXPORT const Cursor& northWestPanningCursor();
150 PLATFORM_EXPORT const Cursor& southPanningCursor();
151 PLATFORM_EXPORT const Cursor& southEastPanningCursor();
152 PLATFORM_EXPORT const Cursor& southWestPanningCursor();
153 PLATFORM_EXPORT const Cursor& westPanningCursor();
154 PLATFORM_EXPORT const Cursor& verticalTextCursor();
155 PLATFORM_EXPORT const Cursor& cellCursor();
156 PLATFORM_EXPORT const Cursor& contextMenuCursor();
157 PLATFORM_EXPORT const Cursor& noDropCursor();
158 PLATFORM_EXPORT const Cursor& notAllowedCursor();
159 PLATFORM_EXPORT const Cursor& progressCursor();
160 PLATFORM_EXPORT const Cursor& aliasCursor();
161 PLATFORM_EXPORT const Cursor& zoomInCursor();
162 PLATFORM_EXPORT const Cursor& zoomOutCursor();
163 PLATFORM_EXPORT const Cursor& copyCursor();
164 PLATFORM_EXPORT const Cursor& noneCursor();
165 PLATFORM_EXPORT const Cursor& grabCursor();
166 PLATFORM_EXPORT const Cursor& grabbingCursor();
168 } // namespace blink
170 #endif // Cursor_h