OLD | NEW |
(Empty) | |
| 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 |
| 3 * found in the LICENSE file. |
| 4 */ |
| 5 |
| 6 #ifndef PPAPI_C_DEV_PPB_INPUT_EVENT_DEV_H_ |
| 7 #define PPAPI_C_DEV_PPB_INPUT_EVENT_DEV_H_ |
| 8 |
| 9 #include "ppapi/c/pp_bool.h" |
| 10 #include "ppapi/c/pp_instance.h" |
| 11 #include "ppapi/c/pp_macros.h" |
| 12 #include "ppapi/c/pp_point.h" |
| 13 #include "ppapi/c/pp_resource.h" |
| 14 #include "ppapi/c/pp_stdint.h" |
| 15 #include "ppapi/c/pp_time.h" |
| 16 #include "ppapi/c/ppb_input_event.h" |
| 17 |
| 18 #define PPB_MOUSE_INPUT_EVENT_DEV_INTERFACE_1_1 "PPB_MouseInputEvent(Dev);1.1" |
| 19 #define PPB_MOUSE_INPUT_EVENT_DEV_INTERFACE \ |
| 20 PPB_MOUSE_INPUT_EVENT_DEV_INTERFACE_1_1 |
| 21 |
| 22 /** |
| 23 * The <code>PPB_MouseInputEvent</code> interface contains pointers to several |
| 24 * functions related to mouse input events. |
| 25 */ |
| 26 struct PPB_MouseInputEvent_Dev { |
| 27 /** |
| 28 * Create() creates a mouse input event with the given parameters. Normally |
| 29 * you will get a mouse event passed through the |
| 30 * <code>HandleInputEvent</code> and will not need to create them, but some |
| 31 * applications may want to create their own for internal use. The type must |
| 32 * be one of the mouse event types. |
| 33 * |
| 34 * @param[in] instance The instance for which this event occurred. |
| 35 * |
| 36 * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 37 * input event. |
| 38 * |
| 39 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 40 * when the event occurred. |
| 41 * |
| 42 * @param[in] modifiers A bit field combination of the |
| 43 * <code>PP_InputEvent_Modifier</code> flags. |
| 44 * |
| 45 * @param[in] mouse_button The button that changed for mouse down or up |
| 46 * events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for |
| 47 * mouse move, enter, and leave events. |
| 48 * |
| 49 * @param[in] mouse_position A <code>Point</code> containing the x and y |
| 50 * position of the mouse when the event occurred. |
| 51 * |
| 52 * @param[in] mouse_movement The change in position of the mouse. |
| 53 * |
| 54 * @return A <code>PP_Resource</code> containing the new mouse input event. |
| 55 */ |
| 56 PP_Resource (*Create)(PP_Instance instance, |
| 57 PP_InputEvent_Type type, |
| 58 PP_TimeTicks time_stamp, |
| 59 uint32_t modifiers, |
| 60 PP_InputEvent_MouseButton mouse_button, |
| 61 const struct PP_Point* mouse_position, |
| 62 int32_t click_count, |
| 63 const struct PP_Point* mouse_movement); |
| 64 /** |
| 65 * IsMouseInputEvent() determines if a resource is a mouse event. |
| 66 * |
| 67 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
| 68 * |
| 69 * @return <code>PP_TRUE</code> if the given resource is a valid mouse input |
| 70 * event, otherwise <code>PP_FALSE</code>. |
| 71 */ |
| 72 PP_Bool (*IsMouseInputEvent)(PP_Resource resource); |
| 73 /** |
| 74 * GetButton() returns the mouse button that generated a mouse down or up |
| 75 * event. |
| 76 * |
| 77 * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a |
| 78 * mouse event. |
| 79 * |
| 80 * @return The mouse button associated with mouse down and up events. This |
| 81 * value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move, |
| 82 * enter, and leave events, and for all non-mouse events. |
| 83 */ |
| 84 PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); |
| 85 /** |
| 86 * GetPosition() returns the pixel location of a mouse input event. When |
| 87 * the mouse is locked, it returns the last known mouse position just as |
| 88 * mouse lock was entered. |
| 89 * |
| 90 * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a |
| 91 * mouse event. |
| 92 * |
| 93 * @return The point associated with the mouse event, relative to the upper- |
| 94 * left of the instance receiving the event. These values can be negative for |
| 95 * mouse drags. The return value will be (0, 0) for non-mouse events. |
| 96 */ |
| 97 struct PP_Point (*GetPosition)(PP_Resource mouse_event); |
| 98 /** |
| 99 * TODO(brettw) figure out exactly what this means. |
| 100 */ |
| 101 int32_t (*GetClickCount)(PP_Resource mouse_event); |
| 102 /** |
| 103 * Returns the change in position of the mouse. When the mouse is locked, |
| 104 * although the mouse position doesn't actually change, this function |
| 105 * still provides movement information, which indicates what the change in |
| 106 * position would be had the mouse not been locked. |
| 107 * |
| 108 * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a |
| 109 * mouse event. |
| 110 * |
| 111 * @return The change in position of the mouse, relative to the previous |
| 112 * position. |
| 113 */ |
| 114 struct PP_Point (*GetMovement)(PP_Resource mouse_event); |
| 115 }; |
| 116 |
| 117 #endif /* PPAPI_C_DEV_PPB_INPUT_EVENT_DEV_H_ */ |
| 118 |
OLD | NEW |