Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Side by Side Diff: ash/wm/cursor_manager.h

Issue 11412315: Make the cursor have separate mode for disabled mouse events and invisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 ASH_WM_CURSOR_MANAGER_H_ 5 #ifndef ASH_WM_CURSOR_MANAGER_H_
6 #define ASH_WM_CURSOR_MANAGER_H_ 6 #define ASH_WM_CURSOR_MANAGER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/client/cursor_client.h" 12 #include "ui/aura/client/cursor_client.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/point.h"
14 15
15 namespace ash { 16 namespace ash {
16 17
17 namespace test { 18 namespace test {
18 class CursorManagerTestApi; 19 class CursorManagerTestApi;
19 } 20 }
20 21
22 class CursorState;
21 class ImageCursors; 23 class ImageCursors;
22 24
23 // This class controls the visibility and the type of the cursor. 25 // This class controls the visibility and the type of the cursor.
24 // The cursor type can be locked so that the type stays the same 26 // The cursor type can be locked so that the type stays the same
25 // until it's unlocked. 27 // until it's unlocked.
26 class ASH_EXPORT CursorManager : public aura::client::CursorClient { 28 class ASH_EXPORT CursorManager : public aura::client::CursorClient {
27 public: 29 public:
28 CursorManager(); 30 CursorManager();
29 virtual ~CursorManager(); 31 virtual ~CursorManager();
30 32
31 bool is_cursor_locked() const { return cursor_lock_count_ > 0; } 33 bool is_cursor_locked() const { return cursor_lock_count_ > 0; }
32 34
33 // Overridden from aura::client::CursorClient: 35 // Overridden from aura::client::CursorClient:
34 virtual void SetCursor(gfx::NativeCursor) OVERRIDE; 36 virtual void SetCursor(gfx::NativeCursor) OVERRIDE;
35 virtual void ShowCursor(bool show) OVERRIDE; 37 virtual void ShowCursor(bool show) OVERRIDE;
36 virtual bool IsCursorVisible() const OVERRIDE; 38 virtual bool IsCursorVisible() const OVERRIDE;
39 virtual void EnableCursor(bool enabled) OVERRIDE;
37 virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE; 40 virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
38 virtual void LockCursor() OVERRIDE; 41 virtual void LockCursor() OVERRIDE;
39 virtual void UnlockCursor() OVERRIDE; 42 virtual void UnlockCursor() OVERRIDE;
40 43
41 private: 44 private:
42 friend class test::CursorManagerTestApi; 45 friend class test::CursorManagerTestApi;
43 46
44 void SetCursorInternal(gfx::NativeCursor cursor); 47 void SetCursorInternal(gfx::NativeCursor cursor);
45 void ShowCursorInternal(bool show); 48 void ShowCursorInternal(bool show);
49 void EnableCursorInternal(bool enabled);
46 50
47 // Number of times LockCursor() has been invoked without a corresponding 51 // Number of times LockCursor() has been invoked without a corresponding
48 // UnlockCursor(). 52 // UnlockCursor().
49 int cursor_lock_count_; 53 int cursor_lock_count_;
50 54
51 // Set to true if SetCursor() is invoked while |cursor_lock_count_| == 0.
52 bool did_cursor_change_;
53
54 // Cursor to set once |cursor_lock_count_| is set to 0. Only valid if
55 // |did_cursor_change_| is true.
56 gfx::NativeCursor cursor_to_set_on_unlock_;
57
58 // Set to true if ShowCursor() is invoked while |cursor_lock_count_| == 0.
59 bool did_visibility_change_;
60
61 // The visibility to set once |cursor_lock_count_| is set to 0. Only valid if
62 // |did_visibility_change_| is true.
63 bool show_on_unlock_;
64
65 // Is cursor visible? 55 // Is cursor visible?
66 bool cursor_visible_; 56 bool cursor_visible_;
67 57
58 // Is cursor enabled?
59 bool cursor_enabled_;
60
61 // The cursor location where the cursor was disabled.
62 gfx::Point disabled_cursor_location_;
63
68 // The cursor currently set. 64 // The cursor currently set.
69 gfx::NativeCursor current_cursor_; 65 gfx::NativeCursor current_cursor_;
70 66
67 // The cursor state to set when the cursor is unlocked.
68 scoped_ptr<CursorState> state_on_unlock_;
69
71 scoped_ptr<ImageCursors> image_cursors_; 70 scoped_ptr<ImageCursors> image_cursors_;
72 71
73 DISALLOW_COPY_AND_ASSIGN(CursorManager); 72 DISALLOW_COPY_AND_ASSIGN(CursorManager);
74 }; 73 };
75 74
76 } // namespace ash 75 } // namespace ash
77 76
78 #endif // UI_AURA_CURSOR_MANAGER_H_ 77 #endif // UI_AURA_CURSOR_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698