1# inputmethod_cursor_info_capi.h 2<!--Kit: IME Kit--> 3<!--Subsystem: MiscServices--> 4<!--Owner: @illybyy--> 5<!--Designer: @andeszhang--> 6<!--Tester: @murphy1984--> 7<!--Adviser: @zhang_yixin13--> 8 9## 概述 10 11提供光标信息对象的创建、销毁与读写方法。 12 13**引用文件:** <inputmethod/inputmethod_cursor_info_capi.h> 14 15**库:** libohinputmethod.so 16 17**系统能力:** SystemCapability.MiscServices.InputMethodFramework 18 19**起始版本:** 12 20 21**相关模块:** [InputMethod](capi-inputmethod.md) 22 23## 汇总 24 25### 结构体 26 27| 名称 | typedef关键字 | 描述 | 28| -- | -- | -- | 29| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) | InputMethod_CursorInfo | 光标信息。光标的坐标位置、宽度和高度。 | 30 31### 函数 32 33| 名称 | 描述 | 34| -- |--------------------------------------------| 35| [InputMethod_CursorInfo *OH_CursorInfo_Create(double left, double top, double width, double height)](#oh_cursorinfo_create) | 创建一个新的[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例。 | 36| [void OH_CursorInfo_Destroy(InputMethod_CursorInfo *cursorInfo)](#oh_cursorinfo_destroy) | 销毁一个[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例。 | 37| [InputMethod_ErrorCode OH_CursorInfo_SetRect(InputMethod_CursorInfo *cursorInfo, double left, double top, double width, double height)](#oh_cursorinfo_setrect) | 设置光标信息内容。 | 38| [InputMethod_ErrorCode OH_CursorInfo_GetRect(InputMethod_CursorInfo *cursorInfo, double *left, double *top, double *width, double *height)](#oh_cursorinfo_getrect) | 获取光标信息内容。 | 39 40## 函数说明 41 42### OH_CursorInfo_Create() 43 44``` 45InputMethod_CursorInfo *OH_CursorInfo_Create(double left, double top, double width, double height) 46``` 47 48**描述** 49 50创建一个新的[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例。 51 52**起始版本:** 12 53 54 55**参数:** 56 57| 参数项 | 描述 | 58| -- | -- | 59| double left | 光标靠左点与物理屏幕左侧距离的绝对值。 | 60| double top | 光标顶点与物理屏幕上侧距离的绝对值。 | 61| double width | 宽度。 | 62| double height | 高度。 | 63 64**返回:** 65 66| 类型 | 说明 | 67| -- | -- | 68| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) * | 如果创建成功,返回一个指向新创建的[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例的指针。<br> 成功时返回实例。如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。 | 69 70### OH_CursorInfo_Destroy() 71 72``` 73void OH_CursorInfo_Destroy(InputMethod_CursorInfo *cursorInfo) 74``` 75 76**描述** 77 78销毁一个[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例。 79 80**起始版本:** 12 81 82 83**参数:** 84 85| 参数项 | 描述 | 86| -- | -- | 87| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) *cursorInfo | 表示指向即将被销毁的[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例的指针。 | 88 89### OH_CursorInfo_SetRect() 90 91``` 92InputMethod_ErrorCode OH_CursorInfo_SetRect(InputMethod_CursorInfo *cursorInfo, double left, double top, double width, double height) 93``` 94 95**描述** 96 97设置光标信息内容。 98 99**起始版本:** 12 100 101 102**参数:** 103 104| 参数项 | 描述 | 105| -- | -- | 106| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) *cursorInfo | 表示指向[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例的指针。 | 107| double left | 光标靠左点与物理屏幕左侧距离的绝对值。 | 108| double top | 光标顶点与物理屏幕上侧距离的绝对值。 | 109| double width | 宽度。 | 110| double height | 高度。 | 111 112**返回:** 113 114| 类型 | 说明 | 115| -- | -- | 116| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br> [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br> [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考 [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 | 117 118### OH_CursorInfo_GetRect() 119 120``` 121InputMethod_ErrorCode OH_CursorInfo_GetRect(InputMethod_CursorInfo *cursorInfo, double *left, double *top, double *width, double *height) 122``` 123 124**描述** 125 126获取光标信息内容。 127 128**起始版本:** 12 129 130 131**参数:** 132 133| 参数项 | 描述 | 134| -- | -- | 135| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) *cursorInfo | 表示指向[InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md)实例的指针。 | 136| double *left | 靠左点与物理屏幕左侧距离的绝对值。 | 137| double *top | 顶点与物理屏幕上侧距离的绝对值。 | 138| double *width | 宽度。 | 139| double *height | 高度。 | 140 141**返回:** 142 143| 类型 | 说明 | 144| -- | -- | 145| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br> [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br> [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考 [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 | 146 147 148