1 /* 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef PlatformCursor_h 32 #define PlatformCursor_h 33 34 #include "Image.h" 35 #include "IntPoint.h" 36 #include "RefPtr.h" 37 38 namespace WebCore { 39 40 class PlatformCursor { 41 public: 42 enum Type { 43 TypePointer, 44 TypeCross, 45 TypeHand, 46 TypeIBeam, 47 TypeWait, 48 TypeHelp, 49 TypeEastResize, 50 TypeNorthResize, 51 TypeNorthEastResize, 52 TypeNorthWestResize, 53 TypeSouthResize, 54 TypeSouthEastResize, 55 TypeSouthWestResize, 56 TypeWestResize, 57 TypeNorthSouthResize, 58 TypeEastWestResize, 59 TypeNorthEastSouthWestResize, 60 TypeNorthWestSouthEastResize, 61 TypeColumnResize, 62 TypeRowResize, 63 TypeMiddlePanning, 64 TypeEastPanning, 65 TypeNorthPanning, 66 TypeNorthEastPanning, 67 TypeNorthWestPanning, 68 TypeSouthPanning, 69 TypeSouthEastPanning, 70 TypeSouthWestPanning, 71 TypeWestPanning, 72 TypeMove, 73 TypeVerticalText, 74 TypeCell, 75 TypeContextMenu, 76 TypeAlias, 77 TypeProgress, 78 TypeNoDrop, 79 TypeCopy, 80 TypeNone, 81 TypeNotAllowed, 82 TypeZoomIn, 83 TypeZoomOut, 84 TypeCustom 85 }; 86 87 // Cursor.h assumes that it can initialize us to 0. m_type(TypePointer)88 explicit PlatformCursor(int type = 0) : m_type(TypePointer) {} 89 PlatformCursor(Type type)90 PlatformCursor(Type type) : m_type(type) {} 91 PlatformCursor(Image * image,const IntPoint & hotSpot)92 PlatformCursor(Image* image, const IntPoint& hotSpot) 93 : m_image(image) 94 , m_hotSpot(hotSpot) 95 , m_type(TypeCustom) {} 96 customImage()97 PassRefPtr<Image> customImage() const { return m_image; } hotSpot()98 const IntPoint& hotSpot() const { return m_hotSpot; } type()99 Type type() const { return m_type; } 100 101 private: 102 RefPtr<Image> m_image; 103 IntPoint m_hotSpot; 104 Type m_type; 105 }; 106 107 } // namespace WebCore 108 109 #endif 110