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 UI_BASE_CURSOR_CURSOR_LOADER_H_ | 5 #ifndef UI_BASE_CURSOR_CURSOR_LOADER_H_ |
6 #define UI_BASE_CURSOR_CURSOR_LOADER_H_ | 6 #define UI_BASE_CURSOR_CURSOR_LOADER_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "ui/base/ui_base_export.h" | 10 #include "ui/base/ui_base_export.h" |
11 #include "ui/gfx/display.h" | 11 #include "ui/gfx/display.h" |
12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 class UI_BASE_EXPORT CursorLoader { | 17 class UI_BASE_EXPORT CursorLoader { |
18 public: | 18 public: |
19 CursorLoader() : scale_(1.f) {} | 19 CursorLoader() : scale_(1.f) {} |
20 virtual ~CursorLoader() {} | 20 virtual ~CursorLoader() {} |
21 | 21 |
22 // Returns the display the loader loads images for. | 22 gfx::Display::Rotation rotation() const { |
23 const gfx::Display& display() const { | 23 return rotation_; |
24 return display_; | |
25 } | 24 } |
26 | 25 |
27 // Sets the display the loader loads images for. | 26 void set_rotation(gfx::Display::Rotation rotation) { |
28 void set_display(const gfx::Display& display) { | 27 rotation_ = rotation; |
29 display_ = display; | |
30 } | 28 } |
31 | 29 |
32 // Returns the current scale of the mouse cursor icon. | 30 // Returns the current scale of the mouse cursor icon. |
33 float scale() const { | 31 float scale() const { |
34 return scale_; | 32 return scale_; |
35 } | 33 } |
36 | 34 |
37 // Sets the scale of the mouse cursor icon. | 35 // Sets the scale of the mouse cursor icon. |
38 void set_scale(const float scale) { | 36 void set_scale(const float scale) { |
39 scale_ = scale; | 37 scale_ = scale; |
(...skipping 17 matching lines...) Expand all Loading... |
57 // Unloads all the cursors. | 55 // Unloads all the cursors. |
58 virtual void UnloadAll() = 0; | 56 virtual void UnloadAll() = 0; |
59 | 57 |
60 // Sets the platform cursor based on the native type of |cursor|. | 58 // Sets the platform cursor based on the native type of |cursor|. |
61 virtual void SetPlatformCursor(gfx::NativeCursor* cursor) = 0; | 59 virtual void SetPlatformCursor(gfx::NativeCursor* cursor) = 0; |
62 | 60 |
63 // Creates a CursorLoader. | 61 // Creates a CursorLoader. |
64 static CursorLoader* Create(); | 62 static CursorLoader* Create(); |
65 | 63 |
66 private: | 64 private: |
67 // The display the loader loads images for. | 65 // The current rotation of the mouse cursor icon. |
68 gfx::Display display_; | 66 gfx::Display::Rotation rotation_; |
69 | 67 |
70 // The current scale of the mouse cursor icon. | 68 // The current scale of the mouse cursor icon. |
71 float scale_; | 69 float scale_; |
72 | 70 |
73 DISALLOW_COPY_AND_ASSIGN(CursorLoader); | 71 DISALLOW_COPY_AND_ASSIGN(CursorLoader); |
74 }; | 72 }; |
75 | 73 |
76 } // namespace ui | 74 } // namespace ui |
77 | 75 |
78 #endif // UI_BASE_CURSOR_CURSOR_LOADER_H_ | 76 #endif // UI_BASE_CURSOR_CURSOR_LOADER_H_ |
OLD | NEW |