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
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.
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"
37 class PLATFORM_EXPORT Cursor
{
38 WTF_MAKE_FAST_ALLOCATED(Cursor
);
57 NorthEastSouthWestResize
,
58 NorthWestSouthEastResize
,
87 static const Cursor
& fromType(Cursor::Type
);
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
&);
102 Cursor
& operator=(const Cursor
&);
104 explicit Cursor(Type
);
107 ASSERT(m_type
>= 0 && m_type
<= Custom
);
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
; }
117 RefPtr
<Image
> m_image
;
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();