initial import
[vuplus_webkit] / Source / WebCore / platform / efl / CursorEfl.cpp
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 COMPUTER, 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 COMPUTER, 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 "NotImplemented.h"
38
39 #include <Edje.h>
40 #include <Evas.h>
41 #include <stdio.h>
42 #include <wtf/Assertions.h>
43
44 namespace WebCore {
45
46 Cursor::Cursor(const Cursor& other)
47     : m_type(other.m_type)
48     , m_image(other.m_image)
49     , m_hotSpot(other.m_hotSpot)
50     , m_platformCursor(other.m_platformCursor)
51 {
52 }
53
54 Cursor::~Cursor()
55 {
56 }
57
58 static const char* cursorString(Cursor::Type type)
59 {
60     static const char* cursorStrings[] = {
61         "cursor/pointer",
62         "cursor/cross",
63         "cursor/hand",
64         "cursor/i_beam",
65         "cursor/wait",
66         "cursor/help",
67         "cursor/east_resize",
68         "cursor/north_resize",
69         "cursor/north_east_resize",
70         "cursor/north_west_resize",
71         "cursor/south_resize",
72         "cursor/south_east_resize",
73         "cursor/south_west_resize",
74         "cursor/west_resize",
75         "cursor/north_south_resize",
76         "cursor/east_west_resize",
77         "cursor/north_east_south_west_resize",
78         "cursor/north_west_south_east_resize",
79         "cursor/column_resize",
80         "cursor/row_resize",
81         "cursor/middle_panning",
82         "cursor/east_panning",
83         "cursor/north_panning",
84         "cursor/north_east_panning",
85         "cursor/north_west_panning",
86         "cursor/south_panning",
87         "cursor/south_east_panning",
88         "cursor/south_west_panning",
89         "cursor/west_panning",
90         "cursor/move",
91         "cursor/vertical_text",
92         "cursor/cell",
93         "cursor/context_menu",
94         "cursor/alias",
95         "cursor/progress",
96         "cursor/no_drop",
97         "cursor/copy",
98         "cursor/none",
99         "cursor/not_allowed",
100         "cursor/zoom_in",
101         "cursor/zoom_out",
102         "cursor/grab",
103         "cursor/grabbing",
104         ""}; // FIXME: Just return "" for custom type. We don't support it now.
105     return cursorStrings[type];
106 }
107
108 void Cursor::ensurePlatformCursor() const
109 {
110     if (m_platformCursor)
111         return;
112     m_platformCursor = cursorString(m_type);
113 }
114
115 }