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