Add ICU message format support
[chromium-blink-merge.git] / ui / base / cursor / cursor_loader.h
blobf69d23c592b98383b152b78994c766b87642c59a
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"
15 namespace ui {
17 class UI_BASE_EXPORT CursorLoader {
18 public:
19 CursorLoader() : scale_(1.f), rotation_(gfx::Display::ROTATE_0) {}
20 virtual ~CursorLoader() {}
22 gfx::Display::Rotation rotation() const {
23 return rotation_;
26 void set_rotation(gfx::Display::Rotation rotation) {
27 rotation_ = rotation;
30 // Returns the current scale of the mouse cursor icon.
31 float scale() const {
32 return scale_;
35 // Sets the scale of the mouse cursor icon.
36 void set_scale(const float scale) {
37 scale_ = scale;
40 // Creates a cursor from an image resource and puts it in the cursor map.
41 virtual void LoadImageCursor(int id,
42 int resource_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
48 // (width == height).
49 // |frame_delay_ms| is the delay between frames in millisecond.
50 virtual void LoadAnimatedCursor(int id,
51 int resource_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();
64 private:
65 // The current scale of the mouse cursor icon.
66 float scale_;
68 // The current rotation of the mouse cursor icon.
69 gfx::Display::Rotation rotation_;
71 DISALLOW_COPY_AND_ASSIGN(CursorLoader);
74 } // namespace ui
76 #endif // UI_BASE_CURSOR_CURSOR_LOADER_H_