diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-08 20:28:43 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-08 20:28:43 +0000 |
commit | 33ec505631bcc1cc6709248b97b468fbdf3d5f0a (patch) | |
tree | 4963e5e21af0f8173c5b6353c34209993b5da852 /ppapi/cpp/mouse_cursor.h | |
parent | 41c3696d8ebb37c0b2e0afd0361f0b40bc369483 (diff) | |
download | chromium_src-33ec505631bcc1cc6709248b97b468fbdf3d5f0a.zip chromium_src-33ec505631bcc1cc6709248b97b468fbdf3d5f0a.tar.gz chromium_src-33ec505631bcc1cc6709248b97b468fbdf3d5f0a.tar.bz2 |
Add new MouseCursor interface for setting the mouse cursor.
Remove most of the old cursor control interface. This keeps backwards compat for CursorControl.SetCursor (which just redirects to the new function) to kepe existing users running. None of the other functions on cursor control were implemented, so I removed all the proxying and stuff for them.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/9814015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/mouse_cursor.h')
-rw-r--r-- | ppapi/cpp/mouse_cursor.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/ppapi/cpp/mouse_cursor.h b/ppapi/cpp/mouse_cursor.h new file mode 100644 index 0000000..a54084e --- /dev/null +++ b/ppapi/cpp/mouse_cursor.h @@ -0,0 +1,56 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_MOUSE_CURSOR_H_
+#define PPAPI_CPP_MOUSE_CURSOR_H_
+
+#include "ppapi/c/ppb_mouse_cursor.h"
+#include "ppapi/cpp/image_data.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/point.h"
+
+namespace pp {
+
+class MouseCursor {
+ public:
+ /// Sets the given mouse cursor. The mouse cursor will be in effect whenever
+ /// the mouse is over the given instance until it is set again by another
+ /// call. Note that you can hide the mouse cursor by setting it to the
+ /// <code>PP_MOUSECURSOR_TYPE_NONE</code> type.
+ ///
+ /// This function allows setting both system defined mouse cursors and
+ /// custom cursors. To set a system-defined cursor, pass the type you want
+ /// and set the custom image to a default-constructor ImageData object.
+ /// To set a custom cursor, set the type to
+ /// <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and specify your image and hot
+ /// spot.
+ ///
+ /// @param[in] instance A handle indentifying the instance that the mouse
+ /// cursor will affect.
+ ///
+ /// @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type
+ /// of mouse cursor to show. See <code>ppapi/c/ppb_mouse_cursor.h</code>.
+ ///
+ /// @param[in] image A <code>ImageData</code> object identifying the
+ /// custom image to set when the type is
+ /// <code>PP_MOUSECURSOR_TYPE_CUSTOM</code>. The image must be less than 32
+ /// pixels in each direction and must be of the system's native image format.
+ /// When you are specifying a predefined cursor, this parameter should be a
+ /// default-constructed ImageData.
+ ///
+ /// @param[in] hot_spot When setting a custom cursor, this idenfifies the
+ /// pixel position within the given image of the "hot spot" of the cursor.
+ /// When specifying a stock cursor, this parameter is ignored.
+ ///
+ /// @return true on success, or false if the instance or cursor type
+ /// was invalid or if the image was too large.
+ static bool SetCursor(const InstanceHandle& instance,
+ PP_MouseCursor_Type type,
+ const ImageData& image = ImageData(),
+ const Point& hot_spot = Point(0, 0));
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_MOUSE_CURSOR_H_
|