1 /* 2 * Copyright (C) 2008-2009 Torch Mobile Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #include "config.h" 21 #include "Cursor.h" 22 23 namespace WebCore { 24 25 struct AllCursors { 26 AllCursors() 27 { 28 for (int i = 0; i < NumCursorTypes; ++i) 29 m_cursors[i] = (CursorType) i; 30 } 31 Cursor m_cursors[NumCursorTypes]; 32 }; 33 34 static const Cursor& getCursor(CursorType type) 35 { 36 static AllCursors allCursors; 37 return allCursors.m_cursors[type]; 38 } 39 40 Cursor::Cursor(const Cursor& other) 41 : m_platformCursor(other.m_platformCursor) 42 { 43 } 44 45 Cursor::Cursor(Image* img, const IntPoint& hotspot) 46 : m_platformCursor(CursorNone) 47 { 48 } 49 50 Cursor::~Cursor() 51 { 52 } 53 54 Cursor& Cursor::operator=(const Cursor& other) 55 { 56 m_platformCursor = other.m_platformCursor; 57 return *this; 58 } 59 60 Cursor::Cursor(PlatformCursor c) 61 : m_platformCursor(c) 62 { 63 } 64 65 const Cursor& noneCursor() { return getCursor(CursorNone); } 66 const Cursor& pointerCursor() { return getCursor(CursorPointer); } 67 const Cursor& crossCursor() { return getCursor(CursorCross); } 68 const Cursor& handCursor() { return getCursor(CursorHand); } 69 const Cursor& iBeamCursor() { return getCursor(CursorBeam); } 70 const Cursor& waitCursor() { return getCursor(CursorWait); } 71 const Cursor& helpCursor() { return getCursor(CursorHelp); } 72 const Cursor& moveCursor() { return getCursor(CursorMove); } 73 const Cursor& eastResizeCursor() { return getCursor(CursorEastResize); } 74 const Cursor& northResizeCursor() { return getCursor(CursorNorthResize); } 75 const Cursor& northEastResizeCursor() { return getCursor(CursorNorthEastResize); } 76 const Cursor& northWestResizeCursor() { return getCursor(CursorNorthWestResize); } 77 const Cursor& southResizeCursor() { return getCursor(CursorSouthResize); } 78 const Cursor& southEastResizeCursor() { return getCursor(CursorSouthEastResize); } 79 const Cursor& southWestResizeCursor() { return getCursor(CursorSouthWestResize); } 80 const Cursor& westResizeCursor() { return getCursor(CursorWestResize); } 81 const Cursor& northSouthResizeCursor() { return getCursor(CursorNorthSouthResize); } 82 const Cursor& eastWestResizeCursor() { return getCursor(CursorEastWestResize); } 83 const Cursor& northEastSouthWestResizeCursor() { return getCursor(CursorNorthEastSouthWestResize); } 84 const Cursor& northWestSouthEastResizeCursor() { return getCursor(CursorNorthWestSouthEastResize); } 85 const Cursor& columnResizeCursor() { return getCursor(CursorColumnResize); } 86 const Cursor& rowResizeCursor() { return getCursor(CursorRowResize); } 87 const Cursor& verticalTextCursor() { return getCursor(CursorVerticalText); } 88 const Cursor& cellCursor() { return getCursor(CursorCell); } 89 const Cursor& contextMenuCursor() { return getCursor(CursorContextMenu); } 90 const Cursor& noDropCursor() { return getCursor(CursorNoDrop); } 91 const Cursor& notAllowedCursor() { return getCursor(CursorNotAllowed); } 92 const Cursor& progressCursor() { return getCursor(CursorProgress); } 93 const Cursor& aliasCursor() { return getCursor(CursorAlias); } 94 const Cursor& zoomInCursor() { return getCursor(CursorZoomIn); } 95 const Cursor& zoomOutCursor() { return getCursor(CursorZoomOut); } 96 const Cursor& copyCursor() { return getCursor(CursorCopy); } 97 const Cursor& middlePanningCursor() { return crossCursor(); } 98 const Cursor& eastPanningCursor() { return crossCursor(); } 99 const Cursor& northPanningCursor() { return crossCursor(); } 100 const Cursor& northEastPanningCursor() { return crossCursor(); } 101 const Cursor& northWestPanningCursor() { return crossCursor(); } 102 const Cursor& southPanningCursor() { return crossCursor(); } 103 const Cursor& southEastPanningCursor() { return crossCursor(); } 104 const Cursor& southWestPanningCursor() { return crossCursor(); } 105 const Cursor& westPanningCursor() { return crossCursor(); } 106 const Cursor& grabbingCursor() { return moveCursor(); } 107 const Cursor& grabCursor() { return moveCursor(); } 108 109 } // namespace WebCore 110