OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_AURA_CLIENT_CURSOR_CLIENT_H_ | 5 #ifndef UI_AURA_CLIENT_CURSOR_CLIENT_H_ |
6 #define UI_AURA_CLIENT_CURSOR_CLIENT_H_ | 6 #define UI_AURA_CLIENT_CURSOR_CLIENT_H_ |
7 | 7 |
8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 | 10 |
11 namespace aura { | 11 namespace aura { |
12 class Window; | 12 class Window; |
13 namespace client { | 13 namespace client { |
14 | 14 |
15 // An interface that receives cursor change events. | 15 // An interface that receives cursor change events. |
16 class AURA_EXPORT CursorClient { | 16 class AURA_EXPORT CursorClient { |
17 public: | 17 public: |
18 // Notes that |window| has requested the change to |cursor|. | 18 // Notes that |window| has requested the change to |cursor|. |
19 virtual void SetCursor(gfx::NativeCursor cursor) = 0; | 19 virtual void SetCursor(gfx::NativeCursor cursor) = 0; |
20 | 20 |
21 // Changes the visibility of the cursor. | 21 // Shows the cursor. This does not take effect When mouse events are disabled. |
22 virtual void ShowCursor(bool show) = 0; | 22 virtual void ShowCursor() = 0; |
| 23 |
| 24 // Hides the cursor. Mouse events keep being sent even when the cursor is |
| 25 // invisible. |
| 26 virtual void HideCursor() = 0; |
23 | 27 |
24 // Gets whether the cursor is visible. | 28 // Gets whether the cursor is visible. |
25 virtual bool IsCursorVisible() const = 0; | 29 virtual bool IsCursorVisible() const = 0; |
26 | 30 |
| 31 // Makes mouse events start being sent and shows the cursor if it was hidden |
| 32 // with DisableMouseEvents. |
| 33 virtual void EnableMouseEvents() = 0; |
| 34 |
| 35 // Makes mouse events stop being sent and hides the cursor if it is visible. |
| 36 virtual void DisableMouseEvents() = 0; |
| 37 |
| 38 // Returns true if mouse events are enabled. |
| 39 virtual bool IsMouseEventsEnabled() const = 0; |
| 40 |
27 // Sets the device scale factor of the cursor. | 41 // Sets the device scale factor of the cursor. |
28 virtual void SetDeviceScaleFactor(float device_scale_factor) = 0; | 42 virtual void SetDeviceScaleFactor(float device_scale_factor) = 0; |
29 | 43 |
30 // Locks the cursor change. The cursor type and cursor visibility never change | 44 // Locks the cursor change. The cursor type, cursor visibility, and mouse |
31 // as long as lock is held by anyone. | 45 // events enable state never change as long as lock is held by anyone. |
32 virtual void LockCursor() = 0; | 46 virtual void LockCursor() = 0; |
33 | 47 |
34 // Unlocks the cursor change. If all the locks are released, the cursor type | 48 // Unlocks the cursor change. If all the locks are released, the cursor type, |
35 // and visibility are restored to the ones set by the lastest call of | 49 // cursor visibility, and mouse events enable state are restored to the ones |
36 // SetCursor and ShowCursor. | 50 // set by the lastest call of SetCursor, ShowCursor/HideCursor, and |
| 51 // EnableMouseEvents/DisableMouseEvents. |
37 virtual void UnlockCursor() = 0; | 52 virtual void UnlockCursor() = 0; |
38 | 53 |
39 protected: | 54 protected: |
40 virtual ~CursorClient() {} | 55 virtual ~CursorClient() {} |
41 }; | 56 }; |
42 | 57 |
43 // Sets/Gets the activation client for the specified window. | 58 // Sets/Gets the activation client for the specified window. |
44 AURA_EXPORT void SetCursorClient(Window* window, | 59 AURA_EXPORT void SetCursorClient(Window* window, |
45 CursorClient* client); | 60 CursorClient* client); |
46 AURA_EXPORT CursorClient* GetCursorClient(Window* window); | 61 AURA_EXPORT CursorClient* GetCursorClient(Window* window); |
47 | 62 |
48 } // namespace client | 63 } // namespace client |
49 } // namespace aura | 64 } // namespace aura |
50 | 65 |
51 #endif // UI_AURA_CLIENT_CURSOR_CLIENT_H_ | 66 #endif // UI_AURA_CLIENT_CURSOR_CLIENT_H_ |
OLD | NEW |