| Index: ppapi/cpp/input_event.h
|
| diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h
|
| index da92742c3b026bcfe934a2fcdb572520c40c536a..c6ac0491f6a88e1691a37ffd165a40635cf3273a 100644
|
| --- a/ppapi/cpp/input_event.h
|
| +++ b/ppapi/cpp/input_event.h
|
| @@ -6,6 +6,7 @@
|
| #define PPAPI_CPP_INPUT_EVENT_H_
|
|
|
| #include <string>
|
| +#include <utility>
|
|
|
| #include "ppapi/c/ppb_input_event.h"
|
| #include "ppapi/cpp/resource.h"
|
| @@ -102,13 +103,13 @@ class MouseInputEvent : public InputEvent {
|
| /// This constructor manually constructs a mouse event from the provided
|
| /// parameters.
|
| ///
|
| - /// @param[in] instance The instance for which this event occured.
|
| + /// @param[in] instance The instance for which this event occurred.
|
| ///
|
| /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
|
| /// input event.
|
| ///
|
| /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
|
| - /// when the event occured.
|
| + /// when the event occurred.
|
| ///
|
| /// @param[in] modifiers A bit field combination of the
|
| /// <code>PP_InputEvent_Modifier</code> flags.
|
| @@ -118,7 +119,7 @@ class MouseInputEvent : public InputEvent {
|
| /// mouse move, enter, and leave events.
|
| ///
|
| /// @param[in] mouse_position A <code>Point</code> containing the x and y
|
| - /// position of the mouse when the eent occurred.
|
| + /// position of the mouse when the event occurred.
|
| ///
|
| /// @param[in] click_count
|
| /// TODO(brettw) figure out exactly what this means.
|
| @@ -184,7 +185,7 @@ class WheelInputEvent : public InputEvent {
|
| /// @param[in] instance The instance for which this event occured.
|
| ///
|
| /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
|
| - /// when the event occured.
|
| + /// when the event occurred.
|
| ///
|
| /// @param[in] modifiers A bit field combination of the
|
| /// <code>PP_InputEvent_Modifier</code> flags.
|
| @@ -219,7 +220,7 @@ class WheelInputEvent : public InputEvent {
|
| /// possible, for example, on some trackpads and newer mice that don't have
|
| /// "clicks".
|
| ///
|
| - /// @return The vertial and horizontal scroll values. The units are either in
|
| + /// @return The vertical and horizontal scroll values. The units are either in
|
| /// pixels (when scroll_by_page is false) or pages (when scroll_by_page is
|
| /// true). For example, y = -3 means scroll up 3 pixels when scroll_by_page
|
| /// is false, and scroll up 3 pages when scroll_by_page is true.
|
| @@ -259,20 +260,20 @@ class KeyboardInputEvent : public InputEvent {
|
|
|
| /// Constructs a keyboard input event object from the provided generic input
|
| /// event. If the given event is itself is_null() or is not a keyboard input
|
| - /// event, the keybaord object will be is_null().
|
| + /// event, the keyboard object will be is_null().
|
| ///
|
| /// @param[in] event A generic input event.
|
| explicit KeyboardInputEvent(const InputEvent& event);
|
|
|
| /// Constructs a keyboard input even from the given parameters.
|
| ///
|
| - /// @param[in] instance The instance for which this event occured.
|
| + /// @param[in] instance The instance for which this event occurred.
|
| ///
|
| /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
|
| /// input event.
|
| ///
|
| /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
|
| - /// when the event occured.
|
| + /// when the event occurred.
|
| ///
|
| /// @param[in] modifiers A bit field combination of the
|
| /// <code>PP_InputEvent_Modifier</code> flags.
|
| @@ -302,6 +303,56 @@ class KeyboardInputEvent : public InputEvent {
|
| Var GetCharacterText() const;
|
| };
|
|
|
| +class CompositionInputEvent : public InputEvent {
|
| + public:
|
| + /// Constructs an is_null() composition input event object.
|
| + CompositionInputEvent();
|
| +
|
| + /// Constructs a composition input event object from the provided generic
|
| + /// input event. If the given event is itself is_null() or is not a
|
| + /// composition input event, the composition object will be is_null().
|
| + ///
|
| + /// @param[in] event A generic input event.
|
| + explicit CompositionInputEvent(const InputEvent& event);
|
| +
|
| + /// Returns the composition text as a UTF-8 string for the given composition
|
| + /// event.
|
| + ///
|
| + /// @return A string var representing the composition text. For non-
|
| + /// composition input events the return value will be an undefined var.
|
| + Var GetText() const;
|
| +
|
| + /// Returns the number of segments in the composition text.
|
| + ///
|
| + /// @return The number of segments. For events other than COMPOSITION_UPDATE,
|
| + /// returns 0.
|
| + uint32_t GetSegmentNumber() const;
|
| +
|
| + /// Returns the start and the end position of the index-th segment in the
|
| + /// composition text. The positions are given by byte-indices of the string
|
| + /// GetText(). They always satisfy 0 <= .first < .second <= (Length of
|
| + /// GetText()) and GetSegmentAt(index).first < GetSegmentAt(index+1).first.
|
| + /// When the event is not COMPOSITION_UPDATE or index >= GetSegmentNumber(),
|
| + /// returns (0, 0).
|
| + ///
|
| + /// @param[in] index An integer indicating a segment.
|
| + ///
|
| + /// @return A pair of integers representing the index-th segment.
|
| + std::pair<uint32_t, uint32_t> GetSegmentAt(uint32_t index) const;
|
| +
|
| + /// Returns the index of the current target segment of composition.
|
| + ///
|
| + /// @return An integer indicating the index of the target segment. When there
|
| + /// is no active target segment, or the event is not COMPOSITION_UPDATE,
|
| + /// returns -1.
|
| + int32_t GetTargetSegment() const;
|
| +
|
| + /// Returns the range selected by caret in the composition text.
|
| + ///
|
| + /// @return A pair of integers indicating the selection range.
|
| + std::pair<uint32_t, uint32_t> GetSelection() const;
|
| +};
|
| +
|
| } // namespace pp
|
|
|
| #endif // PPAPI_CPP_INPUT_EVENT_H_
|
|
|