Elim cr-checkbox
[chromium-blink-merge.git] / ppapi / cpp / mouse_cursor.h
blob827d95cdf4e444da61bbebfde8719536dd7c7774
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 PPAPI_CPP_MOUSE_CURSOR_H_
6 #define PPAPI_CPP_MOUSE_CURSOR_H_
8 #include "ppapi/c/ppb_mouse_cursor.h"
9 #include "ppapi/cpp/image_data.h"
10 #include "ppapi/cpp/instance_handle.h"
11 #include "ppapi/cpp/point.h"
13 namespace pp {
15 class MouseCursor {
16 public:
17 /// Sets the given mouse cursor. The mouse cursor will be in effect whenever
18 /// the mouse is over the given instance until it is set again by another
19 /// call. Note that you can hide the mouse cursor by setting it to the
20 /// <code>PP_MOUSECURSOR_TYPE_NONE</code> type.
21 ///
22 /// This function allows setting both system defined mouse cursors and
23 /// custom cursors. To set a system-defined cursor, pass the type you want
24 /// and set the custom image to a default-constructor ImageData object.
25 /// To set a custom cursor, set the type to
26 /// <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and specify your image and hot
27 /// spot.
28 ///
29 /// @param[in] instance A handle identifying the instance that the mouse
30 /// cursor will affect.
31 ///
32 /// @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type
33 /// of mouse cursor to show. See <code>ppapi/c/ppb_mouse_cursor.h</code>.
34 ///
35 /// @param[in] image A <code>ImageData</code> object identifying the
36 /// custom image to set when the type is
37 /// <code>PP_MOUSECURSOR_TYPE_CUSTOM</code>. The image must be less than 32
38 /// pixels in each direction and must be of the system's native image format.
39 /// When you are specifying a predefined cursor, this parameter should be a
40 /// default-constructed ImageData.
41 ///
42 /// @param[in] hot_spot When setting a custom cursor, this identifies the
43 /// pixel position within the given image of the "hot spot" of the cursor.
44 /// When specifying a stock cursor, this parameter is ignored.
45 ///
46 /// @return true on success, or false if the instance or cursor type
47 /// was invalid or if the image was too large.
48 static bool SetCursor(const InstanceHandle& instance,
49 PP_MouseCursor_Type type,
50 const ImageData& image = ImageData(),
51 const Point& hot_spot = Point(0, 0));
54 } // namespace pp
56 #endif // PPAPI_CPP_MOUSE_CURSOR_H_