Chromium Code Reviews| 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 | |
| 12 namespace ui { | |
| 13 | |
| 14 class UI_EXPORT CursorLoader { | |
| 15 public: | |
| 16 CursorLoader() : device_scale_factor_(0.0f) {} | |
| 17 virtual ~CursorLoader() {}; | |
| 18 | |
| 19 // Returns the device scale factor used by the loader. | |
| 20 float device_scale_factor() const { | |
| 21 return device_scale_factor_; | |
| 22 } | |
| 23 | |
| 24 // Sets the device scale factor used by the loader. | |
| 25 void set_device_scale_factor(float device_scale_factor) { | |
| 26 device_scale_factor_ = device_scale_factor; | |
| 27 } | |
| 28 | |
| 29 // Creates a cursor from an image resource and puts it in the cursor map. | |
| 30 virtual void LoadImageCursor( | |
| 31 int id, int resource_id, int hot_x, int hot_y) = 0; | |
| 32 | |
| 33 // Creates an animated cursor from an image resource and puts it in the | |
| 34 // cursor map. The image is assumed to be a concatenation of animation frames. | |
|
Daniel Erat
2012/09/06 23:47:15
nit: Document whether the concatenation is suppose
mazda
2012/09/07 02:20:57
Done.
| |
| 35 // Also, each frame is assumed to be square (width == height) | |
| 36 virtual void LoadAnimatedCursor( | |
| 37 int id, int resource_id, int hot_x, int hot_y) = 0; | |
| 38 | |
| 39 // Unloads all the cursors. | |
| 40 virtual void UnloadAll() = 0; | |
| 41 | |
| 42 // Sets the platform cursor based on the native type of |cursor|. | |
| 43 virtual void SetPlatformCursor(gfx::NativeCursor* cursor) = 0; | |
| 44 | |
| 45 // Hides the host cursor. | |
| 46 virtual void HideHostCursor() = 0; | |
| 47 | |
| 48 // Creates a CursorLoader. | |
| 49 static CursorLoader* Create(); | |
| 50 | |
| 51 private: | |
| 52 // The device scale factor used by the loader. | |
| 53 float device_scale_factor_; | |
| 54 }; | |
| 55 | |
| 56 | |
| 57 } // namespace ui | |
| 58 | |
| 59 #endif // UI_BASE_CURSOR_CURSOR_LOADER_H_ | |
| OLD | NEW |