| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IMAGE_CURSORS_H_ | 5 #ifndef UI_BASE_CURSOR_IMAGE_CURSORS_H_ |
| 6 #define UI_BASE_CURSOR_IMAGE_CURSORS_H_ | 6 #define UI_BASE_CURSOR_IMAGE_CURSORS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ui/base/cursor/cursor.h" | 12 #include "ui/base/cursor/cursor.h" |
| 13 #include "ui/base/ui_base_export.h" | 13 #include "ui/base/ui_base_export.h" |
| 14 #include "ui/gfx/display.h" | 14 #include "ui/display/display.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 class CursorLoader; | 19 class CursorLoader; |
| 20 | 20 |
| 21 // 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 |
| 22 // image resources. | 22 // image resources. |
| 23 class UI_BASE_EXPORT ImageCursors { | 23 class UI_BASE_EXPORT ImageCursors { |
| 24 public: | 24 public: |
| 25 ImageCursors(); | 25 ImageCursors(); |
| 26 ~ImageCursors(); | 26 ~ImageCursors(); |
| 27 | 27 |
| 28 // Returns the scale and rotation of the currently loaded cursor. | 28 // Returns the scale and rotation of the currently loaded cursor. |
| 29 float GetScale() const; | 29 float GetScale() const; |
| 30 gfx::Display::Rotation GetRotation() const; | 30 display::Display::Rotation GetRotation() const; |
| 31 | 31 |
| 32 // Sets the display the cursors are loaded for. |scale_factor| determines the | 32 // Sets the display the cursors are loaded for. |scale_factor| determines the |
| 33 // size of the image to load. Returns true if the cursor image is reloaded. | 33 // size of the image to load. Returns true if the cursor image is reloaded. |
| 34 bool SetDisplay(const gfx::Display& display, float scale_factor); | 34 bool SetDisplay(const display::Display& display, float scale_factor); |
| 35 | 35 |
| 36 // Sets the type of the mouse cursor icon. | 36 // Sets the type of the mouse cursor icon. |
| 37 void SetCursorSet(CursorSetType cursor_set); | 37 void SetCursorSet(CursorSetType cursor_set); |
| 38 | 38 |
| 39 // Sets the platform cursor based on the native type of |cursor|. | 39 // Sets the platform cursor based on the native type of |cursor|. |
| 40 void SetPlatformCursor(gfx::NativeCursor* cursor); | 40 void SetPlatformCursor(gfx::NativeCursor* cursor); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // Reloads the all loaded cursors in the cursor loader. | 43 // Reloads the all loaded cursors in the cursor loader. |
| 44 void ReloadCursors(); | 44 void ReloadCursors(); |
| 45 | 45 |
| 46 std::unique_ptr<CursorLoader> cursor_loader_; | 46 std::unique_ptr<CursorLoader> cursor_loader_; |
| 47 CursorSetType cursor_set_; | 47 CursorSetType cursor_set_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ImageCursors); | 49 DISALLOW_COPY_AND_ASSIGN(ImageCursors); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace ui | 52 } // namespace ui |
| 53 | 53 |
| 54 #endif // UI_BASE_CURSOR_IMAGE_CURSORS_H_ | 54 #endif // UI_BASE_CURSOR_IMAGE_CURSORS_H_ |
| OLD | NEW |