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 FRAMEWORKS_BRIDGE_CJ_FRONTEND_INTERFACES_CJ_FFI_CJ_SWIPER_FFI_H 17 #define FRAMEWORKS_BRIDGE_CJ_FRONTEND_INTERFACES_CJ_FFI_CJ_SWIPER_FFI_H 18 19 #include <cstdint> 20 21 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_macro.h" 22 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_text_ffi.h" 23 24 extern "C" { 25 CJ_EXPORT void FfiOHOSAceFrameworkSwiperCreate(int64_t controllerId); 26 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetAutoplay(bool autoPlay); 27 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetDigital(bool digitalIndicator); 28 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetDuration(uint32_t duration); 29 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetIndex(uint32_t index); 30 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetInterval(uint32_t interval); 31 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetLoop(bool loop); 32 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetVertical(bool isVertical); 33 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetIndicator(bool showIndicator); 34 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetCancelSwipeOnOtherAxis(bool cancel); 35 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetWidth(double width, int32_t unit); 36 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetHeight(double height, int32_t unit); 37 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetSize(double width, int32_t widthUnit, double height, int32_t heightUnit); 38 39 struct CJIndicatorStyle { 40 double left; 41 int32_t leftUnit; 42 double top; 43 int32_t topUnit; 44 double right; 45 int32_t rightUnit; 46 double bottom; 47 int32_t bottomUnit; 48 double size; 49 int32_t sizeUnit; 50 uint32_t color; 51 uint32_t selectedColor; 52 bool mask; 53 }; 54 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetIndicatorStyle(CJIndicatorStyle value); 55 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetItemSpace(double itemSpace, int32_t unit); 56 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetDisplayMode(int32_t mode); 57 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetEffectMode(int32_t mode); 58 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetDisplayCount(int32_t count); 59 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetCachedCount(int32_t cachedCount); 60 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetEnabled(bool value); 61 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetDisableSwipe(bool disable); 62 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetCurve(const char* curveStr); 63 CJ_EXPORT void FfiOHOSAceFrameworkSwiperSetOnChange(void (*callback)(int32_t index)); 64 CJ_EXPORT int64_t FfiOHOSAceFrameworkSwiperControllerCtor(); 65 CJ_EXPORT void FfiOHOSAceFrameworkSwiperControllerShowNext(int64_t selfId); 66 CJ_EXPORT void FfiOHOSAceFrameworkSwiperControllerShowPrevious(int64_t selfId); 67 CJ_EXPORT void FfiOHOSAceFrameworkSwiperControllerFinishAnimation(int64_t selfId); 68 CJ_EXPORT void FfiOHOSAceFrameworkSwiperControllerFinishAnimationWithCallback(int64_t selfId, void (*callback)()); 69 } 70 71 #endif 72