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