1/* 2 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> 3 * Copyright (C) 2006 George Staikos <staikos@kde.org> 4 * Copyright (C) 2006 Charles Samuels <charles@kde.org> 5 * Copyright (C) 2008 Holger Hans Peter Freyther 6 * Copyright (C) 2008 Kenneth Rohde Christiansen 7 * Copyright (C) 2009-2010 ProFUSION embedded systems 8 * Copyright (C) 2009-2010 Samsung Electronics 9 * 10 * All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 21 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 25 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 29 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include "config.h" 35#include "Cursor.h" 36 37#include <Edje.h> 38#include <Evas.h> 39#include <wtf/Assertions.h> 40 41namespace WebCore { 42 43Cursor::Cursor(const Cursor& other) 44 : m_type(other.m_type) 45 , m_image(other.m_image) 46 , m_hotSpot(other.m_hotSpot) 47#if ENABLE(MOUSE_CURSOR_SCALE) 48 , m_imageScaleFactor(other.m_imageScaleFactor) 49#endif 50 , m_platformCursor(other.m_platformCursor) 51{ 52} 53 54Cursor::~Cursor() 55{ 56} 57 58Cursor& Cursor::operator=(const Cursor& other) 59{ 60 m_type = other.m_type; 61 m_image = other.m_image; 62 m_hotSpot = other.m_hotSpot; 63#if ENABLE(MOUSE_CURSOR_SCALE) 64 m_imageScaleFactor = other.m_imageScaleFactor; 65#endif 66 m_platformCursor = other.m_platformCursor; 67 68 return *this; 69} 70 71static const char* cursorString(Cursor::Type type) 72{ 73 static const char* cursorStrings[] = { 74 "cursor/pointer", 75 "cursor/cross", 76 "cursor/hand", 77 "cursor/i_beam", 78 "cursor/wait", 79 "cursor/help", 80 "cursor/east_resize", 81 "cursor/north_resize", 82 "cursor/north_east_resize", 83 "cursor/north_west_resize", 84 "cursor/south_resize", 85 "cursor/south_east_resize", 86 "cursor/south_west_resize", 87 "cursor/west_resize", 88 "cursor/north_south_resize", 89 "cursor/east_west_resize", 90 "cursor/north_east_south_west_resize", 91 "cursor/north_west_south_east_resize", 92 "cursor/column_resize", 93 "cursor/row_resize", 94 "cursor/middle_panning", 95 "cursor/east_panning", 96 "cursor/north_panning", 97 "cursor/north_east_panning", 98 "cursor/north_west_panning", 99 "cursor/south_panning", 100 "cursor/south_east_panning", 101 "cursor/south_west_panning", 102 "cursor/west_panning", 103 "cursor/move", 104 "cursor/vertical_text", 105 "cursor/cell", 106 "cursor/context_menu", 107 "cursor/alias", 108 "cursor/progress", 109 "cursor/no_drop", 110 "cursor/copy", 111 "cursor/none", 112 "cursor/not_allowed", 113 "cursor/zoom_in", 114 "cursor/zoom_out", 115 "cursor/grab", 116 "cursor/grabbing", 117 "" // Custom cursor. 118 }; 119 return cursorStrings[type]; 120} 121 122void Cursor::ensurePlatformCursor() const 123{ 124 if (m_platformCursor) 125 return; 126 m_platformCursor = cursorString(m_type); 127} 128 129} 130