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

Unified Diff: ppapi/c/ppb_input_event.h

Issue 7882004: Declarations for Pepper IME API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split GetSegments into two functions, and improve comments and style. Created 9 years, 3 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
Index: ppapi/c/ppb_input_event.h
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index 8a73279e4ebc51591764733afdd94b3da838d0f6..62f3cc6971456c011e9a92072046f10a09857661 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 Wed Aug 24 09:43:38 2011. */
+/* From ppb_input_event.idl modified Tue Sep 13 18:18:57 2011. */
#ifndef PPAPI_C_PPB_INPUT_EVENT_H_
#define PPAPI_C_PPB_INPUT_EVENT_H_
@@ -31,6 +31,13 @@
#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \
PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0
+#define PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_0 \
+ "PPB_CompositionInputEvent;1.0"
+#define PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_2 \
+ "PPB_CompositionInputEvent;1.2"
+#define PPB_COMPOSITION_INPUT_EVENT_INTERFACE \
+ PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_2
+
/**
* @file
* This file defines the Input Event interfaces.
@@ -117,7 +124,31 @@ typedef enum {
*
* Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
*/
- PP_INPUTEVENT_TYPE_CONTEXTMENU = 10
+ PP_INPUTEVENT_TYPE_CONTEXTMENU = 10,
+ /**
+ * Notification that an input method composition process has just started.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class.
+ */
+ PP_INPUTEVENT_TYPE_COMPOSITION_START = 11,
+ /**
+ * Notification that the input method composition string is updated.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class.
+ */
+ PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE = 12,
+ /**
+ * Notification that an input method composition process has completed.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class.
+ */
+ PP_INPUTEVENT_TYPE_COMPOSITION_END = 13,
+ /**
+ * Notification that an input method committed a string.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class.
+ */
+ PP_INPUTEVENT_TYPE_IME_TEXT = 14
} PP_InputEvent_Type;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4);
@@ -205,11 +236,11 @@ typedef enum {
*/
PP_INPUTEVENT_CLASS_TOUCH = 1 << 3,
/**
- * Identifies IME composition input events.
+ * Identifies composition input events.
*
- * Request this input event class if you allow on-the-spot IME input.
+ * Request this input event class if you allow on-the-spot composition.
*/
- PP_INPUTEVENT_CLASS_IME = 1 << 4
+ PP_INPUTEVENT_CLASS_COMPOSITION = 1 << 4
} PP_InputEvent_Class;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4);
/**
@@ -674,6 +705,91 @@ struct PPB_KeyboardInputEvent {
*/
struct PP_Var (*GetCharacterText)(PP_Resource character_event);
};
+
+/**
+ * The <code>PPB_CompositionInputEvent</code> interface contains pointers to
+ * several functions related to composition input events.
+ */
+struct PPB_CompositionInputEvent {
+ /**
+ * IsCompositionInputEvent() determines if a resource is a composition 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 (*IsCompositionInputEvent)(PP_Resource resource);
+ /**
+ * GetText() returns the composition text as a UTF-8 string for the given
+ * composition event.
+ *
+ * @param[in] composition_event A <code>PP_Resource</code> corresponding to a
+ * composition event.
+ *
+ * @return A string var representing the composition text. For non-composition
+ * input events the return value will be an undefined var.
+ */
+ struct PP_Var (*GetText)(PP_Resource composition_event);
+ /**
+ * GetSegmentNumber() returns the number of segments in the composition text.
+ *
+ * @param[in] composition_event A <code>PP_Resource</code> corresponding to a
+ * composition event.
+ *
+ * @return The number of segments. For events other than COMPOSITION_UPDATE,
+ * returns 0.
+ */
+ uint32_t (*GetSegmentNumber)(PP_Resource composition_event);
+ /**
+ * GetSegmentAt() 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 <= start < end <= (Length of
+ * GetText()) and start[index] < start[index+1]. When the event is not
+ * COMPOSITION_UPDATE or index >= GetSegmentNumber(), nothing happens.
+ *
+ * @param[in] composition_event A <code>PP_Resource</code> corresponding to a
+ * composition event.
+ *
+ * @param[in] index An integer indicating a segment.
+ *
+ * @param[out] start The start position of the index-th segment.
+ *
+ * @param[out] end The end position of the index-th segment.
+ */
+ void (*GetSegmentAt)(PP_Resource composition_event,
+ uint32_t index,
+ uint32_t* start,
+ uint32_t* end);
+ /**
+ * GetTargetSegment() returns the index of the current target segment of
+ * composition.
+ *
+ * @param[in] composition_event A <code>PP_Resource</code> corresponding to a
+ * composition 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 composition_event);
+ /**
+ * GetSelection() returns the range selected by caret in the composition text.
+ *
+ * @param[in] composition_event A <code>PP_Resource</code> corresponding to a
+ * composition 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 composition_event,
+ uint32_t* start,
+ uint32_t* end);
+};
+
+struct PPB_CompositionInputEvent_1_0 {
+
+};
/**
* @}
*/

Powered by Google App Engine
This is Rietveld 408576698