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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_CURSOR_CURSOR_LOADER_H_
6 #define UI_BASE_CURSOR_CURSOR_LOADER_H_
8 #include "base/logging.h"
9 #include "base/strings/string16.h"
10 #include "ui/base/ui_base_export.h"
11 #include "ui/gfx/display.h"
12 #include "ui/gfx/geometry/point.h"
13 #include "ui/gfx/native_widget_types.h"
17 class UI_BASE_EXPORT CursorLoader
{
19 CursorLoader() : scale_(1.f
), rotation_(gfx::Display::ROTATE_0
) {}
20 virtual ~CursorLoader() {}
22 gfx::Display::Rotation
rotation() const {
26 void set_rotation(gfx::Display::Rotation rotation
) {
30 // Returns the current scale of the mouse cursor icon.
35 // Sets the scale of the mouse cursor icon.
36 void set_scale(const float scale
) {
40 // Creates a cursor from an image resource and puts it in the cursor map.
41 virtual void LoadImageCursor(int id
,
43 const gfx::Point
& hot
) = 0;
45 // Creates an animated cursor from an image resource and puts it in the
46 // cursor map. The image is assumed to be a concatenation of animation frames
47 // from left to right. Also, each frame is assumed to be square
49 // |frame_delay_ms| is the delay between frames in millisecond.
50 virtual void LoadAnimatedCursor(int id
,
52 const gfx::Point
& hot
,
53 int frame_delay_ms
) = 0;
55 // Unloads all the cursors.
56 virtual void UnloadAll() = 0;
58 // Sets the platform cursor based on the native type of |cursor|.
59 virtual void SetPlatformCursor(gfx::NativeCursor
* cursor
) = 0;
61 // Creates a CursorLoader.
62 static CursorLoader
* Create();
65 // The current scale of the mouse cursor icon.
68 // The current rotation of the mouse cursor icon.
69 gfx::Display::Rotation rotation_
;
71 DISALLOW_COPY_AND_ASSIGN(CursorLoader
);
76 #endif // UI_BASE_CURSOR_CURSOR_LOADER_H_