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.
5 #ifndef UI_AURA_CLIENT_CURSOR_CLIENT_H_
6 #define UI_AURA_CLIENT_CURSOR_CLIENT_H_
8 #include "base/string16.h"
9 #include "ui/aura/aura_export.h"
10 #include "ui/gfx/native_widget_types.h"
20 // An interface that receives cursor change events.
21 class AURA_EXPORT CursorClient
{
23 // Notes that |window| has requested the change to |cursor|.
24 virtual void SetCursor(gfx::NativeCursor cursor
) = 0;
26 // Shows the cursor. This does not take effect When mouse events are disabled.
27 virtual void ShowCursor() = 0;
29 // Hides the cursor. Mouse events keep being sent even when the cursor is
31 virtual void HideCursor() = 0;
33 // Gets whether the cursor is visible.
34 virtual bool IsCursorVisible() const = 0;
36 // Makes mouse events start being sent and shows the cursor if it was hidden
37 // with DisableMouseEvents.
38 virtual void EnableMouseEvents() = 0;
40 // Makes mouse events stop being sent and hides the cursor if it is visible.
41 virtual void DisableMouseEvents() = 0;
43 // Returns true if mouse events are enabled.
44 virtual bool IsMouseEventsEnabled() const = 0;
46 // Sets the display for the cursor.
47 virtual void SetDisplay(const gfx::Display
& display
) = 0;
49 // Locks the cursor change. The cursor type, cursor visibility, and mouse
50 // events enable state never change as long as lock is held by anyone.
51 virtual void LockCursor() = 0;
53 // Unlocks the cursor change. If all the locks are released, the cursor type,
54 // cursor visibility, and mouse events enable state are restored to the ones
55 // set by the lastest call of SetCursor, ShowCursor/HideCursor, and
56 // EnableMouseEvents/DisableMouseEvents.
57 virtual void UnlockCursor() = 0;
59 // Used to pass the cursor resource module name to the cursor loader. This is
60 // typically used to load non system cursors.
61 virtual void SetCursorResourceModule(const string16
& module_name
) = 0;
64 virtual ~CursorClient() {}
67 // Sets/Gets the activation client for the specified window.
68 AURA_EXPORT
void SetCursorClient(Window
* window
,
69 CursorClient
* client
);
70 AURA_EXPORT CursorClient
* GetCursorClient(Window
* window
);
75 #endif // UI_AURA_CLIENT_CURSOR_CLIENT_H_