| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 bool IsCustom() const; | 64 bool IsCustom() const; |
| 65 | 65 |
| 66 // Returns true if the current cursor object contains the same cursor as the | 66 // Returns true if the current cursor object contains the same cursor as the |
| 67 // cursor object passed in. If the current cursor is a custom cursor, we also | 67 // cursor object passed in. If the current cursor is a custom cursor, we also |
| 68 // compare the bitmaps to verify whether they are equal. | 68 // compare the bitmaps to verify whether they are equal. |
| 69 bool IsEqual(const WebCursor& other) const; | 69 bool IsEqual(const WebCursor& other) const; |
| 70 | 70 |
| 71 // Returns a native cursor representing the current WebCursor instance. | 71 // Returns a native cursor representing the current WebCursor instance. |
| 72 gfx::NativeCursor GetNativeCursor(); | 72 gfx::NativeCursor GetNativeCursor(); |
| 73 | 73 |
| 74 #if defined(OS_WIN) |
| 75 // Initialize this from the given Windows cursor. The caller must ensure that |
| 76 // the HCURSOR remains valid by not invoking the DestroyCursor/DestroyIcon |
| 77 // APIs on it. |
| 78 void InitFromExternalCursor(HCURSOR handle); |
| 79 #endif |
| 80 |
| 74 #if defined(USE_AURA) | 81 #if defined(USE_AURA) |
| 75 const ui::PlatformCursor GetPlatformCursor(); | 82 const ui::PlatformCursor GetPlatformCursor(); |
| 76 | 83 |
| 77 void SetScaleFactor(float scale_factor); | 84 void SetScaleFactor(float scale_factor); |
| 78 #elif defined(OS_WIN) | 85 #elif defined(OS_WIN) |
| 79 // Returns a HCURSOR representing the current WebCursor instance. | 86 // Returns a HCURSOR representing the current WebCursor instance. |
| 80 // The ownership of the HCURSOR (does not apply to external cursors) remains | 87 // The ownership of the HCURSOR (does not apply to external cursors) remains |
| 81 // with the WebCursor instance. | 88 // with the WebCursor instance. |
| 82 HCURSOR GetCursor(HINSTANCE module_handle); | 89 HCURSOR GetCursor(HINSTANCE module_handle); |
| 83 | 90 |
| 84 // Initialize this from the given Windows cursor. The caller must ensure that | |
| 85 // the HCURSOR remains valid by not invoking the DestroyCursor/DestroyIcon | |
| 86 // APIs on it. | |
| 87 void InitFromExternalCursor(HCURSOR handle); | |
| 88 | |
| 89 #elif defined(TOOLKIT_GTK) | 91 #elif defined(TOOLKIT_GTK) |
| 90 // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP | 92 // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP |
| 91 // if it's a custom cursor. Return GDK_LAST_CURSOR to indicate that the cursor | 93 // if it's a custom cursor. Return GDK_LAST_CURSOR to indicate that the cursor |
| 92 // should be set to the system default. | 94 // should be set to the system default. |
| 93 // Returns an int so we don't need to include GDK headers in this header file. | 95 // Returns an int so we don't need to include GDK headers in this header file. |
| 94 int GetCursorType() const; | 96 int GetCursorType() const; |
| 95 | 97 |
| 96 // Return a new GdkCursor* for this cursor. Only valid if GetCursorType | 98 // Return a new GdkCursor* for this cursor. Only valid if GetCursorType |
| 97 // returns GDK_CURSOR_IS_PIXMAP. | 99 // returns GDK_CURSOR_IS_PIXMAP. |
| 98 GdkCursor* GetCustomCursor(); | 100 GdkCursor* GetCustomCursor(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // WebCore::PlatformCursor type. | 142 // WebCore::PlatformCursor type. |
| 141 int type_; | 143 int type_; |
| 142 | 144 |
| 143 gfx::Point hotspot_; | 145 gfx::Point hotspot_; |
| 144 | 146 |
| 145 // Custom cursor data, as 32-bit RGBA. | 147 // Custom cursor data, as 32-bit RGBA. |
| 146 // Platform-inspecific because it can be serialized. | 148 // Platform-inspecific because it can be serialized. |
| 147 gfx::Size custom_size_; | 149 gfx::Size custom_size_; |
| 148 std::vector<char> custom_data_; | 150 std::vector<char> custom_data_; |
| 149 | 151 |
| 152 #if defined(OS_WIN) |
| 153 // An externally generated HCURSOR. We assume that it remains valid, i.e we |
| 154 // don't attempt to copy the HCURSOR. |
| 155 HCURSOR external_cursor_; |
| 156 #endif |
| 157 |
| 150 #if defined(USE_AURA) && defined(USE_X11) | 158 #if defined(USE_AURA) && defined(USE_X11) |
| 151 // Only used for custom cursors. | 159 // Only used for custom cursors. |
| 152 ui::PlatformCursor platform_cursor_; | 160 ui::PlatformCursor platform_cursor_; |
| 153 float scale_factor_; | 161 float scale_factor_; |
| 154 #elif defined(OS_WIN) | 162 #elif defined(OS_WIN) |
| 155 // An externally generated HCURSOR. We assume that it remains valid, i.e we | |
| 156 // don't attempt to copy the HCURSOR. | |
| 157 HCURSOR external_cursor_; | |
| 158 // A custom cursor created from custom bitmap data by Webkit. | 163 // A custom cursor created from custom bitmap data by Webkit. |
| 159 HCURSOR custom_cursor_; | 164 HCURSOR custom_cursor_; |
| 160 #elif defined(TOOLKIT_GTK) | 165 #elif defined(TOOLKIT_GTK) |
| 161 // A custom cursor created that should be unref'ed from the destructor. | 166 // A custom cursor created that should be unref'ed from the destructor. |
| 162 GdkCursor* unref_; | 167 GdkCursor* unref_; |
| 163 #endif | 168 #endif |
| 164 }; | 169 }; |
| 165 | 170 |
| 166 #endif // WEBKIT_GLUE_WEBCURSOR_H_ | 171 #endif // WEBKIT_GLUE_WEBCURSOR_H_ |
| OLD | NEW |