• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
3  *
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.
12  *
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.
24  */
25 
26 #include "config.h"
27 #include "Cursor.h"
28 #include "Image.h"
29 
30 #include <wx/defs.h>
31 #include <wx/cursor.h>
32 #include <wx/image.h>
33 
34 namespace WebCore {
35 
Cursor(const Cursor & other)36 Cursor::Cursor(const Cursor& other)
37     : m_impl(other.m_impl)
38 {
39 }
40 
Cursor(Image * image,const IntPoint &)41 Cursor::Cursor(Image* image, const IntPoint&)
42 {
43     m_impl = 0;
44     // FIXME: figure out why the below code causes a crash
45     //m_impl = new wxCursor( image->getWxBitmap()->ConvertToImage() );
46 }
47 
~Cursor()48 Cursor::~Cursor()
49 {
50 }
51 
operator =(const Cursor & other)52 Cursor& Cursor::operator=(const Cursor& other)
53 {
54     m_impl = other.m_impl;
55     return *this;
56 }
57 
Cursor(wxCursor * c)58 Cursor::Cursor(wxCursor* c)
59     : m_impl(c)
60 {
61 }
62 
pointerCursor()63 const Cursor& pointerCursor()
64 {
65     static Cursor c = new wxCursor(wxCURSOR_ARROW);
66     return c;
67 }
68 
crossCursor()69 const Cursor& crossCursor()
70 {
71     static Cursor c = new wxCursor(wxCURSOR_CROSS);
72     return c;
73 }
74 
handCursor()75 const Cursor& handCursor()
76 {
77     static Cursor c = new wxCursor(wxCURSOR_HAND);
78     return c;
79 }
80 
iBeamCursor()81 const Cursor& iBeamCursor()
82 {
83     static Cursor c = new wxCursor(wxCURSOR_IBEAM);
84     return c;
85 }
86 
waitCursor()87 const Cursor& waitCursor()
88 {
89     static Cursor c = new wxCursor(wxCURSOR_WAIT);
90     return c;
91 }
92 
helpCursor()93 const Cursor& helpCursor()
94 {
95     static Cursor c = new wxCursor(wxCURSOR_QUESTION_ARROW);
96     return c;
97 }
98 
eastResizeCursor()99 const Cursor& eastResizeCursor()
100 {
101     static Cursor c = new wxCursor(wxCURSOR_SIZEWE);
102     return c;
103 }
104 
northResizeCursor()105 const Cursor& northResizeCursor()
106 {
107     static Cursor c = new wxCursor(wxCURSOR_SIZENS);
108     return c;
109 }
110 
northEastResizeCursor()111 const Cursor& northEastResizeCursor()
112 {
113     static Cursor c = new wxCursor(wxCURSOR_SIZENESW);
114     return c;
115 }
116 
northWestResizeCursor()117 const Cursor& northWestResizeCursor()
118 {
119     static Cursor c = new wxCursor(wxCURSOR_SIZENWSE);
120     return c;
121 }
122 
southResizeCursor()123 const Cursor& southResizeCursor()
124 {
125     static Cursor c = northResizeCursor();
126     return c;
127 }
128 
southEastResizeCursor()129 const Cursor& southEastResizeCursor()
130 {
131     static Cursor c = northWestResizeCursor();
132     return c;
133 }
134 
southWestResizeCursor()135 const Cursor& southWestResizeCursor()
136 {
137     static Cursor c = northEastResizeCursor();
138     return c;
139 }
140 
westResizeCursor()141 const Cursor& westResizeCursor()
142 {
143     static Cursor c = eastResizeCursor();
144     return c;
145 }
146 
northSouthResizeCursor()147 const Cursor& northSouthResizeCursor()
148 {
149     static Cursor c = northResizeCursor();
150     return c;
151 }
152 
eastWestResizeCursor()153 const Cursor& eastWestResizeCursor()
154 {
155     static Cursor c = eastResizeCursor();
156     return c;
157 }
158 
northEastSouthWestResizeCursor()159 const Cursor& northEastSouthWestResizeCursor()
160 {
161     static Cursor c = northEastResizeCursor();
162     return c;
163 }
164 
northWestSouthEastResizeCursor()165 const Cursor& northWestSouthEastResizeCursor()
166 {
167     static Cursor c = northWestResizeCursor();
168     return c;
169 }
170 
columnResizeCursor()171 const Cursor& columnResizeCursor()
172 {
173     // FIXME: Windows does not have a standard column resize cursor
174     static Cursor c = new wxCursor(wxCURSOR_SIZING);
175     return c;
176 }
177 
rowResizeCursor()178 const Cursor& rowResizeCursor()
179 {
180     // FIXME: Windows does not have a standard row resize cursor
181     static Cursor c = new wxCursor(wxCURSOR_SIZING);
182     return c;
183 }
184 
middlePanningCursor()185 const Cursor& middlePanningCursor()
186 {
187     return moveCursor();
188 }
189 
eastPanningCursor()190 const Cursor& eastPanningCursor()
191 {
192     return eastResizeCursor();
193 }
194 
northPanningCursor()195 const Cursor& northPanningCursor()
196 {
197     return northResizeCursor();
198 }
199 
northEastPanningCursor()200 const Cursor& northEastPanningCursor()
201 {
202     return northEastResizeCursor();
203 }
204 
northWestPanningCursor()205 const Cursor& northWestPanningCursor()
206 {
207     return northWestResizeCursor();
208 }
209 
southPanningCursor()210 const Cursor& southPanningCursor()
211 {
212     return southResizeCursor();
213 }
214 
southEastPanningCursor()215 const Cursor& southEastPanningCursor()
216 {
217     return southEastResizeCursor();
218 }
219 
southWestPanningCursor()220 const Cursor& southWestPanningCursor()
221 {
222     return southWestResizeCursor();
223 }
224 
westPanningCursor()225 const Cursor& westPanningCursor()
226 {
227     return westResizeCursor();
228 }
229 
verticalTextCursor()230 const Cursor& verticalTextCursor()
231 {
232     return iBeamCursor();
233 }
234 
cellCursor()235 const Cursor& cellCursor()
236 {
237     return pointerCursor();
238 }
239 
contextMenuCursor()240 const Cursor& contextMenuCursor()
241 {
242     return handCursor();
243 }
244 
noDropCursor()245 const Cursor& noDropCursor()
246 {
247     return pointerCursor();
248 }
249 
progressCursor()250 const Cursor& progressCursor()
251 {
252     return waitCursor();
253 }
254 
aliasCursor()255 const Cursor& aliasCursor()
256 {
257     return pointerCursor();
258 }
259 
copyCursor()260 const Cursor& copyCursor()
261 {
262     return pointerCursor();
263 }
264 
noneCursor()265 const Cursor& noneCursor()
266 {
267     // TODO: Determine if we can find a better cursor for this.
268     return pointerCursor();
269 }
270 
notAllowedCursor()271 const Cursor& notAllowedCursor()
272 {
273     static Cursor c = new wxCursor(wxCURSOR_NO_ENTRY);
274     return c;
275 }
276 
zoomInCursor()277 const Cursor& zoomInCursor()
278 {
279     static Cursor c = new wxCursor(wxCURSOR_MAGNIFIER);
280     return c;
281 }
282 
zoomOutCursor()283 const Cursor& zoomOutCursor()
284 {
285     // TODO: Find a way to implement in/out magnifiers in wx.
286     return zoomInCursor();
287 }
288 
grabCursor()289 const Cursor& grabCursor()
290 {
291     // TODO: Determine if we can find a better cursor for this.
292     return pointerCursor();
293 }
294 
grabbingCursor()295 const Cursor& grabbingCursor()
296 {
297     // TODO: Determine if we can find a better cursor for this.
298     return pointerCursor();
299 }
300 
moveCursor()301 const Cursor& moveCursor()
302 {
303     static Cursor c = new wxCursor(wxCURSOR_SIZING);
304     return c;
305 }
306 
307 }
308