OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_INPUT_EVENT_H_ | 5 #ifndef PPAPI_CPP_INPUT_EVENT_H_ |
6 #define PPAPI_CPP_INPUT_EVENT_H_ | 6 #define PPAPI_CPP_INPUT_EVENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/ppb_input_event.h" | 10 #include "ppapi/c/ppb_input_event.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 /// @param[in] mouse_button The button that changed for mouse down or up | 116 /// @param[in] mouse_button The button that changed for mouse down or up |
117 /// events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for | 117 /// events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for |
118 /// mouse move, enter, and leave events. | 118 /// mouse move, enter, and leave events. |
119 /// | 119 /// |
120 /// @param[in] mouse_position A <code>Point</code> containing the x and y | 120 /// @param[in] mouse_position A <code>Point</code> containing the x and y |
121 /// position of the mouse when the eent occurred. | 121 /// position of the mouse when the eent occurred. |
122 /// | 122 /// |
123 /// @param[in] click_count | 123 /// @param[in] click_count |
124 /// TODO(brettw) figure out exactly what this means. | 124 /// TODO(brettw) figure out exactly what this means. |
125 /// | 125 /// |
126 /// @param[in] mouse_movement The change in position of the mouse. | |
127 MouseInputEvent(Instance* instance, | 126 MouseInputEvent(Instance* instance, |
128 PP_InputEvent_Type type, | 127 PP_InputEvent_Type type, |
129 PP_TimeTicks time_stamp, | 128 PP_TimeTicks time_stamp, |
129 uint32_t modifiers, | |
130 PP_InputEvent_MouseButton mouse_button, | |
131 const Point& mouse_position, | |
132 int32_t click_count); | |
133 | |
134 // @param[in] mouse_movement Currently this parameter is ignored. | |
135 MouseInputEvent(Instance* instance, | |
yzshen1
2011/09/02 23:41:11
The reason why I keep this constructor:
Some pdf-r
| |
136 PP_InputEvent_Type type, | |
137 PP_TimeTicks time_stamp, | |
130 uint32_t modifiers, | 138 uint32_t modifiers, |
131 PP_InputEvent_MouseButton mouse_button, | 139 PP_InputEvent_MouseButton mouse_button, |
132 const Point& mouse_position, | 140 const Point& mouse_position, |
133 int32_t click_count, | 141 int32_t click_count, |
134 const Point& mouse_movement); | 142 const Point& mouse_movement); |
135 | 143 |
136 /// GetButton() returns the mouse position for a mouse input event. | 144 /// GetButton() returns the mouse position for a mouse input event. |
137 /// | 145 /// |
138 /// @return The mouse button associated with mouse down and up events. This | 146 /// @return The mouse button associated with mouse down and up events. This |
139 /// value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave | 147 /// value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave |
140 /// events, and for all non-mouse events. | 148 /// events, and for all non-mouse events. |
141 PP_InputEvent_MouseButton GetButton() const; | 149 PP_InputEvent_MouseButton GetButton() const; |
142 | 150 |
143 /// GetPosition() returns the pixel location of a mouse input event. When | 151 /// GetPosition() returns the pixel location of a mouse input event. |
144 /// the mouse is locked, it returns the last known mouse position just as | |
145 /// mouse lock was entered. | |
146 /// | 152 /// |
147 /// @return The point associated with the mouse event, relative to the upper- | 153 /// @return The point associated with the mouse event, relative to the upper- |
148 /// left of the instance receiving the event. These values can be negative for | 154 /// left of the instance receiving the event. These values can be negative for |
149 /// mouse drags. The return value will be (0, 0) for non-mouse events. | 155 /// mouse drags. The return value will be (0, 0) for non-mouse events. |
150 Point GetPosition() const; | 156 Point GetPosition() const; |
151 | 157 |
152 // TODO(brettw) figure out exactly what this means. | 158 // TODO(brettw) figure out exactly what this means. |
153 int32_t GetClickCount() const; | 159 int32_t GetClickCount() const; |
154 | |
155 /// Returns the change in position of the mouse. When the mouse is locked, | |
156 /// although the mouse position doesn't actually change, this function | |
157 /// still provides movement information, which indicates what the change in | |
158 /// position would be had the mouse not been locked. | |
159 /// | |
160 /// @return The change in position of the mouse, relative to the previous | |
161 /// position. | |
162 Point GetMovement() const; | |
163 }; | 160 }; |
164 | 161 |
165 class WheelInputEvent : public InputEvent { | 162 class WheelInputEvent : public InputEvent { |
166 public: | 163 public: |
167 /// Constructs an is_null() wheel input event object. | 164 /// Constructs an is_null() wheel input event object. |
168 WheelInputEvent(); | 165 WheelInputEvent(); |
169 | 166 |
170 /// This constructor constructs a wheel input event object from the | 167 /// This constructor constructs a wheel input event object from the |
171 /// provided generic input event. If the given event is itself | 168 /// provided generic input event. If the given event is itself |
172 /// is_null() or is not a wheel input event, the wheel object will be | 169 /// is_null() or is not a wheel input event, the wheel object will be |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 /// | 291 /// |
295 /// @return A string var representing a single typed character for character | 292 /// @return A string var representing a single typed character for character |
296 /// input events. For non-character input events the return value will be an | 293 /// input events. For non-character input events the return value will be an |
297 /// undefined var. | 294 /// undefined var. |
298 Var GetCharacterText() const; | 295 Var GetCharacterText() const; |
299 }; | 296 }; |
300 | 297 |
301 } // namespace pp | 298 } // namespace pp |
302 | 299 |
303 #endif // PPAPI_CPP_INPUT_EVENT_H_ | 300 #endif // PPAPI_CPP_INPUT_EVENT_H_ |
OLD | NEW |