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.
4 */
5
6/* From dev/ppb_cursor_control_dev.idl modified Fri Nov 18 15:58:00 2011. */
7
8#ifndef PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_
9#define PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_
10
11#include "ppapi/c/dev/pp_cursor_type_dev.h"
12#include "ppapi/c/pp_bool.h"
13#include "ppapi/c/pp_instance.h"
14#include "ppapi/c/pp_macros.h"
15#include "ppapi/c/pp_point.h"
16#include "ppapi/c/pp_resource.h"
17#include "ppapi/c/pp_stdint.h"
18
19#define PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4 "PPB_CursorControl(Dev);0.4"
20#define PPB_CURSOR_CONTROL_DEV_INTERFACE PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4
21
22/**
23 * @file
24 * This file defines the <code>PPB_CursorControl_Dev</code> interface
25 * implemented by the browser for controlling the cursor.
26 */
27
28
29/**
30 * @addtogroup Interfaces
31 * @{
32 */
33struct PPB_CursorControl_Dev_0_4 {
34  /**
35   * Set a cursor.  If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image"
36   * must be an ImageData resource containing the cursor and "hot_spot" must
37   * contain the offset within that image that refers to the cursor's position.
38   */
39  PP_Bool (*SetCursor)(PP_Instance instance,
40                       enum PP_CursorType_Dev type,
41                       PP_Resource custom_image,
42                       const struct PP_Point* hot_spot);
43  /**
44   * This method causes the cursor to be moved to the center of the
45   * instance and be locked, preventing the user from moving it.
46   * The cursor is implicitly hidden from the user while locked.
47   * Cursor lock may only be requested in response to a
48   * PP_InputEvent_MouseDown, and then only if the event was generated via
49   * user gesture.
50   *
51   * While the cursor is locked, any movement of the mouse will
52   * generate a PP_InputEvent_Type_MouseMove, whose x and y values
53   * indicate the position the cursor would have been moved to had
54   * the cursor not been locked, and had the screen been infinite in size.
55   *
56   * The browser may revoke cursor lock for reasons including but not
57   * limited to the user pressing the ESC key, the user activating
58   * another program via a reserved keystroke (e.g., ALT+TAB), or
59   * some other system event.
60   *
61   * Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise.
62   */
63  PP_Bool (*LockCursor)(PP_Instance instance);
64  /**
65   * Causes the cursor to be unlocked, allowing it to track user
66   * movement again.
67   */
68  PP_Bool (*UnlockCursor)(PP_Instance instance);
69  /**
70   * Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise.
71   */
72  PP_Bool (*HasCursorLock)(PP_Instance instance);
73  /**
74   * Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise.
75   */
76  PP_Bool (*CanLockCursor)(PP_Instance instance);
77};
78
79typedef struct PPB_CursorControl_Dev_0_4 PPB_CursorControl_Dev;
80/**
81 * @}
82 */
83
84#endif  /* PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ */
85
86