Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gfx/point.h" | 8 #include "base/gfx/point.h" |
| 9 #include "base/gfx/size.h" | 9 #include "base/gfx/size.h" |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 14 typedef struct HINSTANCE__* HINSTANCE; | 14 typedef struct HINSTANCE__* HINSTANCE; |
| 15 typedef struct HICON__* HICON; | 15 typedef struct HICON__* HICON; |
| 16 typedef HICON HCURSOR; | 16 typedef HICON HCURSOR; |
| 17 #elif defined(OS_LINUX) | 17 #elif defined(OS_LINUX) |
| 18 // GdkCursorType is an enum, which we can't forward-declare. :( | 18 // GdkCursorType is an enum, which we can't forward-declare. :( |
| 19 #include <gdk/gdkcursor.h> | 19 #include <gdk/gdkcursor.h> |
| 20 #elif defined(OS_MACOSX) | |
| 21 #ifdef __OBJC__ | |
| 22 @class NSCursor; | |
| 23 #else | |
| 24 class NSCursor; | |
| 25 #endif | |
| 20 #endif | 26 #endif |
| 21 | 27 |
| 22 class Pickle; | 28 class Pickle; |
| 23 | 29 |
| 24 namespace WebCore { | 30 namespace WebCore { |
| 25 class Image; | 31 class Image; |
| 26 class PlatformCursor; | 32 class PlatformCursor; |
| 27 } | 33 } |
| 28 | 34 |
| 29 // This class encapsulates a cross-platform description of a cursor. Platform | 35 // This class encapsulates a cross-platform description of a cursor. Platform |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 // Initialize this from the given Windows cursor. | 68 // Initialize this from the given Windows cursor. |
| 63 void InitFromCursor(HCURSOR handle); | 69 void InitFromCursor(HCURSOR handle); |
| 64 #elif defined(OS_LINUX) | 70 #elif defined(OS_LINUX) |
| 65 // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP | 71 // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP |
| 66 // if it's a custom cursor. | 72 // if it's a custom cursor. |
| 67 GdkCursorType GetCursorType() const; | 73 GdkCursorType GetCursorType() const; |
| 68 | 74 |
| 69 // Return a new GdkCursor* for this cursor. Only valid if GetCursorType | 75 // Return a new GdkCursor* for this cursor. Only valid if GetCursorType |
| 70 // returns GDK_CURSOR_IS_PIXMAP. | 76 // returns GDK_CURSOR_IS_PIXMAP. |
| 71 GdkCursor* GetCustomCursor() const; | 77 GdkCursor* GetCustomCursor() const; |
| 78 #elif defined(OS_MACOSX) | |
| 79 NSCursor* GetCursor() const; | |
|
darin (slow to review)
2008/11/18 18:16:27
Might be good to document the ownership model here
pink (ping after 24hrs)
2008/11/18 18:28:12
The usual nomenclature for Foundation/ObjC is that
| |
| 72 #endif | 80 #endif |
| 73 | 81 |
| 74 private: | 82 private: |
| 75 void SetCustomData(WebCore::Image* image); | 83 void SetCustomData(WebCore::Image* image); |
| 76 | 84 |
| 77 // WebCore::PlatformCursor type. | 85 // WebCore::PlatformCursor type. |
| 78 int type_; | 86 int type_; |
| 79 | 87 |
| 80 gfx::Point hotspot_; | 88 gfx::Point hotspot_; |
| 81 | 89 |
| 82 // Custom cursor data, as 32-bit RGBA. | 90 // Custom cursor data, as 32-bit RGBA. |
| 83 // Platform-inspecific because it can be serialized. | 91 // Platform-inspecific because it can be serialized. |
| 84 gfx::Size custom_size_; | 92 gfx::Size custom_size_; |
| 85 std::vector<char> custom_data_; | 93 std::vector<char> custom_data_; |
| 86 }; | 94 }; |
| 87 | 95 |
| 88 #endif // WEBKIT_GLUE_WEBCURSOR_H_ | 96 #endif // WEBKIT_GLUE_WEBCURSOR_H_ |
| OLD | NEW |