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#ifndef INPUT_METHOD_FFI_H
17#define INPUT_METHOD_FFI_H
18
19#include "input_method_ffi_structs.h"
20
21extern "C" {
22    FFI_EXPORT int32_t FfiInputMethodGetDefaultInputMethod(CInputMethodProperty &props);
23    FFI_EXPORT int32_t FfiInputMethodGetCurrentInputMethod(CInputMethodProperty &props);
24    FFI_EXPORT int32_t FfiInputMethodSwitchInputMethod(bool &result, CInputMethodProperty props);
25    FFI_EXPORT int32_t FfiInputMethodSwitchCurrentInputMethodSubtype(bool &result, CInputMethodSubtype target);
26    FFI_EXPORT int32_t FfiInputMethodGetCurrentInputMethodSubtype(CInputMethodSubtype &props);
27    FFI_EXPORT int32_t FfiInputMethodSwitchCurrentInputMethodAndSubtype(bool &result, CInputMethodProperty target,
28        CInputMethodSubtype subtype);
29    FFI_EXPORT int32_t FfiInputMethodGetSystemInputMethodConfigAbility(CElementName &elem);
30    FFI_EXPORT RetInputMethodSubtype FfiInputMethodSettingListInputMethodSubtype(CInputMethodProperty props);
31    FFI_EXPORT RetInputMethodSubtype FfiInputMethodSettingListCurrentInputMethodSubtype();
32    FFI_EXPORT RetInputMethodProperty FfiInputMethodSettingGetInputMethods(bool enable);
33    FFI_EXPORT RetInputMethodProperty FfiInputMethodSettingGetAllInputMethods();
34    FFI_EXPORT int32_t FfiInputMethodSettingOn(uint32_t type, void (*func)(CInputMethodProperty, CInputMethodSubtype));
35    FFI_EXPORT int32_t FfiInputMethodSettingOff(uint32_t type);
36    FFI_EXPORT int32_t FfiInputMethodSettingShowOptionalInputMethods(bool& result);
37    FFI_EXPORT int32_t FfiInputMethodControllerOn(int8_t type, int64_t id);
38    FFI_EXPORT int32_t FfiInputMethodControllerOff(int8_t type);
39
40    FFI_EXPORT int32_t FfiInputMethodControllerAttach(bool showKeyboard, CTextConfig txtCfg);
41    FFI_EXPORT int32_t FfiInputMethodControllerDetach();
42    FFI_EXPORT int32_t FfiInputMethodControllerShowTextInput();
43    FFI_EXPORT int32_t FfiInputMethodControllerHideTextInput();
44    FFI_EXPORT int32_t FfiInputMethodControllerSetCallingWindow(uint32_t windowId);
45    FFI_EXPORT int32_t FfiInputMethodControllerUpdateCursor(CCursorInfo cursor);
46    FFI_EXPORT int32_t FfiInputMethodControllerChangeSelection(char *text, int32_t start, int32_t end);
47    FFI_EXPORT int32_t FfiInputMethodControllerUpdateAttribute(CInputAttribute inputAttribute);
48    FFI_EXPORT int32_t FfiInputMethodControllerShowSoftKeyboard();
49    FFI_EXPORT int32_t FfiInputMethodControllerHideSoftKeyboard();
50    FFI_EXPORT int32_t FfiInputMethodControllerStopInputSession();
51}
52
53#endif // INPUT_METHOD_FFI_H