| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013 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_VIEWS_COREWM_CURSOR_MANAGER_H_ | |
| 6 #define UI_VIEWS_COREWM_CURSOR_MANAGER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/observer_list.h" | |
| 12 #include "ui/aura/client/cursor_client.h" | |
| 13 #include "ui/base/cursor/cursor.h" | |
| 14 #include "ui/gfx/native_widget_types.h" | |
| 15 #include "ui/gfx/point.h" | |
| 16 #include "ui/views/corewm/native_cursor_manager_delegate.h" | |
| 17 #include "ui/views/views_export.h" | |
| 18 | |
| 19 namespace gfx { | |
| 20 class Display; | |
| 21 } | |
| 22 | |
| 23 namespace views { | |
| 24 namespace corewm { | |
| 25 | |
| 26 namespace internal { | |
| 27 class CursorState; | |
| 28 } | |
| 29 | |
| 30 class NativeCursorManager; | |
| 31 | |
| 32 // This class receives requests to change cursor properties, as well as | |
| 33 // requests to queue any further changes until a later time. It sends changes | |
| 34 // to the NativeCursorManager, which communicates back to us when these changes | |
| 35 // were made through the NativeCursorManagerDelegate interface. | |
| 36 class VIEWS_EXPORT CursorManager : public aura::client::CursorClient, | |
| 37 public NativeCursorManagerDelegate { | |
| 38 public: | |
| 39 CursorManager(scoped_ptr<NativeCursorManager> delegate); | |
| 40 virtual ~CursorManager(); | |
| 41 | |
| 42 // Overridden from aura::client::CursorClient: | |
| 43 virtual void SetCursor(gfx::NativeCursor) OVERRIDE; | |
| 44 virtual gfx::NativeCursor GetCursor() const OVERRIDE; | |
| 45 virtual void ShowCursor() OVERRIDE; | |
| 46 virtual void HideCursor() OVERRIDE; | |
| 47 virtual bool IsCursorVisible() const OVERRIDE; | |
| 48 virtual void SetScale(float scale) OVERRIDE; | |
| 49 virtual float GetScale() const OVERRIDE; | |
| 50 virtual void SetCursorSet(ui::CursorSetType cursor_set) OVERRIDE; | |
| 51 virtual ui::CursorSetType GetCursorSet() const OVERRIDE; | |
| 52 virtual void EnableMouseEvents() OVERRIDE; | |
| 53 virtual void DisableMouseEvents() OVERRIDE; | |
| 54 virtual bool IsMouseEventsEnabled() const OVERRIDE; | |
| 55 virtual void SetDisplay(const gfx::Display& display) OVERRIDE; | |
| 56 virtual void LockCursor() OVERRIDE; | |
| 57 virtual void UnlockCursor() OVERRIDE; | |
| 58 virtual bool IsCursorLocked() const OVERRIDE; | |
| 59 virtual void AddObserver( | |
| 60 aura::client::CursorClientObserver* observer) OVERRIDE; | |
| 61 virtual void RemoveObserver( | |
| 62 aura::client::CursorClientObserver* observer) OVERRIDE; | |
| 63 | |
| 64 private: | |
| 65 // Overridden from NativeCursorManagerDelegate: | |
| 66 virtual void CommitCursor(gfx::NativeCursor cursor) OVERRIDE; | |
| 67 virtual void CommitVisibility(bool visible) OVERRIDE; | |
| 68 virtual void CommitScale(float scale) OVERRIDE; | |
| 69 virtual void CommitCursorSet(ui::CursorSetType cursor_set) OVERRIDE; | |
| 70 virtual void CommitMouseEventsEnabled(bool enabled) OVERRIDE; | |
| 71 | |
| 72 scoped_ptr<NativeCursorManager> delegate_; | |
| 73 | |
| 74 // Number of times LockCursor() has been invoked without a corresponding | |
| 75 // UnlockCursor(). | |
| 76 int cursor_lock_count_; | |
| 77 | |
| 78 // The current state of the cursor. | |
| 79 scoped_ptr<internal::CursorState> current_state_; | |
| 80 | |
| 81 // The cursor state to restore when the cursor is unlocked. | |
| 82 scoped_ptr<internal::CursorState> state_on_unlock_; | |
| 83 | |
| 84 ObserverList<aura::client::CursorClientObserver> observers_; | |
| 85 | |
| 86 DISALLOW_COPY_AND_ASSIGN(CursorManager); | |
| 87 }; | |
| 88 | |
| 89 } // namespace corewm | |
| 90 } // namespace views | |
| 91 | |
| 92 #endif // UI_VIEWS_COREWM_CURSOR_MANAGER_H_ | |
| OLD | NEW |