2 * Copyright (c) 2008, 2009, Google 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 are
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
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.
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.
34 #include <wtf/Assertions.h>
38 Cursor::Cursor(const Cursor& other)
39 : m_platformCursor(other.m_platformCursor)
43 Cursor::Cursor(Image* image, const IntPoint& hotSpot)
44 : m_platformCursor(image, hotSpot)
52 Cursor& Cursor::operator=(const Cursor& other)
54 m_platformCursor = other.m_platformCursor;
58 Cursor::Cursor(PlatformCursor c)
63 const Cursor& pointerCursor()
65 static const Cursor c(PlatformCursor::TypePointer);
69 const Cursor& crossCursor()
71 static const Cursor c(PlatformCursor::TypeCross);
75 const Cursor& handCursor()
77 static const Cursor c(PlatformCursor::TypeHand);
81 const Cursor& iBeamCursor()
83 static const Cursor c(PlatformCursor::TypeIBeam);
87 const Cursor& waitCursor()
89 static const Cursor c(PlatformCursor::TypeWait);
93 const Cursor& helpCursor()
95 static const Cursor c(PlatformCursor::TypeHelp);
99 const Cursor& eastResizeCursor()
101 static const Cursor c(PlatformCursor::TypeEastResize);
105 const Cursor& northResizeCursor()
107 static const Cursor c(PlatformCursor::TypeNorthResize);
111 const Cursor& northEastResizeCursor()
113 static const Cursor c(PlatformCursor::TypeNorthEastResize);
117 const Cursor& northWestResizeCursor()
119 static const Cursor c(PlatformCursor::TypeNorthWestResize);
123 const Cursor& southResizeCursor()
125 static const Cursor c(PlatformCursor::TypeSouthResize);
129 const Cursor& southEastResizeCursor()
131 static const Cursor c(PlatformCursor::TypeSouthEastResize);
135 const Cursor& southWestResizeCursor()
137 static const Cursor c(PlatformCursor::TypeSouthWestResize);
141 const Cursor& westResizeCursor()
143 static const Cursor c(PlatformCursor::TypeWestResize);
147 const Cursor& northSouthResizeCursor()
149 static const Cursor c(PlatformCursor::TypeNorthSouthResize);
153 const Cursor& eastWestResizeCursor()
155 static const Cursor c(PlatformCursor::TypeEastWestResize);
159 const Cursor& northEastSouthWestResizeCursor()
161 static const Cursor c(PlatformCursor::TypeNorthEastSouthWestResize);
165 const Cursor& northWestSouthEastResizeCursor()
167 static const Cursor c(PlatformCursor::TypeNorthWestSouthEastResize);
171 const Cursor& columnResizeCursor()
173 static const Cursor c(PlatformCursor::TypeColumnResize);
177 const Cursor& rowResizeCursor()
179 static const Cursor c(PlatformCursor::TypeRowResize);
183 const Cursor& middlePanningCursor()
185 static const Cursor c(PlatformCursor::TypeMiddlePanning);
189 const Cursor& eastPanningCursor()
191 static const Cursor c(PlatformCursor::TypeEastPanning);
195 const Cursor& northPanningCursor()
197 static const Cursor c(PlatformCursor::TypeNorthPanning);
201 const Cursor& northEastPanningCursor()
203 static const Cursor c(PlatformCursor::TypeNorthEastPanning);
207 const Cursor& northWestPanningCursor()
209 static const Cursor c(PlatformCursor::TypeNorthWestPanning);
213 const Cursor& southPanningCursor()
215 static const Cursor c(PlatformCursor::TypeSouthPanning);
219 const Cursor& southEastPanningCursor()
221 static const Cursor c(PlatformCursor::TypeSouthEastPanning);
225 const Cursor& southWestPanningCursor()
227 static const Cursor c(PlatformCursor::TypeSouthWestPanning);
231 const Cursor& westPanningCursor()
233 static const Cursor c(PlatformCursor::TypeWestPanning);
237 const Cursor& moveCursor()
239 static const Cursor c(PlatformCursor::TypeMove);
243 const Cursor& verticalTextCursor()
245 static const Cursor c(PlatformCursor::TypeVerticalText);
249 const Cursor& cellCursor()
251 static const Cursor c(PlatformCursor::TypeCell);
255 const Cursor& contextMenuCursor()
257 static const Cursor c(PlatformCursor::TypeContextMenu);
261 const Cursor& aliasCursor()
263 static const Cursor c(PlatformCursor::TypeAlias);
267 const Cursor& progressCursor()
269 static const Cursor c(PlatformCursor::TypeProgress);
273 const Cursor& noDropCursor()
275 static const Cursor c(PlatformCursor::TypeNoDrop);
279 const Cursor& copyCursor()
281 static const Cursor c(PlatformCursor::TypeCopy);
285 const Cursor& noneCursor()
287 static const Cursor c(PlatformCursor::TypeNone);
291 const Cursor& notAllowedCursor()
293 static const Cursor c(PlatformCursor::TypeNotAllowed);
297 const Cursor& zoomInCursor()
299 static const Cursor c(PlatformCursor::TypeZoomIn);
303 const Cursor& zoomOutCursor()
305 static const Cursor c(PlatformCursor::TypeZoomOut);
309 const Cursor& grabCursor()
311 static const Cursor c(PlatformCursor::TypeGrab);
315 const Cursor& grabbingCursor()
317 static const Cursor c(PlatformCursor::TypeGrabbing);
321 } // namespace WebCore
323 #define COMPILE_ASSERT_MATCHING_ENUM(cursor_name, platform_cursor_name) \
324 COMPILE_ASSERT(int(WebCore::Cursor::cursor_name) == int(WebCore::PlatformCursor::platform_cursor_name), mismatching_enums)
326 COMPILE_ASSERT_MATCHING_ENUM(Pointer, TypePointer);
327 COMPILE_ASSERT_MATCHING_ENUM(Cross, TypeCross);
328 COMPILE_ASSERT_MATCHING_ENUM(Hand, TypeHand);
329 COMPILE_ASSERT_MATCHING_ENUM(IBeam, TypeIBeam);
330 COMPILE_ASSERT_MATCHING_ENUM(Wait, TypeWait);
331 COMPILE_ASSERT_MATCHING_ENUM(Help, TypeHelp);
332 COMPILE_ASSERT_MATCHING_ENUM(EastResize, TypeEastResize);
333 COMPILE_ASSERT_MATCHING_ENUM(NorthResize, TypeNorthResize);
334 COMPILE_ASSERT_MATCHING_ENUM(NorthEastResize, TypeNorthEastResize);
335 COMPILE_ASSERT_MATCHING_ENUM(NorthWestResize, TypeNorthWestResize);
336 COMPILE_ASSERT_MATCHING_ENUM(SouthResize, TypeSouthResize);
337 COMPILE_ASSERT_MATCHING_ENUM(SouthEastResize, TypeSouthEastResize);
338 COMPILE_ASSERT_MATCHING_ENUM(SouthWestResize, TypeSouthWestResize);
339 COMPILE_ASSERT_MATCHING_ENUM(WestResize, TypeWestResize);
340 COMPILE_ASSERT_MATCHING_ENUM(NorthSouthResize, TypeNorthSouthResize);
341 COMPILE_ASSERT_MATCHING_ENUM(EastWestResize, TypeEastWestResize);
342 COMPILE_ASSERT_MATCHING_ENUM(NorthEastSouthWestResize, TypeNorthEastSouthWestResize);
343 COMPILE_ASSERT_MATCHING_ENUM(NorthWestSouthEastResize, TypeNorthWestSouthEastResize);
344 COMPILE_ASSERT_MATCHING_ENUM(ColumnResize, TypeColumnResize);
345 COMPILE_ASSERT_MATCHING_ENUM(RowResize, TypeRowResize);
346 COMPILE_ASSERT_MATCHING_ENUM(MiddlePanning, TypeMiddlePanning);
347 COMPILE_ASSERT_MATCHING_ENUM(EastPanning, TypeEastPanning);
348 COMPILE_ASSERT_MATCHING_ENUM(NorthPanning, TypeNorthPanning);
349 COMPILE_ASSERT_MATCHING_ENUM(NorthEastPanning, TypeNorthEastPanning);
350 COMPILE_ASSERT_MATCHING_ENUM(NorthWestPanning, TypeNorthWestPanning);
351 COMPILE_ASSERT_MATCHING_ENUM(SouthPanning, TypeSouthPanning);
352 COMPILE_ASSERT_MATCHING_ENUM(SouthEastPanning, TypeSouthEastPanning);
353 COMPILE_ASSERT_MATCHING_ENUM(SouthWestPanning, TypeSouthWestPanning);
354 COMPILE_ASSERT_MATCHING_ENUM(WestPanning, TypeWestPanning);
355 COMPILE_ASSERT_MATCHING_ENUM(Move, TypeMove);
356 COMPILE_ASSERT_MATCHING_ENUM(VerticalText, TypeVerticalText);
357 COMPILE_ASSERT_MATCHING_ENUM(Cell, TypeCell);
358 COMPILE_ASSERT_MATCHING_ENUM(ContextMenu, TypeContextMenu);
359 COMPILE_ASSERT_MATCHING_ENUM(Alias, TypeAlias);
360 COMPILE_ASSERT_MATCHING_ENUM(Progress, TypeProgress);
361 COMPILE_ASSERT_MATCHING_ENUM(NoDrop, TypeNoDrop);
362 COMPILE_ASSERT_MATCHING_ENUM(Copy, TypeCopy);
363 COMPILE_ASSERT_MATCHING_ENUM(None, TypeNone);
364 COMPILE_ASSERT_MATCHING_ENUM(NotAllowed, TypeNotAllowed);
365 COMPILE_ASSERT_MATCHING_ENUM(ZoomIn, TypeZoomIn);
366 COMPILE_ASSERT_MATCHING_ENUM(ZoomOut, TypeZoomOut);
367 COMPILE_ASSERT_MATCHING_ENUM(Grab, TypeGrab);
368 COMPILE_ASSERT_MATCHING_ENUM(Grabbing, TypeGrabbing);
369 COMPILE_ASSERT_MATCHING_ENUM(Custom, TypeCustom);