Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: ppapi/c/ppb_input_event.h

Issue 18671004: PPAPI: Move IMEInputEvent and TextInput to stable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing one comment Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/c/pp_macros.h ('k') | ppapi/c/ppb_text_input_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/c/ppb_input_event.h
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index 35ef6be3633e5c25850d75e0462dcabb56e2c313..2624f0b96189e40537a8f6e01a190333d332114d 100644
--- a/ppapi/c/ppb_input_event.h
+++ b/ppapi/c/ppb_input_event.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_input_event.idl modified Thu Mar 28 10:51:06 2013. */
+/* From ppb_input_event.idl modified Tue Jul 23 19:23:51 2013. */
#ifndef PPAPI_C_PPB_INPUT_EVENT_H_
#define PPAPI_C_PPB_INPUT_EVENT_H_
@@ -35,6 +35,9 @@
#define PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 "PPB_TouchInputEvent;1.0"
#define PPB_TOUCH_INPUT_EVENT_INTERFACE PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0
+#define PPB_IME_INPUT_EVENT_INTERFACE_1_0 "PPB_IMEInputEvent;1.0"
+#define PPB_IME_INPUT_EVENT_INTERFACE PPB_IME_INPUT_EVENT_INTERFACE_1_0
+
/**
* @file
* This file defines the Input Event interfaces.
@@ -889,6 +892,127 @@ struct PPB_TouchInputEvent_1_0 {
};
typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent;
+
+struct PPB_IMEInputEvent_1_0 {
+ /**
+ * Create() creates an IME input event with the given parameters. Normally
+ * you will get an IME event passed through the <code>HandleInputEvent</code>
+ * and will not need to create them, but some applications may want to create
+ * their own for internal use.
+ *
+ * @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. The type must be one of the IME event types.
+ *
+ * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
+ * when the event occurred.
+ *
+ * @param[in] text The string returned by <code>GetText</code>.
+ *
+ * @param[in] segment_number The number returned by
+ * <code>GetSegmentNumber</code>.
+ *
+ * @param[in] segment_offsets The array of numbers returned by
+ * <code>GetSegmentOffset</code>. If <code>segment_number</code> is zero,
+ * the number of elements of the array should be zero. If
+ * <code>segment_number</code> is non-zero, the length of the array must be
+ * <code>segment_number</code> + 1.
+ *
+ * @param[in] target_segment The number returned by
+ * <code>GetTargetSegment</code>.
+ *
+ * @param[in] selection_start The start index returned by
+ * <code>GetSelection</code>.
+ *
+ * @param[in] selection_end The end index returned by
+ * <code>GetSelection</code>.
+ *
+ * @return A <code>PP_Resource</code> containing the new IME input event.
+ */
+ PP_Resource (*Create)(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ struct PP_Var text,
+ uint32_t segment_number,
+ const uint32_t segment_offsets[],
+ int32_t target_segment,
+ uint32_t selection_start,
+ uint32_t selection_end);
+ /**
+ * IsIMEInputEvent() determines if a resource is an IME event.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to an event.
+ *
+ * @return <code>PP_TRUE</code> if the given resource is a valid input event.
+ */
+ PP_Bool (*IsIMEInputEvent)(PP_Resource resource);
+ /**
+ * GetText() returns the composition text as a UTF-8 string for the given IME
+ * event.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @return A string var representing the composition text. For non-IME input
+ * events the return value will be an undefined var.
+ */
+ struct PP_Var (*GetText)(PP_Resource ime_event);
+ /**
+ * GetSegmentNumber() returns the number of segments in the composition text.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @return The number of segments. For events other than COMPOSITION_UPDATE,
+ * returns 0.
+ */
+ uint32_t (*GetSegmentNumber)(PP_Resource ime_event);
+ /**
+ * GetSegmentOffset() returns the position of the index-th segmentation point
+ * in the composition text. The position is given by a byte-offset (not a
+ * character-offset) of the string returned by GetText(). It always satisfies
+ * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1)
+ * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()).
+ * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range
+ * of the i-th segment, and hence GetSegmentNumber() can be a valid argument
+ * to this function instead of an off-by-1 error.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @param[in] index An integer indicating a segment.
+ *
+ * @return The byte-offset of the segmentation point. If the event is not
+ * COMPOSITION_UPDATE or index is out of range, returns 0.
+ */
+ uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index);
+ /**
+ * GetTargetSegment() returns the index of the current target segment of
+ * composition.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @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)(PP_Resource ime_event);
+ /**
+ * GetSelection() returns the range selected by caret in the composition text.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @param[out] start The start position of the current selection.
+ *
+ * @param[out] end The end position of the current selection.
+ */
+ void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end);
+};
+
+typedef struct PPB_IMEInputEvent_1_0 PPB_IMEInputEvent;
/**
* @}
*/
« no previous file with comments | « ppapi/c/pp_macros.h ('k') | ppapi/c/ppb_text_input_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698