Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: ui/base/cursor/cursor.h

Issue 9463003: aura-x11: Add custom web cursor support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window_host_win.cc ('k') | ui/base/cursor/cursor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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 UI_AURA_CURSOR_H_ 5 #ifndef UI_BASE_CURSOR_CURSOR_H_
6 #define UI_AURA_CURSOR_H_ 6 #define UI_BASE_CURSOR_CURSOR_H_
7 #pragma once 7 #pragma once
8 8
9 namespace aura { 9 #include "build/build_config.h"
10 #include "ui/base/ui_export.h"
11
12 namespace gfx {
13 class Point;
14 class Size;
15 }
16
17 #if defined(OS_WIN)
18 typedef struct HINSTANCE__* HINSTANCE;
19 typedef struct HICON__* HICON;
20 typedef HICON HCURSOR;
21 #endif
22
23 namespace ui {
24
25 #if defined(OS_WIN)
26 typedef ::HCURSOR PlatformCursor;
27 #elif defined(USE_X11)
28 typedef unsigned long PlatformCursor;
29 #else
30 typedef void* PlatformCursor;
31 #endif
10 32
11 // TODO(jamescook): Once we're on C++0x we could change these constants 33 // TODO(jamescook): Once we're on C++0x we could change these constants
12 // to an enum and forward declare it in native_widget_types.h. 34 // to an enum and forward declare it in native_widget_types.h.
13 35
14 // Equivalent to a NULL HCURSOR on Windows. 36 // Equivalent to a NULL HCURSOR on Windows.
15 const int kCursorNull = 0; 37 const int kCursorNull = 0;
16 38
17 // Aura cursors mirror WebKit cursors from WebCursorInfo, but are replicated 39 // These cursors mirror WebKit cursors from WebCursorInfo, but are replicated
18 // here so we don't introduce a WebKit dependency. 40 // here so we don't introduce a WebKit dependency.
19 const int kCursorPointer = 1; 41 const int kCursorPointer = 1;
20 const int kCursorCross = 2; 42 const int kCursorCross = 2;
21 const int kCursorHand = 3; 43 const int kCursorHand = 3;
22 const int kCursorIBeam = 4; 44 const int kCursorIBeam = 4;
23 const int kCursorWait = 5; 45 const int kCursorWait = 5;
24 const int kCursorHelp = 6; 46 const int kCursorHelp = 6;
25 const int kCursorEastResize = 7; 47 const int kCursorEastResize = 7;
26 const int kCursorNorthResize = 8; 48 const int kCursorNorthResize = 8;
27 const int kCursorNorthEastResize = 9; 49 const int kCursorNorthEastResize = 9;
(...skipping 26 matching lines...) Expand all
54 const int kCursorNoDrop = 36; 76 const int kCursorNoDrop = 36;
55 const int kCursorCopy = 37; 77 const int kCursorCopy = 37;
56 const int kCursorNone = 38; 78 const int kCursorNone = 38;
57 const int kCursorNotAllowed = 39; 79 const int kCursorNotAllowed = 39;
58 const int kCursorZoomIn = 40; 80 const int kCursorZoomIn = 40;
59 const int kCursorZoomOut = 41; 81 const int kCursorZoomOut = 41;
60 const int kCursorGrab = 42; 82 const int kCursorGrab = 42;
61 const int kCursorGrabbing = 43; 83 const int kCursorGrabbing = 43;
62 const int kCursorCustom = 44; 84 const int kCursorCustom = 44;
63 85
64 } // namespace aura 86 // Ref-counted cursor that supports both default and custom cursors.
87 class UI_EXPORT Cursor {
88 public:
89 Cursor();
65 90
66 #endif // UI_AURA_CURSOR_H_ 91 // Implicit constructor.
92 Cursor(int type);
93
94 // Allow copy.
95 Cursor(const Cursor& cursor);
96
97 ~Cursor();
98
99 void SetPlatformCursor(const PlatformCursor& platform);
100
101 void RefCustomCursor();
102 void UnrefCustomCursor();
103
104 int native_type() const { return native_type_; }
105 PlatformCursor platform() const { return platform_cursor_; }
106
107 bool operator==(int type) const { return native_type_ == type; }
108 bool operator==(const Cursor& cursor) const {
109 return native_type_ == cursor.native_type_ &&
110 platform_cursor_ == cursor.platform_cursor_;
111 }
112 bool operator!=(int type) const { return native_type_ != type; }
113 bool operator!=(const Cursor& cursor) const {
114 return native_type_ != cursor.native_type_ ||
115 platform_cursor_ != cursor.platform_cursor_;
116 }
117
118 private:
119 // See definitions above.
120 int native_type_;
121
122 PlatformCursor platform_cursor_;
123 };
124
125 } // namespace ui
126
127 #endif // UI_BASE_CURSOR_CURSOR_H_
OLDNEW
« no previous file with comments | « ui/aura/root_window_host_win.cc ('k') | ui/base/cursor/cursor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698