OLD | NEW |
(Empty) | |
| 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. |
| 4 */ |
| 5 |
| 6 /* From ppb_text_input_controller.idl modified Sat Jul 27 00:04:53 2013. */ |
| 7 |
| 8 #ifndef PPAPI_C_PPB_TEXT_INPUT_CONTROLLER_H_ |
| 9 #define PPAPI_C_PPB_TEXT_INPUT_CONTROLLER_H_ |
| 10 |
| 11 #include "ppapi/c/dev/ppb_text_input_dev.h" |
| 12 #include "ppapi/c/pp_bool.h" |
| 13 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_macros.h" |
| 15 #include "ppapi/c/pp_point.h" |
| 16 #include "ppapi/c/pp_rect.h" |
| 17 #include "ppapi/c/pp_size.h" |
| 18 #include "ppapi/c/pp_stdint.h" |
| 19 #include "ppapi/c/pp_var.h" |
| 20 |
| 21 #define PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0 "PPB_TextInputController;1.0" |
| 22 #define PPB_TEXTINPUTCONTROLLER_INTERFACE PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0 |
| 23 |
| 24 /** |
| 25 * @file |
| 26 * This file defines the <code>PPB_TextInputController</code> interface. |
| 27 */ |
| 28 |
| 29 |
| 30 /** |
| 31 * @addtogroup Interfaces |
| 32 * @{ |
| 33 */ |
| 34 /** |
| 35 * <code>PPB_TextInputController</code> provides a set of functions for giving |
| 36 * hints to the browser about the text input status of plugins, and functions |
| 37 * for controlling input method editors (IMEs). |
| 38 */ |
| 39 struct PPB_TextInputController_1_0 { |
| 40 /** |
| 41 * Informs the browser about the current text input mode of the plugin. |
| 42 * Typical use of this information in the browser is to properly |
| 43 * display/suppress tools for supporting text inputs (such as virtual |
| 44 * keyboards in touch screen based devices, or input method editors often |
| 45 * used for composing East Asian characters). |
| 46 */ |
| 47 void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type); |
| 48 /** |
| 49 * Informs the browser about the coordinates of the text input caret area. |
| 50 * Typical use of this information in the browser is to layout IME windows |
| 51 * etc. |
| 52 */ |
| 53 void (*UpdateCaretPosition)(PP_Instance instance, |
| 54 const struct PP_Rect* caret); |
| 55 /** |
| 56 * Cancels the current composition in IME. |
| 57 */ |
| 58 void (*CancelCompositionText)(PP_Instance instance); |
| 59 /** |
| 60 * Informs the browser about the current text selection and surrounding |
| 61 * text. <code>text</code> is a UTF-8 string that contains the current range |
| 62 * of text selection in the plugin. <code>caret</code> is the byte-index of |
| 63 * the caret position within <code>text</code>. <code>anchor</code> is the |
| 64 * byte-index of the anchor position (i.e., if a range of text is selected, |
| 65 * it is the other edge of selection different from <code>caret</code>. If |
| 66 * there are no selection, <code>anchor</code> is equal to <code>caret</code>. |
| 67 * |
| 68 * Typical use of this information in the browser is to enable "reconversion" |
| 69 * features of IME that puts back the already committed text into the |
| 70 * pre-commit composition state. Another use is to improve the precision |
| 71 * of suggestion of IME by taking the context into account (e.g., if the caret |
| 72 * looks to be on the beginning of a sentence, suggest capital letters in a |
| 73 * virtual keyboard). |
| 74 * |
| 75 * When the focus is not on text, call this function setting <code>text</code> |
| 76 * to an empty string and <code>caret</code> and <code>anchor</code> to zero. |
| 77 * Also, the plugin should send the empty text when it does not want to reveal |
| 78 * the selection to IME (e.g., when the surrounding text is containing |
| 79 * password text). |
| 80 */ |
| 81 void (*UpdateSurroundingText)(PP_Instance instance, |
| 82 struct PP_Var text, |
| 83 uint32_t caret, |
| 84 uint32_t anchor); |
| 85 }; |
| 86 |
| 87 typedef struct PPB_TextInputController_1_0 PPB_TextInputController; |
| 88 /** |
| 89 * @} |
| 90 */ |
| 91 |
| 92 #endif /* PPAPI_C_PPB_TEXT_INPUT_CONTROLLER_H_ */ |
| 93 |
OLD | NEW |