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_TEXT_AVOID_INFO_CAPI_H 16 #define OHOS_INPUTMETHOD_TEXT_AVOID_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_text_avoid_info_capi.h 28 * 29 * @brief Provides functions to manage text editor to avoid the keyboard. 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 /** 43 * @brief Define the InputMethod_TextAvoidInfo structure type. 44 * 45 * Information for text editor to avoid the keyboard. 46 * 47 * @since 12 48 */ 49 typedef struct InputMethod_TextAvoidInfo InputMethod_TextAvoidInfo; 50 51 /** 52 * @brief Create a new {@link InputMethod_TextAvoidInfo} instance. 53 * 54 * @param positionY The y-coordinate of the avoid area. 55 * @param height The height of the avoid area. 56 * @return If the creation succeeds, a pointer to the newly created {@link InputMethod_TextAvoidInfo} 57 * instance is returned. If the creation fails, NULL is returned, possible cause is insufficient memory. 58 * @since 12 59 */ 60 InputMethod_TextAvoidInfo *OH_TextAvoidInfo_Create(double positionY, double height); 61 /** 62 * @brief Destroy a {@link InputMethod_TextAvoidInfo} instance. 63 * 64 * @param options Represents a pointer to an {@link InputMethod_TextAvoidInfo} instance which will be destroyed. 65 * @since 12 66 */ 67 void OH_TextAvoidInfo_Destroy(InputMethod_TextAvoidInfo *info); 68 /** 69 * @brief Set positionY value into {@link InputMethod_TextAvoidInfo}. 70 * 71 * @param info Represents a pointer to an {@link InputMethod_TextAvoidInfo} instance which will be set value. 72 * @param positionY Represents positionY value. 73 * @return Returns a specific error code. 74 * {@link IME_ERR_OK} - success. 75 * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 76 * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 77 * @since 12 78 */ 79 InputMethod_ErrorCode OH_TextAvoidInfo_SetPositionY(InputMethod_TextAvoidInfo *info, double positionY); 80 /** 81 * @brief Set height value into {@link InputMethod_TextAvoidInfo}. 82 * 83 * @param info Represents a pointer to an {@link InputMethod_TextAvoidInfo} instance which will be set value. 84 * @param height Represents height value. 85 * @return Returns a specific error code. 86 * {@link IME_ERR_OK} - success. 87 * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 88 * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 89 * @since 12 90 */ 91 InputMethod_ErrorCode OH_TextAvoidInfo_SetHeight(InputMethod_TextAvoidInfo *info, double height); 92 /** 93 * @brief Get positionY value from {@link InputMethod_TextAvoidInfo}. 94 * 95 * @param info Represents a pointer to an {@link InputMethod_TextAvoidInfo} instance which will be get value from. 96 * @param positionY Represents positionY value. 97 * @return Returns a specific error code. 98 * {@link IME_ERR_OK} - success. 99 * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 100 * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 101 * @since 12 102 */ 103 InputMethod_ErrorCode OH_TextAvoidInfo_GetPositionY(InputMethod_TextAvoidInfo *info, double *positionY); 104 /** 105 * @brief Get height value into {@link InputMethod_TextAvoidInfo}. 106 * 107 * @param info Represents a pointer to an {@link InputMethod_TextAvoidInfo} instance which will be get value from. 108 * @param height Represents height value. 109 * @return Returns a specific error code. 110 * {@link IME_ERR_OK} - success. 111 * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 112 * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 113 * @since 12 114 */ 115 InputMethod_ErrorCode OH_TextAvoidInfo_GetHeight(InputMethod_TextAvoidInfo *info, double *height); 116 #ifdef __cplusplus 117 } 118 #endif /* __cplusplus */ 119 /** @} */ 120 #endif // OHOS_INPUTMETHOD_TEXT_AVOID_INFO_CAP_H