| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include <wtf/Assertions.h> | 31 #include <wtf/Assertions.h> |
| 32 #include <wtf/RefPtr.h> | 32 #include <wtf/RefPtr.h> |
| 33 | 33 |
| 34 #if PLATFORM(WIN) | 34 #if PLATFORM(WIN) |
| 35 typedef struct HICON__* HICON; | 35 typedef struct HICON__* HICON; |
| 36 typedef HICON HCURSOR; | 36 typedef HICON HCURSOR; |
| 37 #include <wtf/PassRefPtr.h> | 37 #include <wtf/PassRefPtr.h> |
| 38 #include <wtf/RefCounted.h> | 38 #include <wtf/RefCounted.h> |
| 39 #elif PLATFORM(MAC) | 39 #elif PLATFORM(MAC) |
| 40 #include <wtf/RetainPtr.h> | 40 #include <wtf/RetainPtr.h> |
| 41 #elif PLATFORM(GTK) | |
| 42 #include "GRefPtrGtk.h" | |
| 43 #elif PLATFORM(QT) | |
| 44 #include <QCursor> | |
| 45 #elif PLATFORM(BLACKBERRY) | |
| 46 #include <BlackBerryPlatformCursor.h> | |
| 47 #endif | 41 #endif |
| 48 | 42 |
| 49 #if PLATFORM(MAC) && !PLATFORM(IOS) | 43 #if PLATFORM(MAC) && !PLATFORM(IOS) |
| 50 OBJC_CLASS NSCursor; | 44 OBJC_CLASS NSCursor; |
| 51 #endif | 45 #endif |
| 52 | 46 |
| 53 #if PLATFORM(WIN) | 47 #if PLATFORM(WIN) |
| 54 typedef struct HICON__ *HICON; | 48 typedef struct HICON__ *HICON; |
| 55 typedef HICON HCURSOR; | 49 typedef HICON HCURSOR; |
| 56 #endif | 50 #endif |
| 57 | 51 |
| 58 // Looks like it's just PLATFORM(BLACKBERRY) still not using this? | |
| 59 #if PLATFORM(WIN) || PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(
CHROMIUM) | |
| 60 #define WTF_USE_LAZY_NATIVE_CURSOR 1 | 52 #define WTF_USE_LAZY_NATIVE_CURSOR 1 |
| 61 #endif | |
| 62 | 53 |
| 63 namespace WebCore { | 54 namespace WebCore { |
| 64 | 55 |
| 65 class Image; | 56 class Image; |
| 66 | 57 |
| 67 #if PLATFORM(WIN) | |
| 68 class SharedCursor : public RefCounted<SharedCursor> { | |
| 69 public: | |
| 70 static PassRefPtr<SharedCursor> create(HCURSOR nativeCursor) { return ad
optRef(new SharedCursor(nativeCursor)); } | |
| 71 ~SharedCursor(); | |
| 72 HCURSOR nativeCursor() const { return m_nativeCursor; } | |
| 73 private: | |
| 74 SharedCursor(HCURSOR nativeCursor) : m_nativeCursor(nativeCursor) { } | |
| 75 HCURSOR m_nativeCursor; | |
| 76 }; | |
| 77 typedef RefPtr<SharedCursor> PlatformCursor; | |
| 78 #elif PLATFORM(MAC) && !PLATFORM(IOS) | |
| 79 typedef NSCursor *PlatformCursor; | |
| 80 #elif PLATFORM(GTK) | |
| 81 typedef GRefPtr<GdkCursor> PlatformCursor; | |
| 82 #elif PLATFORM(QT) && !defined(QT_NO_CURSOR) | |
| 83 // Do not need to be shared but need to be created dynamically via ensurePla
tformCursor. | |
| 84 typedef QCursor* PlatformCursor; | |
| 85 #elif PLATFORM(BLACKBERRY) | |
| 86 typedef BlackBerry::Platform::BlackBerryCursor PlatformCursor; | |
| 87 #else | |
| 88 typedef void* PlatformCursor; | 58 typedef void* PlatformCursor; |
| 89 #endif | |
| 90 | 59 |
| 91 class Cursor { | 60 class Cursor { |
| 92 WTF_MAKE_FAST_ALLOCATED; | 61 WTF_MAKE_FAST_ALLOCATED; |
| 93 public: | 62 public: |
| 94 enum Type { | 63 enum Type { |
| 95 Pointer = 0, | 64 Pointer = 0, |
| 96 Cross, | 65 Cross, |
| 97 Hand, | 66 Hand, |
| 98 IBeam, | 67 IBeam, |
| 99 Wait, | 68 Wait, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 ZoomIn, | 103 ZoomIn, |
| 135 ZoomOut, | 104 ZoomOut, |
| 136 Grab, | 105 Grab, |
| 137 Grabbing, | 106 Grabbing, |
| 138 Custom | 107 Custom |
| 139 }; | 108 }; |
| 140 | 109 |
| 141 static const Cursor& fromType(Cursor::Type); | 110 static const Cursor& fromType(Cursor::Type); |
| 142 | 111 |
| 143 Cursor() | 112 Cursor() |
| 144 #if !PLATFORM(IOS) && !PLATFORM(BLACKBERRY) | |
| 145 #if USE(LAZY_NATIVE_CURSOR) | 113 #if USE(LAZY_NATIVE_CURSOR) |
| 146 // This is an invalid Cursor and should never actually get used. | 114 // This is an invalid Cursor and should never actually get used. |
| 147 : m_type(static_cast<Type>(-1)) | 115 : m_type(static_cast<Type>(-1)) |
| 148 , m_platformCursor(0) | 116 , m_platformCursor(0) |
| 149 #else | 117 #else |
| 150 : m_platformCursor(0) | 118 : m_platformCursor(0) |
| 151 #endif // USE(LAZY_NATIVE_CURSOR) | 119 #endif // USE(LAZY_NATIVE_CURSOR) |
| 152 #endif // !PLATFORM(IOS) && !PLATFORM(BLACKBERRY) | |
| 153 { | 120 { |
| 154 } | 121 } |
| 155 | 122 |
| 156 #if !PLATFORM(IOS) | |
| 157 Cursor(Image*, const IntPoint& hotSpot); | 123 Cursor(Image*, const IntPoint& hotSpot); |
| 158 Cursor(const Cursor&); | 124 Cursor(const Cursor&); |
| 159 | 125 |
| 160 #if ENABLE(MOUSE_CURSOR_SCALE) | 126 #if ENABLE(MOUSE_CURSOR_SCALE) |
| 161 // Hot spot is in image pixels. | 127 // Hot spot is in image pixels. |
| 162 Cursor(Image*, const IntPoint& hotSpot, float imageScaleFactor); | 128 Cursor(Image*, const IntPoint& hotSpot, float imageScaleFactor); |
| 163 #endif | 129 #endif |
| 164 | 130 |
| 165 ~Cursor(); | 131 ~Cursor(); |
| 166 Cursor& operator=(const Cursor&); | 132 Cursor& operator=(const Cursor&); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 189 void ensurePlatformCursor() const; | 155 void ensurePlatformCursor() const; |
| 190 | 156 |
| 191 Type m_type; | 157 Type m_type; |
| 192 RefPtr<Image> m_image; | 158 RefPtr<Image> m_image; |
| 193 IntPoint m_hotSpot; | 159 IntPoint m_hotSpot; |
| 194 #if ENABLE(MOUSE_CURSOR_SCALE) | 160 #if ENABLE(MOUSE_CURSOR_SCALE) |
| 195 float m_imageScaleFactor; | 161 float m_imageScaleFactor; |
| 196 #endif | 162 #endif |
| 197 #endif | 163 #endif |
| 198 | 164 |
| 199 #if !PLATFORM(MAC) | |
| 200 mutable PlatformCursor m_platformCursor; | 165 mutable PlatformCursor m_platformCursor; |
| 201 #else | |
| 202 mutable RetainPtr<NSCursor> m_platformCursor; | |
| 203 #endif | |
| 204 #endif // !PLATFORM(IOS) | |
| 205 }; | 166 }; |
| 206 | 167 |
| 207 IntPoint determineHotSpot(Image*, const IntPoint& specifiedHotSpot); | 168 IntPoint determineHotSpot(Image*, const IntPoint& specifiedHotSpot); |
| 208 | 169 |
| 209 const Cursor& pointerCursor(); | 170 const Cursor& pointerCursor(); |
| 210 const Cursor& crossCursor(); | 171 const Cursor& crossCursor(); |
| 211 const Cursor& handCursor(); | 172 const Cursor& handCursor(); |
| 212 const Cursor& moveCursor(); | 173 const Cursor& moveCursor(); |
| 213 const Cursor& iBeamCursor(); | 174 const Cursor& iBeamCursor(); |
| 214 const Cursor& waitCursor(); | 175 const Cursor& waitCursor(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 const Cursor& zoomInCursor(); | 207 const Cursor& zoomInCursor(); |
| 247 const Cursor& zoomOutCursor(); | 208 const Cursor& zoomOutCursor(); |
| 248 const Cursor& copyCursor(); | 209 const Cursor& copyCursor(); |
| 249 const Cursor& noneCursor(); | 210 const Cursor& noneCursor(); |
| 250 const Cursor& grabCursor(); | 211 const Cursor& grabCursor(); |
| 251 const Cursor& grabbingCursor(); | 212 const Cursor& grabbingCursor(); |
| 252 | 213 |
| 253 } // namespace WebCore | 214 } // namespace WebCore |
| 254 | 215 |
| 255 #endif // Cursor_h | 216 #endif // Cursor_h |
| OLD | NEW |