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