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## Overview 10 11Provides methods for creating, destroying, reading, and writing cursor information objects. 12 13**File to include**: <inputmethod/inputmethod_cursor_info_capi.h> 14 15**Library**: libohinputmethod.so 16 17**System capability**: SystemCapability.MiscServices.InputMethodFramework 18 19**Since**: 12 20 21**Related module**: [InputMethod](capi-inputmethod.md) 22 23## Summary 24 25### Structs 26 27| Name| typedef Keyword| Description| 28| -- | -- | -- | 29| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) | InputMethod_CursorInfo | Represents the cursor information, including the coordinates, width, and height of the cursor.| 30 31### Function 32 33| Name| Description | 34| -- |--------------------------------------------| 35| [InputMethod_CursorInfo *OH_CursorInfo_Create(double left, double top, double width, double height)](#oh_cursorinfo_create) | Creates an [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance.| 36| [void OH_CursorInfo_Destroy(InputMethod_CursorInfo *cursorInfo)](#oh_cursorinfo_destroy) | Destroys an [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance. | 37| [InputMethod_ErrorCode OH_CursorInfo_SetRect(InputMethod_CursorInfo *cursorInfo, double left, double top, double width, double height)](#oh_cursorinfo_setrect) | Sets the cursor information. | 38| [InputMethod_ErrorCode OH_CursorInfo_GetRect(InputMethod_CursorInfo *cursorInfo, double *left, double *top, double *width, double *height)](#oh_cursorinfo_getrect) | Obtains the cursor information. | 39 40## Function Description 41 42### OH_CursorInfo_Create() 43 44``` 45InputMethod_CursorInfo *OH_CursorInfo_Create(double left, double top, double width, double height) 46``` 47 48**Description** 49 50Creates an [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance. 51 52**Since**: 12 53 54 55**Parameters** 56 57| Name| Description| 58| -- | -- | 59| double left | Absolute value of the distance between the cursor's leftmost point and the left edge of the physical screen.| 60| double top | Absolute value of the distance between the cursor's top vertex and the top edge of the physical screen.| 61| double width | Width.| 62| double height | Height.| 63 64**Returns** 65 66| Type| Description| 67| -- | -- | 68| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) * | If the operation is successful, a pointer to the created [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance is returned.<br> If the operation failed, **NULL** is returned, which may be caused by insufficient application address space.| 69 70### OH_CursorInfo_Destroy() 71 72``` 73void OH_CursorInfo_Destroy(InputMethod_CursorInfo *cursorInfo) 74``` 75 76**Description** 77 78Destroys an [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance. 79 80**Since**: 12 81 82 83**Parameters** 84 85| Name| Description| 86| -- | -- | 87| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) *cursorInfo | Pointer to the [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance to be destroyed.| 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**Description** 96 97Sets the cursor information. 98 99**Since**: 12 100 101 102**Parameters** 103 104| Name| Description| 105| -- | -- | 106| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) *cursorInfo | Pointer to the [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance.| 107| double left | Absolute value of the distance between the cursor's leftmost point and the left edge of the physical screen.| 108| double top | Absolute value of the distance between the cursor's top vertex and the top edge of the physical screen.| 109| double width | Width.| 110| double height | Height.| 111 112**Returns** 113 114| Type| Description| 115| -- | -- | 116| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | An error code.<br> [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - Success.<br> [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - An unexpected null pointer.<br> For details about the error codes, see [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**Description** 125 126Obtains the cursor information. 127 128**Since**: 12 129 130 131**Parameters** 132 133| Name| Description| 134| -- | -- | 135| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) *cursorInfo | Pointer to the [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) instance.| 136| double *left | Absolute value of the distance between the cursor's leftmost point and the left edge of the physical screen.| 137| double *top | Absolute value of the distance between the cursor's top vertex and the top edge of the physical screen.| 138| double *width | Width.| 139| double *height | Height.| 140 141**Returns** 142 143| Type| Description| 144| -- | -- | 145| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | An error code.<br> [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - Success.<br> [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - An unexpected null pointer.<br> For details about the error codes, see [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode).| 146