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_AURA_CURSOR_MANAGER_H_ | |
6 #define UI_AURA_CURSOR_MANAGER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "ui/aura/aura_export.h" | |
10 #include "ui/gfx/native_widget_types.h" | |
11 | |
12 namespace aura { | |
13 class CursorDelegate; | |
14 | |
15 // This class controls the visibility and the type of the cursor. | |
16 // The cursor type can be locked so that the type stays the same | |
17 // until it's unlocked. | |
18 class AURA_EXPORT CursorManager { | |
19 public: | |
20 CursorManager(); | |
21 ~CursorManager(); | |
22 | |
23 void set_delegate(CursorDelegate* delegate) { delegate_ = delegate; } | |
24 | |
25 // Locks/Unlocks the cursor change. | |
26 void LockCursor(); | |
27 void UnlockCursor(); | |
28 | |
29 bool is_cursor_locked() const { return cursor_lock_count_ > 0; } | |
30 | |
31 void SetCursor(gfx::NativeCursor); | |
32 | |
33 // Shows or hides the cursor. | |
34 void ShowCursor(bool show); | |
35 bool cursor_visible() const { return cursor_visible_; } | |
36 | |
37 private: | |
38 CursorDelegate* delegate_; | |
39 | |
40 // Number of times LockCursor() has been invoked without a corresponding | |
41 // UnlockCursor(). | |
42 int cursor_lock_count_; | |
43 | |
44 // Set to true if UpdateCursor() is invoked while |cursor_lock_count_| == 0. | |
45 bool did_cursor_change_; | |
46 | |
47 // Cursor to set once |cursor_lock_count_| is set to 0. Only valid if | |
48 // |did_cursor_change_| is true. | |
49 gfx::NativeCursor cursor_to_set_on_unlock_; | |
50 | |
51 // Is cursor visible? | |
52 bool cursor_visible_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(CursorManager); | |
55 }; | |
56 | |
57 } // namespace aura | |
58 | |
59 #endif // UI_AURA_CURSOR_MANAGER_H_ | |
OLD | NEW |