00001 /* 00002 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. 00003 * Copyright (C) 2007 Pleyo. All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 00015 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00016 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00017 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 00018 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00019 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00020 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00021 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00022 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00023 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00024 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00025 */ 00026 00027 #ifndef Cursor_h 00028 #define Cursor_h 00029 00030 #include <wtf/Platform.h> 00031 00032 #if PLATFORM(WIN) 00033 typedef struct HICON__* HICON; 00034 typedef HICON HCURSOR; 00035 #include <Shared.h> 00036 #include <wtf/RefPtr.h> 00037 #elif PLATFORM(GTK) 00038 #include <gdk/gdk.h> 00039 #elif PLATFORM(QT) 00040 #include <QCursor> 00041 #elif __OWB__ 00042 //FIXME: should be a "BICursor.h" 00043 #include <SDL/SDL.h> 00044 #endif 00045 00046 #if PLATFORM(MAC) 00047 #ifdef __OBJC__ 00048 @class NSCursor; 00049 #else 00050 class NSCursor; 00051 #endif 00052 #endif 00053 00054 namespace WebCore { 00055 00056 class Image; 00057 class IntPoint; 00058 00059 #if PLATFORM(WIN) 00060 class SharedCursor : public Shared<SharedCursor> { 00061 public: 00062 SharedCursor(HCURSOR nativeCursor) : m_nativeCursor(nativeCursor) {} 00063 ~SharedCursor() { 00064 DestroyIcon(m_nativeCursor); 00065 } 00066 HCURSOR nativeCursor() const { return m_nativeCursor; } 00067 private: 00068 HCURSOR m_nativeCursor; 00069 }; 00070 typedef RefPtr<SharedCursor> PlatformCursor; 00071 #elif PLATFORM(MAC) 00072 typedef NSCursor* PlatformCursor; 00073 #elif PLATFORM(GTK) 00074 typedef GdkCursor* PlatformCursor; 00075 #elif PLATFORM(QT) && !defined(QT_NO_CURSOR) 00076 typedef QCursor PlatformCursor; 00077 #elif __OWB__ 00078 typedef SDL_Cursor* PlatformCursor; 00079 #else 00080 typedef void* PlatformCursor; 00081 #endif 00082 00083 class Cursor { 00084 public: 00085 Cursor() 00086 #if !PLATFORM(QT) 00087 : m_impl(0) 00088 #endif 00089 { } 00090 00091 //FIXME: Should be SDL instead of __OWB__ ??? 00092 #ifdef __OWB__ 00093 Cursor(char**); 00094 #endif 00095 Cursor(Image*, const IntPoint& hotspot); 00096 Cursor(const Cursor&); 00097 ~Cursor(); 00098 Cursor& operator=(const Cursor&); 00099 00100 Cursor(PlatformCursor); 00101 PlatformCursor impl() const { return m_impl; } 00102 00103 private: 00104 PlatformCursor m_impl; 00105 }; 00106 00107 const Cursor& pointerCursor(); 00108 const Cursor& crossCursor(); 00109 const Cursor& handCursor(); 00110 const Cursor& moveCursor(); 00111 const Cursor& iBeamCursor(); 00112 const Cursor& waitCursor(); 00113 const Cursor& helpCursor(); 00114 const Cursor& eastResizeCursor(); 00115 const Cursor& northResizeCursor(); 00116 const Cursor& northEastResizeCursor(); 00117 const Cursor& northWestResizeCursor(); 00118 const Cursor& southResizeCursor(); 00119 const Cursor& southEastResizeCursor(); 00120 const Cursor& southWestResizeCursor(); 00121 const Cursor& westResizeCursor(); 00122 const Cursor& northSouthResizeCursor(); 00123 const Cursor& eastWestResizeCursor(); 00124 const Cursor& northEastSouthWestResizeCursor(); 00125 const Cursor& northWestSouthEastResizeCursor(); 00126 const Cursor& columnResizeCursor(); 00127 const Cursor& rowResizeCursor(); 00128 const Cursor& verticalTextCursor(); 00129 const Cursor& cellCursor(); 00130 const Cursor& contextMenuCursor(); 00131 const Cursor& noDropCursor(); 00132 const Cursor& notAllowedCursor(); 00133 const Cursor& progressCursor(); 00134 const Cursor& aliasCursor(); 00135 const Cursor& zoomInCursor(); 00136 const Cursor& zoomOutCursor(); 00137 const Cursor& copyCursor(); 00138 const Cursor& noneCursor(); 00139 00140 } // namespace WebCore 00141 00142 #endif // Cursor_h