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.
31
#include <wtf/Assertions.h>
32
#include <wtf/RefPtr.h>
35
typedef struct HICON__* HICON;
36
typedef HICON HCURSOR;
37
#include <wtf/PassRefPtr.h>
38
#include <wtf/RefCounted.h>
40
#include <wtf/RetainPtr.h>
42
#include "GRefPtrGtk.h"
45
#elif PLATFORM(BLACKBERRY)
46
#include <BlackBerryPlatformCursor.h>
49
#if PLATFORM(MAC) && !PLATFORM(IOS)
58
typedef struct HICON__ *HICON;
59
typedef HICON HCURSOR;
62
// Looks like it's just PLATFORM(WX) and PLATFORM(BLACKBERRY) still not using this?
63
#if PLATFORM(WIN) || PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(CHROMIUM)
64
#define WTF_USE_LAZY_NATIVE_CURSOR 1
72
class SharedCursor : public RefCounted<SharedCursor> {
74
static PassRefPtr<SharedCursor> create(HCURSOR nativeCursor) { return adoptRef(new SharedCursor(nativeCursor)); }
76
HCURSOR nativeCursor() const { return m_nativeCursor; }
78
SharedCursor(HCURSOR nativeCursor) : m_nativeCursor(nativeCursor) { }
79
HCURSOR m_nativeCursor;
81
typedef RefPtr<SharedCursor> PlatformCursor;
82
#elif PLATFORM(MAC) && !PLATFORM(IOS)
83
typedef NSCursor *PlatformCursor;
85
typedef GRefPtr<GdkCursor> PlatformCursor;
87
typedef const char* PlatformCursor;
88
#elif PLATFORM(QT) && !defined(QT_NO_CURSOR)
89
// Do not need to be shared but need to be created dynamically via ensurePlatformCursor.
90
typedef QCursor* PlatformCursor;
92
typedef wxCursor* PlatformCursor;
93
#elif PLATFORM(BLACKBERRY)
94
typedef BlackBerry::Platform::BlackBerryCursor PlatformCursor;
96
typedef void* PlatformCursor;
100
WTF_MAKE_FAST_ALLOCATED;
119
NorthEastSouthWestResize,
120
NorthWestSouthEastResize,
149
static const Cursor& fromType(Cursor::Type);
152
#if !PLATFORM(IOS) && !PLATFORM(BLACKBERRY)
153
#if USE(LAZY_NATIVE_CURSOR)
154
// This is an invalid Cursor and should never actually get used.
155
: m_type(static_cast<Type>(-1))
156
, m_platformCursor(0)
158
: m_platformCursor(0)
159
#endif // USE(LAZY_NATIVE_CURSOR)
160
#endif // !PLATFORM(IOS) && !PLATFORM(BLACKBERRY)
165
Cursor(Image*, const IntPoint& hotSpot);
166
Cursor(const Cursor&);
168
Cursor& operator=(const Cursor&);
170
#if USE(LAZY_NATIVE_CURSOR)
171
explicit Cursor(Type);
174
ASSERT(m_type >= 0 && m_type <= Custom);
177
Image* image() const { return m_image.get(); }
178
const IntPoint& hotSpot() const { return m_hotSpot; }
179
PlatformCursor platformCursor() const;
181
explicit Cursor(PlatformCursor);
182
PlatformCursor impl() const { return m_platformCursor; }
186
#if USE(LAZY_NATIVE_CURSOR)
187
void ensurePlatformCursor() const;
190
RefPtr<Image> m_image;
195
mutable PlatformCursor m_platformCursor;
197
mutable RetainPtr<NSCursor> m_platformCursor;
199
#endif // !PLATFORM(IOS)
202
IntPoint determineHotSpot(Image*, const IntPoint& specifiedHotSpot);
204
const Cursor& pointerCursor();
205
const Cursor& crossCursor();
206
const Cursor& handCursor();
207
const Cursor& moveCursor();
208
const Cursor& iBeamCursor();
209
const Cursor& waitCursor();
210
const Cursor& helpCursor();
211
const Cursor& eastResizeCursor();
212
const Cursor& northResizeCursor();
213
const Cursor& northEastResizeCursor();
214
const Cursor& northWestResizeCursor();
215
const Cursor& southResizeCursor();
216
const Cursor& southEastResizeCursor();
217
const Cursor& southWestResizeCursor();
218
const Cursor& westResizeCursor();
219
const Cursor& northSouthResizeCursor();
220
const Cursor& eastWestResizeCursor();
221
const Cursor& northEastSouthWestResizeCursor();
222
const Cursor& northWestSouthEastResizeCursor();
223
const Cursor& columnResizeCursor();
224
const Cursor& rowResizeCursor();
225
const Cursor& middlePanningCursor();
226
const Cursor& eastPanningCursor();
227
const Cursor& northPanningCursor();
228
const Cursor& northEastPanningCursor();
229
const Cursor& northWestPanningCursor();
230
const Cursor& southPanningCursor();
231
const Cursor& southEastPanningCursor();
232
const Cursor& southWestPanningCursor();
233
const Cursor& westPanningCursor();
234
const Cursor& verticalTextCursor();
235
const Cursor& cellCursor();
236
const Cursor& contextMenuCursor();
237
const Cursor& noDropCursor();
238
const Cursor& notAllowedCursor();
239
const Cursor& progressCursor();
240
const Cursor& aliasCursor();
241
const Cursor& zoomInCursor();
242
const Cursor& zoomOutCursor();
243
const Cursor& copyCursor();
244
const Cursor& noneCursor();
245
const Cursor& grabCursor();
246
const Cursor& grabbingCursor();
248
} // namespace WebCore