• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
3  * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
4  *
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include "config.h"
30 #include "Cursor.h"
31 
32 #include "NotImplemented.h"
33 
34 namespace WebCore {
35 
Cursor(PlatformCursor cursor)36 Cursor::Cursor(PlatformCursor cursor)
37     : m_platformCursor(cursor)
38 {
39 }
40 
Cursor(const Cursor & other)41 Cursor::Cursor(const Cursor& other)
42     : m_platformCursor(0)
43 {
44     *this = other;
45 }
46 
~Cursor()47 Cursor::~Cursor()
48 {
49     delete m_platformCursor;
50 }
51 
Cursor(Image *,const IntPoint &)52 Cursor::Cursor(Image*, const IntPoint&)
53     : m_platformCursor(0)
54 {
55     notImplemented();
56 }
57 
operator =(const Cursor & other)58 Cursor& Cursor::operator=(const Cursor& other)
59 {
60     delete m_platformCursor;
61     m_platformCursor = other.m_platformCursor ? new BCursor(*other.m_platformCursor) : 0;
62     return *this;
63 }
64 
createCursorByID(BCursorID id)65 static Cursor createCursorByID(BCursorID id)
66 {
67     return Cursor(new BCursor(id));
68 }
69 
pointerCursor()70 const Cursor& pointerCursor()
71 {
72     static Cursor cursorSystemDefault(0);
73     return cursorSystemDefault;
74 }
75 
moveCursor()76 const Cursor& moveCursor()
77 {
78     static Cursor cursorMove = createCursorByID(B_CURSOR_ID_MOVE);
79     return cursorMove;
80 }
81 
crossCursor()82 const Cursor& crossCursor()
83 {
84     static Cursor cursorCrossHair = createCursorByID(B_CURSOR_ID_CROSS_HAIR);
85     return cursorCrossHair;
86 }
87 
handCursor()88 const Cursor& handCursor()
89 {
90     static Cursor cursorFollowLink = createCursorByID(B_CURSOR_ID_FOLLOW_LINK);
91     return cursorFollowLink;
92 }
93 
iBeamCursor()94 const Cursor& iBeamCursor()
95 {
96     static Cursor cursorIBeam = createCursorByID(B_CURSOR_ID_I_BEAM);
97     return cursorIBeam;
98 }
99 
waitCursor()100 const Cursor& waitCursor()
101 {
102     static Cursor cursorProgress = createCursorByID(B_CURSOR_ID_PROGRESS);
103     return cursorProgress;
104 }
105 
helpCursor()106 const Cursor& helpCursor()
107 {
108     static Cursor cursorHelp = createCursorByID(B_CURSOR_ID_HELP);
109     return cursorHelp;
110 }
111 
eastResizeCursor()112 const Cursor& eastResizeCursor()
113 {
114     static Cursor cursorResizeEast = createCursorByID(B_CURSOR_ID_RESIZE_EAST);
115     return cursorResizeEast;
116 }
117 
northResizeCursor()118 const Cursor& northResizeCursor()
119 {
120     static Cursor cursorResizeNorth = createCursorByID(B_CURSOR_ID_RESIZE_NORTH);
121     return cursorResizeNorth;
122 }
123 
northEastResizeCursor()124 const Cursor& northEastResizeCursor()
125 {
126     static Cursor cursorResizeNorthEast = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_EAST);
127     return cursorResizeNorthEast;
128 }
129 
northWestResizeCursor()130 const Cursor& northWestResizeCursor()
131 {
132     static Cursor cursorResizeNorthWest = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_WEST);
133     return cursorResizeNorthWest;
134 }
135 
southResizeCursor()136 const Cursor& southResizeCursor()
137 {
138     static Cursor cursorResizeSouth = createCursorByID(B_CURSOR_ID_RESIZE_SOUTH);
139     return cursorResizeSouth;
140 }
141 
southEastResizeCursor()142 const Cursor& southEastResizeCursor()
143 {
144     static Cursor cursorResizeSouthEast = createCursorByID(B_CURSOR_ID_RESIZE_SOUTH_EAST);
145     return cursorResizeSouthEast;
146 }
147 
southWestResizeCursor()148 const Cursor& southWestResizeCursor()
149 {
150     static Cursor cursorResizeSouthWest = createCursorByID(B_CURSOR_ID_RESIZE_SOUTH_WEST);
151     return cursorResizeSouthWest;
152 }
153 
westResizeCursor()154 const Cursor& westResizeCursor()
155 {
156     static Cursor cursorResizeWest = createCursorByID(B_CURSOR_ID_RESIZE_WEST);
157     return cursorResizeWest;
158 }
159 
northSouthResizeCursor()160 const Cursor& northSouthResizeCursor()
161 {
162     static Cursor cursorResizeNorthSouth = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_SOUTH);
163     return cursorResizeNorthSouth;
164 }
165 
eastWestResizeCursor()166 const Cursor& eastWestResizeCursor()
167 {
168     static Cursor cursorResizeEastWest = createCursorByID(B_CURSOR_ID_RESIZE_EAST_WEST);
169     return cursorResizeEastWest;
170 }
171 
northEastSouthWestResizeCursor()172 const Cursor& northEastSouthWestResizeCursor()
173 {
174     static Cursor cursorResizeNorthEastSouthWest = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST);
175     return cursorResizeNorthEastSouthWest;
176 }
177 
northWestSouthEastResizeCursor()178 const Cursor& northWestSouthEastResizeCursor()
179 {
180     static Cursor cursorResizeNorthWestSouthEast = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST);
181     return cursorResizeNorthWestSouthEast;
182 }
183 
columnResizeCursor()184 const Cursor& columnResizeCursor()
185 {
186     return eastWestResizeCursor();
187 }
188 
rowResizeCursor()189 const Cursor& rowResizeCursor()
190 {
191     return northSouthResizeCursor();
192 }
193 
verticalTextCursor()194 const Cursor& verticalTextCursor()
195 {
196     static Cursor cursorIBeamHorizontal = createCursorByID(B_CURSOR_ID_I_BEAM_HORIZONTAL);
197     return cursorIBeamHorizontal;
198 }
199 
cellCursor()200 const Cursor& cellCursor()
201 {
202     return pointerCursor();
203 }
204 
contextMenuCursor()205 const Cursor& contextMenuCursor()
206 {
207     static Cursor cursorContextMenu = createCursorByID(B_CURSOR_ID_CONTEXT_MENU);
208     return cursorContextMenu;
209 }
210 
noDropCursor()211 const Cursor& noDropCursor()
212 {
213     static Cursor cursorNotAllowed = createCursorByID(B_CURSOR_ID_NOT_ALLOWED);
214     return cursorNotAllowed;
215 }
216 
copyCursor()217 const Cursor& copyCursor()
218 {
219     static Cursor cursorCopy = createCursorByID(B_CURSOR_ID_COPY);
220     return cursorCopy;
221 }
222 
progressCursor()223 const Cursor& progressCursor()
224 {
225     static Cursor cursorProgress = createCursorByID(B_CURSOR_ID_PROGRESS);
226     return cursorProgress;
227 }
228 
aliasCursor()229 const Cursor& aliasCursor()
230 {
231     return handCursor();
232 }
233 
noneCursor()234 const Cursor& noneCursor()
235 {
236     static Cursor cursorNoCursor = createCursorByID(B_CURSOR_ID_NO_CURSOR);
237     return cursorNoCursor;
238 }
239 
notAllowedCursor()240 const Cursor& notAllowedCursor()
241 {
242     static Cursor cursorNotAllowed = createCursorByID(B_CURSOR_ID_NOT_ALLOWED);
243     return cursorNotAllowed;
244 }
245 
zoomInCursor()246 const Cursor& zoomInCursor()
247 {
248     static Cursor cursorZoomIn = createCursorByID(B_CURSOR_ID_ZOOM_IN);
249     return cursorZoomIn;
250 }
251 
zoomOutCursor()252 const Cursor& zoomOutCursor()
253 {
254     static Cursor cursorZoomOut = createCursorByID(B_CURSOR_ID_ZOOM_OUT);
255     return cursorZoomOut;
256 }
257 
grabCursor()258 const Cursor& grabCursor()
259 {
260     static Cursor cursorGrab = createCursorByID(B_CURSOR_ID_GRAB);
261     return cursorGrab;
262 }
263 
grabbingCursor()264 const Cursor& grabbingCursor()
265 {
266     static Cursor cursorGrabbing = createCursorByID(B_CURSOR_ID_GRABBING);
267     return cursorGrabbing;
268 }
269 
270 } // namespace WebCore
271 
272