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 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypePointer));
69 const Cursor& crossCursor()
71 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeCross));
75 const Cursor& handCursor()
77 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeHand));
81 const Cursor& iBeamCursor()
83 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeIBeam));
87 const Cursor& waitCursor()
89 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeWait));
93 const Cursor& helpCursor()
95 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeHelp));
99 const Cursor& eastResizeCursor()
101 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeEastResize));
105 const Cursor& northResizeCursor()
107 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthResize));
111 const Cursor& northEastResizeCursor()
113 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthEastResize));
117 const Cursor& northWestResizeCursor()
119 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthWestResize));
123 const Cursor& southResizeCursor()
125 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeSouthResize));
129 const Cursor& southEastResizeCursor()
131 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeSouthEastResize));
135 const Cursor& southWestResizeCursor()
137 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeSouthWestResize));
141 const Cursor& westResizeCursor()
143 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeWestResize));
147 const Cursor& northSouthResizeCursor()
149 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthSouthResize));
153 const Cursor& eastWestResizeCursor()
155 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeEastWestResize));
159 const Cursor& northEastSouthWestResizeCursor()
161 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthEastSouthWestResize));
165 const Cursor& northWestSouthEastResizeCursor()
167 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthWestSouthEastResize));
171 const Cursor& columnResizeCursor()
173 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeColumnResize));
177 const Cursor& rowResizeCursor()
179 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeRowResize));
183 const Cursor& middlePanningCursor()
185 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeMiddlePanning));
189 const Cursor& eastPanningCursor()
191 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeEastPanning));
195 const Cursor& northPanningCursor()
197 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthPanning));
201 const Cursor& northEastPanningCursor()
203 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthEastPanning));
207 const Cursor& northWestPanningCursor()
209 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNorthWestPanning));
213 const Cursor& southPanningCursor()
215 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeSouthPanning));
219 const Cursor& southEastPanningCursor()
221 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeSouthEastPanning));
225 const Cursor& southWestPanningCursor()
227 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeSouthWestPanning));
231 const Cursor& westPanningCursor()
233 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeWestPanning));
237 const Cursor& moveCursor()
239 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeMove));
243 const Cursor& verticalTextCursor()
245 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeVerticalText));
249 const Cursor& cellCursor()
251 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeCell));
255 const Cursor& contextMenuCursor()
257 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeContextMenu));
261 const Cursor& aliasCursor()
263 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeAlias));
267 const Cursor& progressCursor()
269 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeProgress));
273 const Cursor& noDropCursor()
275 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNoDrop));
279 const Cursor& copyCursor()
281 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeCopy));
285 const Cursor& noneCursor()
287 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNone));
291 const Cursor& notAllowedCursor()
293 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeNotAllowed));
297 const Cursor& zoomInCursor()
299 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeZoomIn));
303 const Cursor& zoomOutCursor()
305 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeZoomOut));
309 const Cursor& grabCursor()
311 DEFINE_STATIC_LOCAL(Cursor, c, (PlatformCursor::TypeGrab));
315 const Cursor& grabbingCursor()
317 DEFINE_STATIC_LOCAL(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);