1/*
2* Copyright (c) 2024 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7*     http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15/**
16 * @addtogroup InputMethod
17 * @{
18 *
19 * @brief InputMethod provides functions to use input methods and develop input methods.
20 *
21 * @since 12
22 */
23
24/**
25 * @file inputmethod_cursor_info_capi.h
26 *
27 * @brief Provides interfaces to manage the cursor information.
28 *
29 * @library libohinputmethod.so
30 * @kit IMEKit
31 * @syscap SystemCapability.MiscServices.InputMethodFramework
32 * @since 12
33 * @version 1.0
34 */
35#ifndef OHOS_INPUTMETHOD_CURSOR_INFO_CAPI_H
36#define OHOS_INPUTMETHOD_CURSOR_INFO_CAPI_H
37#include "inputmethod_types_capi.h"
38#ifdef __cplusplus
39extern "C"{
40#endif /* __cplusplus */
41/**
42 * @brief Define the InputMethod_CursorInfo structure type.
43 *
44 * The coordinates and width and height information of the cursor.
45 *
46 * @since 12
47 */
48typedef struct InputMethod_CursorInfo InputMethod_CursorInfo;
49
50/**
51 * @brief Create a new {@link InputMethod_CursorInfo} instance.
52 *
53 * @param left The left point of the cursor and must be absolute coordinate of the physical screen.
54 * @param top The top point of the cursor and must be absolute coordinate of the physical screen.
55 * @param width The width of the cursor.
56 * @param height The height of the cursor.
57 * @return If the creation succeeds, a pointer to the newly created {@link InputMethod_CursorInfo}
58 * instance is returned. If the creation fails, NULL is returned, possible cause is insufficient memory.
59 * @since 12
60 */
61InputMethod_CursorInfo *OH_CursorInfo_Create(double left, double top, double width, double height);
62
63/**
64 * @brief Destroy a {@link InputMethod_CursorInfo} instance.
65 *
66 * @param cursorInfo Represents a pointer to an {@link InputMethod_CursorInfo} instance which will be destroyed.
67 * @since 12
68 */
69void OH_CursorInfo_Destroy(InputMethod_CursorInfo *cursorInfo);
70
71/**
72 * @brief Set cursor info.
73 *
74 * @param cursorInfo Represents a pointer to an {@link InputMethod_CursorInfo} instance.
75 * @param left The left point of the cursor and must be absolute coordinate of the physical screen.
76 * @param top The top point of the cursor and must be absolute coordinate of the physical screen.
77 * @param width The width of the cursor.
78 * @param height The height of the cursor.
79 * @return Returns a specific error code.
80 *     {@link IME_ERR_OK} - success.
81 *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
82 * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
83 * @since 12
84 */
85InputMethod_ErrorCode OH_CursorInfo_SetRect(
86    InputMethod_CursorInfo *cursorInfo, double left, double top, double width, double height);
87
88/**
89 * @brief Get cursor info.
90 *
91 * @param cursorInfo Represents a pointer to an {@link InputMethod_CursorInfo} instance.
92 * @param left The left point of the cursor and must be absolute coordinate of the physical screen.
93 * @param top The top point of the cursor and must be absolute coordinate of the physical screen.
94 * @param width The width of the cursor.
95 * @param height The height of the cursor.
96 * @return Returns a specific error code.
97 *     {@link IME_ERR_OK} - success.
98 *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
99 * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
100 * @since 12
101 */
102InputMethod_ErrorCode OH_CursorInfo_GetRect(
103    InputMethod_CursorInfo *cursorInfo, double *left, double *top, double *width, double *height);
104#ifdef __cplusplus
105}
106#endif /* __cplusplus */
107/** @} */
108#endif // OHOS_INPUTMETHOD_CURSOR_INFO_CAPI_H