OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_GLUE_WEBCURSOR_H_ | 5 #ifndef WEBKIT_GLUE_WEBCURSOR_H_ |
6 #define WEBKIT_GLUE_WEBCURSOR_H_ | 6 #define WEBKIT_GLUE_WEBCURSOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
16 typedef struct HINSTANCE__* HINSTANCE; | 16 typedef struct HINSTANCE__* HINSTANCE; |
17 typedef struct HICON__* HICON; | 17 typedef struct HICON__* HICON; |
18 typedef HICON HCURSOR; | 18 typedef HICON HCURSOR; |
19 #elif defined(USE_X11) | 19 #elif defined(TOOLKIT_USES_GTK) |
20 typedef struct _GdkCursor GdkCursor; | 20 typedef struct _GdkCursor GdkCursor; |
21 #elif defined(USES_X11) | |
22 // TODO(davemoore) define X11 specific cursor implementation. | |
tony
2011/10/04 20:50:33
Nit: These empty #if defined(USES_X11) blocks are
| |
21 #elif defined(OS_MACOSX) | 23 #elif defined(OS_MACOSX) |
22 #ifdef __OBJC__ | 24 #ifdef __OBJC__ |
23 @class NSCursor; | 25 @class NSCursor; |
24 #else | 26 #else |
25 class NSCursor; | 27 class NSCursor; |
26 #endif | 28 #endif |
27 typedef UInt32 ThemeCursor; | 29 typedef UInt32 ThemeCursor; |
28 struct Cursor; | 30 struct Cursor; |
29 #endif | 31 #endif |
30 | 32 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 // Returns a HCURSOR representing the current WebCursor instance. | 75 // Returns a HCURSOR representing the current WebCursor instance. |
74 // The ownership of the HCURSOR (does not apply to external cursors) remains | 76 // The ownership of the HCURSOR (does not apply to external cursors) remains |
75 // with the WebCursor instance. | 77 // with the WebCursor instance. |
76 HCURSOR GetCursor(HINSTANCE module_handle); | 78 HCURSOR GetCursor(HINSTANCE module_handle); |
77 | 79 |
78 // Initialize this from the given Windows cursor. The caller must ensure that | 80 // Initialize this from the given Windows cursor. The caller must ensure that |
79 // the HCURSOR remains valid by not invoking the DestroyCursor/DestroyIcon | 81 // the HCURSOR remains valid by not invoking the DestroyCursor/DestroyIcon |
80 // APIs on it. | 82 // APIs on it. |
81 void InitFromExternalCursor(HCURSOR handle); | 83 void InitFromExternalCursor(HCURSOR handle); |
82 | 84 |
83 #elif defined(USE_X11) | 85 #elif defined(TOOLKIT_USES_GTK) |
84 // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP | 86 // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP |
85 // if it's a custom cursor. Return GDK_LAST_CURSOR to indicate that the cursor | 87 // if it's a custom cursor. Return GDK_LAST_CURSOR to indicate that the cursor |
86 // should be set to the system default. | 88 // should be set to the system default. |
87 // Returns an int so we don't need to include GDK headers in this header file. | 89 // Returns an int so we don't need to include GDK headers in this header file. |
88 int GetCursorType() const; | 90 int GetCursorType() const; |
89 | 91 |
90 // Return a new GdkCursor* for this cursor. Only valid if GetCursorType | 92 // Return a new GdkCursor* for this cursor. Only valid if GetCursorType |
91 // returns GDK_CURSOR_IS_PIXMAP. | 93 // returns GDK_CURSOR_IS_PIXMAP. |
92 GdkCursor* GetCustomCursor(); | 94 GdkCursor* GetCustomCursor(); |
95 #elif defined(USES_X11) | |
tony
2011/10/04 20:50:33
ditto
| |
93 #elif defined(OS_MACOSX) | 96 #elif defined(OS_MACOSX) |
94 // Gets an NSCursor* for this cursor. | 97 // Gets an NSCursor* for this cursor. |
95 NSCursor* GetCursor() const; | 98 NSCursor* GetCursor() const; |
96 | 99 |
97 // Initialize this from the given Carbon ThemeCursor. | 100 // Initialize this from the given Carbon ThemeCursor. |
98 void InitFromThemeCursor(ThemeCursor cursor); | 101 void InitFromThemeCursor(ThemeCursor cursor); |
99 | 102 |
100 // Initialize this from the given Carbon Cursor. | 103 // Initialize this from the given Carbon Cursor. |
101 void InitFromCursor(const Cursor* cursor); | 104 void InitFromCursor(const Cursor* cursor); |
102 | 105 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 // Platform-inspecific because it can be serialized. | 146 // Platform-inspecific because it can be serialized. |
144 gfx::Size custom_size_; | 147 gfx::Size custom_size_; |
145 std::vector<char> custom_data_; | 148 std::vector<char> custom_data_; |
146 | 149 |
147 #if defined(OS_WIN) | 150 #if defined(OS_WIN) |
148 // An externally generated HCURSOR. We assume that it remains valid, i.e we | 151 // An externally generated HCURSOR. We assume that it remains valid, i.e we |
149 // don't attempt to copy the HCURSOR. | 152 // don't attempt to copy the HCURSOR. |
150 HCURSOR external_cursor_; | 153 HCURSOR external_cursor_; |
151 // A custom cursor created from custom bitmap data by Webkit. | 154 // A custom cursor created from custom bitmap data by Webkit. |
152 HCURSOR custom_cursor_; | 155 HCURSOR custom_cursor_; |
153 #endif // OS_WIN | 156 #elif defined(TOOLKIT_USES_GTK) |
154 | |
155 #if defined(USE_X11) | |
156 // A custom cursor created that should be unref'ed from the destructor. | 157 // A custom cursor created that should be unref'ed from the destructor. |
157 GdkCursor* unref_; | 158 GdkCursor* unref_; |
159 #elif defined(USE_X11) | |
160 | |
tony
2011/10/04 20:50:33
ditto
| |
158 #endif | 161 #endif |
159 }; | 162 }; |
160 | 163 |
161 #endif // WEBKIT_GLUE_WEBCURSOR_H_ | 164 #endif // WEBKIT_GLUE_WEBCURSOR_H_ |
OLD | NEW |