Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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 ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ | |
| 6 #define ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ | |
| 7 | |
| 8 #include "ui/aura/window.h" | |
| 9 #include "ui/base/cursor/cursor.h" | |
| 10 #include "ui/gfx/display.h" | |
| 11 | |
| 12 namespace ash { | |
| 13 namespace test{ | |
| 14 class MirrorWindowTestApi; | |
| 15 } | |
| 16 | |
| 17 namespace internal { | |
| 18 | |
| 19 class CursorWindowDelegate; | |
| 20 | |
| 21 // Draws a mouse cursor on a given container window. | |
| 22 // When cursor compositing is disabled, CursorWindowController is responsible | |
| 23 // to scale and rotate the mouse cursor bitmap to match settings of the | |
| 24 // primary display. | |
| 25 // When cursor compositing is enabled, just draw the cursor as-is. | |
| 26 class CursorWindowController { | |
| 27 public: | |
| 28 CursorWindowController(); | |
| 29 ~CursorWindowController(); | |
| 30 | |
| 31 // Sets cursor compositing mode on/off. | |
| 32 void SetCursorCompositingEnabled(bool enabled); | |
| 33 bool is_cursor_compositing_enabled() const { | |
|
Daniel Erat
2014/02/06 01:54:25
nit: inlined methods usually come immediately afte
hshi1
2014/02/06 02:07:12
Done.
| |
| 34 return is_cursor_compositing_enabled_; | |
| 35 } | |
| 36 | |
| 37 // Updates the container window for the cursor window controller. | |
| 38 void UpdateContainer(); | |
| 39 | |
| 40 // Sets the display on which to draw cursor. | |
| 41 // Only applicable when cursor compositing is enabled. | |
| 42 void SetDisplay(const gfx::Display& display); | |
| 43 | |
| 44 // Sets cursor location, shape, set and visibility. | |
| 45 void UpdateLocation(); | |
| 46 void SetCursor(gfx::NativeCursor cursor); | |
| 47 void SetCursorSet(ui::CursorSetType); | |
| 48 void SetVisibility(bool visible); | |
| 49 | |
| 50 private: | |
| 51 friend class test::MirrorWindowTestApi; | |
| 52 | |
| 53 // Sets the container window for the cursor window controller. | |
| 54 // Closes the cursor window if |container| is NULL. | |
| 55 void SetContainer(aura::Window* container); | |
| 56 | |
| 57 // Sets the bounds of the container in screen coordinates. | |
| 58 void SetBoundsInScreen(const gfx::Rect& bounds); | |
| 59 | |
| 60 // Updates cursor image based on current cursor state. | |
| 61 void UpdateCursorImage(); | |
| 62 | |
| 63 bool is_cursor_compositing_enabled_; | |
| 64 aura::Window* container_; | |
| 65 | |
| 66 // The bounds of the container in screen coordinates. | |
| 67 gfx::Rect bounds_in_screen_; | |
| 68 | |
| 69 // The native_type of the cursor, see definitions in cursor.h | |
| 70 int cursor_type_; | |
| 71 | |
| 72 ui::CursorSetType cursor_set_; | |
| 73 gfx::Display::Rotation cursor_rotation_; | |
| 74 gfx::Point hot_point_; | |
| 75 | |
| 76 // The display on which the cursor is drawn. | |
| 77 // For mirroring mode, the display is always the primary display. | |
| 78 gfx::Display display_; | |
| 79 | |
| 80 scoped_ptr<aura::Window> cursor_window_; | |
| 81 scoped_ptr<CursorWindowDelegate> delegate_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(CursorWindowController); | |
| 84 }; | |
| 85 | |
| 86 } // namespace internal | |
| 87 } // namespace ash | |
| 88 | |
| 89 #endif // ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ | |
| OLD | NEW |