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 OHOS_ACE_FRAMEWORK_CJ_SELECT_FFI_H
17 #define OHOS_ACE_FRAMEWORK_CJ_SELECT_FFI_H
18 
19 #include <cstdint>
20 #include <vector>
21 
22 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_macro.h"
23 
24 using VectorStringPtr = void*;
25 using VectorNativeSelectOptionHandle = void*;
26 
27 extern "C" {
28 struct NativeSelectOption {
29     char* value;
30     char* icon;
31 };
32 CJ_EXPORT VectorNativeSelectOptionHandle FFICJCreateVectorNativeSelectOption(int64_t size);
33 CJ_EXPORT void FFICJVectorNativeSelectOptionSetElement(
34     VectorNativeSelectOptionHandle vec, int64_t index, NativeSelectOption selectOption);
35 CJ_EXPORT void FFICJVectorNativeSelectOptionDelete(VectorNativeSelectOptionHandle vec);
36 
37 CJ_EXPORT void FfiOHOSAceFrameworkSelectCreate(VectorNativeSelectOptionHandle values);
38 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetSelected(int32_t value);
39 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetValue(const char* value);
40 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetFont(
41     int32_t style, const char* weight, double size, int32_t sizeUnit, const char* family);
42 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetFontColor(uint32_t color);
43 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetSelectedOptionBgColor(uint32_t color);
44 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetSelectedOptionFont(
45     int32_t style, const char* weight, double size, int32_t sizeUnit, const char* family);
46 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetSelectedOptionFontColor(uint32_t color);
47 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetOptionBgColor(uint32_t color);
48 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetOptionFont(
49     int32_t style, const char* weight, double size, int32_t sizeUnit, const char* family);
50 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetOptionFontColor(uint32_t color);
51 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetSpace(double width, int32_t widthUnit);
52 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetArrowPosition(int32_t value);
53 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetMenuAlign(
54     int32_t value, double dx, int32_t dxUnit, double dy, int32_t dyUnit);
55 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetOptionWidth(double width, int32_t widthUnit);
56 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetOptionWidthWithMode(const char* value);
57 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetOptionHeight(double height, int32_t heightUnit);
58 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetMenuBackgroundColor(uint32_t color);
59 CJ_EXPORT void FfiOHOSAceFrameworkSelectSetMenuBackgroundBlurStyle(int32_t value);
60 CJ_EXPORT void FfiOHOSAceFrameworkSelectOnSelect(void (*callback)(int32_t index, const char* value));
61 };
62 #endif