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 ASH_WM_IMAGE_CURSORS_H_ | 5 #ifndef ASH_WM_IMAGE_CURSORS_H_ |
6 #define ASH_WM_IMAGE_CURSORS_H_ | 6 #define ASH_WM_IMAGE_CURSORS_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "ui/base/cursor/cursor.h" | 11 #include "ui/base/cursor/cursor.h" |
| 12 #include "ui/gfx/display.h" |
12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
13 | 14 |
14 namespace gfx { | |
15 class Display; | |
16 } | |
17 | |
18 namespace ui { | 15 namespace ui { |
19 class CursorLoader; | 16 class CursorLoader; |
20 } | 17 } |
21 | 18 |
22 namespace ash { | 19 namespace ash { |
23 | 20 |
24 // A utility class that provides cursors for NativeCursors for which we have | 21 // A utility class that provides cursors for NativeCursors for which we have |
25 // image resources. | 22 // image resources. |
26 class ASH_EXPORT ImageCursors { | 23 class ASH_EXPORT ImageCursors { |
27 public: | 24 public: |
28 ImageCursors(); | 25 ImageCursors(); |
29 ~ImageCursors(); | 26 ~ImageCursors(); |
30 | 27 |
31 // Returns the display the cursors are loaded for. The display must | 28 // Returns the scale and rotation of the currently loaded cursor. |
32 // be set by SetDisplay before using this. | 29 float GetScale() const; |
33 gfx::Display GetDisplay() const; | 30 gfx::Display::Rotation GetRotation() const; |
34 | 31 |
35 // Sets the display the cursors are loaded for. The device scale factor | 32 // Sets the display the cursors are loaded for. The device scale factor |
36 // determines the size of the image to load, and the rotation of the display | 33 // determines the size of the image to load, and the rotation of the display |
37 // determines if the image and its host point has to be retated. | 34 // determines if the image and its host point has to be retated. |
38 // Returns true if the cursor image is reloaded. | 35 // Returns true if the cursor image is reloaded. |
39 bool SetDisplay(const gfx::Display& display); | 36 bool SetDisplay(const gfx::Display& display); |
40 | 37 |
41 // Sets the scale of the mouse cursor icon. | |
42 void SetScale(float scale); | |
43 | |
44 // Sets the type of the mouse cursor icon. | 38 // Sets the type of the mouse cursor icon. |
45 void SetCursorSet(ui::CursorSetType cursor_set); | 39 void SetCursorSet(ui::CursorSetType cursor_set); |
46 | 40 |
47 // Sets the platform cursor based on the native type of |cursor|. | 41 // Sets the platform cursor based on the native type of |cursor|. |
48 void SetPlatformCursor(gfx::NativeCursor* cursor); | 42 void SetPlatformCursor(gfx::NativeCursor* cursor); |
49 | 43 |
50 private: | 44 private: |
51 // Reloads the all loaded cursors in the cursor loader. | 45 // Reloads the all loaded cursors in the cursor loader. |
52 void ReloadCursors(); | 46 void ReloadCursors(); |
53 | 47 |
54 scoped_ptr<ui::CursorLoader> cursor_loader_; | 48 scoped_ptr<ui::CursorLoader> cursor_loader_; |
55 float scale_; | |
56 ui::CursorSetType cursor_set_; | 49 ui::CursorSetType cursor_set_; |
57 | 50 |
58 DISALLOW_COPY_AND_ASSIGN(ImageCursors); | 51 DISALLOW_COPY_AND_ASSIGN(ImageCursors); |
59 }; | 52 }; |
60 | 53 |
61 } // namespace ash | 54 } // namespace ash |
62 | 55 |
63 #endif // ASH_WM_IMAGE_CURSORS_H_ | 56 #endif // ASH_WM_IMAGE_CURSORS_H_ |
OLD | NEW |