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 #ifndef OHOS_INPUTMETHOD_CURSOR_INFO_CAPI_H
16 #define OHOS_INPUTMETHOD_CURSOR_INFO_CAPI_H
17 /**
18  * @addtogroup InputMethod
19  * @{
20  *
21  * @brief InputMethod provides functions to use input methods and develop input methods.
22  *
23  * @since 12
24  */
25 
26 /**
27  * @file inputmethod_cursor_info_capi.h
28  *
29  * @brief Provides interfaces to manage the cursor information.
30  *
31  * @library libohinputmethod.so
32  * @kit IMEKit
33  * @syscap SystemCapability.MiscServices.InputMethodFramework
34  * @since 12
35  * @version 1.0
36  */
37 #include "inputmethod_types_capi.h"
38 #ifdef __cplusplus
39 extern "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  */
48 typedef 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  */
61 InputMethod_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  */
69 void 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  */
85 InputMethod_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  */
102 InputMethod_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