OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef UI_BASE_CURSOR_CURSOR_LOADER_H_ |
| 6 #define UI_BASE_CURSOR_CURSOR_LOADER_H_ |
| 7 |
| 8 #include "base/logging.h" |
| 9 #include "ui/base/ui_export.h" |
| 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/point.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 class UI_EXPORT CursorLoader { |
| 16 public: |
| 17 CursorLoader() : device_scale_factor_(0.0f) {} |
| 18 virtual ~CursorLoader() {} |
| 19 |
| 20 // Returns the device scale factor used by the loader. |
| 21 float device_scale_factor() const { |
| 22 return device_scale_factor_; |
| 23 } |
| 24 |
| 25 // Sets the device scale factor used by the loader. |
| 26 void set_device_scale_factor(float device_scale_factor) { |
| 27 device_scale_factor_ = device_scale_factor; |
| 28 } |
| 29 |
| 30 // Creates a cursor from an image resource and puts it in the cursor map. |
| 31 virtual void LoadImageCursor(int id, |
| 32 int resource_id, |
| 33 const gfx::Point& hot) = 0; |
| 34 |
| 35 // Creates an animated cursor from an image resource and puts it in the |
| 36 // cursor map. The image is assumed to be a concatenation of animation frames |
| 37 // from left to right. Also, each frame is assumed to be square |
| 38 // (width == height). |
| 39 // |frame_delay_ms| is the delay between frames in millisecond. |
| 40 virtual void LoadAnimatedCursor(int id, |
| 41 int resource_id, |
| 42 const gfx::Point& hot, |
| 43 int frame_delay_ms) = 0; |
| 44 |
| 45 // Unloads all the cursors. |
| 46 virtual void UnloadAll() = 0; |
| 47 |
| 48 // Sets the platform cursor based on the native type of |cursor|. |
| 49 virtual void SetPlatformCursor(gfx::NativeCursor* cursor) = 0; |
| 50 |
| 51 // Creates a CursorLoader. |
| 52 static CursorLoader* Create(); |
| 53 |
| 54 private: |
| 55 // The device scale factor used by the loader. |
| 56 float device_scale_factor_; |
| 57 }; |
| 58 |
| 59 } // namespace ui |
| 60 |
| 61 #endif // UI_BASE_CURSOR_CURSOR_LOADER_H_ |
OLD | NEW |