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 PPAPI_CPP_MOUSE_LOCK_H_ | 5 #ifndef PPAPI_CPP_MOUSE_LOCK_H_ |
6 #define PPAPI_CPP_MOUSE_LOCK_H_ | 6 #define PPAPI_CPP_MOUSE_LOCK_H_ |
7 | 7 |
8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
9 | 9 |
10 /// @file | 10 /// @file |
11 /// This file defines the API for locking the target of mouse events to a | 11 /// This file defines the API for locking the target of mouse events to a |
12 /// specific module instance. | 12 /// specific module instance. |
13 | 13 |
14 namespace pp { | 14 namespace pp { |
15 | 15 |
16 class CompletionCallback; | 16 class CompletionCallback; |
17 class Instance; | 17 class Instance; |
18 | 18 |
19 /// This class allows you to associate the <codee>PPP_MouseLock</code> and | 19 /// This class allows you to associate the <code>PPP_MouseLock</code> and |
20 /// <code>PPB_MouseLock</code> C-based interfaces with an object. It associates | 20 /// <code>PPB_MouseLock</code> C-based interfaces with an object. It associates |
21 /// itself with the given instance, and registers as the global handler for | 21 /// itself with the given instance, and registers as the global handler for |
22 /// handling the <code>PPP_MouseLock</code> interface that the browser calls. | 22 /// handling the <code>PPP_MouseLock</code> interface that the browser calls. |
23 /// | 23 /// |
24 /// You would typically use this class by inheritance on your instance or by | 24 /// You would typically use this class by inheritance on your instance or by |
25 /// composition. | 25 /// composition. |
26 /// | 26 /// |
27 /// <strong>Example (inheritance):</strong> | 27 /// <strong>Example (inheritance):</strong> |
28 /// <code> | 28 /// <code> |
29 /// class MyInstance : public pp::Instance, public pp::MouseLock { | 29 /// class MyInstance : public pp::Instance, public pp::MouseLock { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 /// reports the last known mouse position just as mouse lock was | 70 /// reports the last known mouse position just as mouse lock was |
71 /// entered. The <code>GetMovement()</code> function provides relative | 71 /// entered. The <code>GetMovement()</code> function provides relative |
72 /// movement information indicating what the change in position of the mouse | 72 /// movement information indicating what the change in position of the mouse |
73 /// would be had it not been locked. | 73 /// would be had it not been locked. |
74 /// | 74 /// |
75 /// The browser may revoke the mouse lock for reasons including (but not | 75 /// The browser may revoke the mouse lock for reasons including (but not |
76 /// limited to) the user pressing the ESC key, the user activating another | 76 /// limited to) the user pressing the ESC key, the user activating another |
77 /// program using a reserved keystroke (e.g. ALT+TAB), or some other system | 77 /// program using a reserved keystroke (e.g. ALT+TAB), or some other system |
78 /// event. | 78 /// event. |
79 /// | 79 /// |
80 /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 80 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
81 /// completion. | 81 /// completion. |
82 /// | 82 /// |
83 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 83 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
84 int32_t LockMouse(const CompletionCallback& cc); | 84 int32_t LockMouse(const CompletionCallback& cc); |
85 | 85 |
86 /// UnlockMouse causes the mouse to be unlocked, allowing it to track user | 86 /// UnlockMouse causes the mouse to be unlocked, allowing it to track user |
87 /// movement again. This is an asynchronous operation. The module instance | 87 /// movement again. This is an asynchronous operation. The module instance |
88 /// will be notified using the <code>PPP_MouseLock</code> interface when it | 88 /// will be notified using the <code>PPP_MouseLock</code> interface when it |
89 /// has lost the mouse lock. | 89 /// has lost the mouse lock. |
90 void UnlockMouse(); | 90 void UnlockMouse(); |
91 | 91 |
92 private: | 92 private: |
93 Instance* associated_instance_; | 93 Instance* associated_instance_; |
94 }; | 94 }; |
95 | 95 |
96 } // namespace pp | 96 } // namespace pp |
97 | 97 |
98 #endif // PPAPI_CPP_MOUSE_LOCK_H_ | 98 #endif // PPAPI_CPP_MOUSE_LOCK_H_ |
OLD | NEW |