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_TEXT_CLOCK_FFI_H 17 #define OHOS_ACE_FRAMEWORK_CJ_TEXT_CLOCK_FFI_H 18 19 #include <cinttypes> 20 21 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_macro.h" 22 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_view_abstract_ffi.h" 23 #include "core/components_ng/pattern/text_clock/text_clock_model.h" 24 #include "core/components_ng/pattern/text_clock/text_clock_model_ng.h" 25 #include "ffi_remote_data.h" 26 27 namespace OHOS::Ace::Framework { 28 class ACE_EXPORT NativeTextClockController : public OHOS::FFI::FFIData { 29 DECL_TYPE(NativeTextClockController, OHOS::FFI::FFIData) 30 public: 31 NativeTextClockController(); 32 33 void Start(); 34 void Stop(); SetController(const RefPtr<TextClockController> & controller)35 void SetController(const RefPtr<TextClockController>& controller) 36 { 37 controller_ = controller; 38 } 39 40 private: 41 RefPtr<TextClockController> controller_; 42 }; 43 } // namespace OHOS::Ace::Framework 44 45 using VectorDoubleHandle = void*; 46 using VectorStringPtr = void*; 47 using VectorNativeTextShadow = void*; 48 49 extern "C" { 50 struct NativeTextShadow { 51 double radius; 52 double offsetX; 53 double offsetY; 54 uint32_t color; 55 }; 56 CJ_EXPORT VectorNativeTextShadow FFICJCreateVectorNativeTextShadow(int64_t size); 57 CJ_EXPORT void FFICJVectorNativeTextShadowSetElement( 58 VectorNativeTextShadow vec, int64_t index, NativeTextShadow textShadow); 59 CJ_EXPORT void FFICJVectorNativeTextShadowDelete(VectorNativeTextShadow vec); 60 61 CJ_EXPORT void FfiOHOSAceFrameworkTextClockCreateDefault(int64_t controllerId); 62 CJ_EXPORT void FfiOHOSAceFrameworkTextClockCreate(int32_t timeZoneOffset, int64_t controllerId); 63 CJ_EXPORT void FfiOHOSAceFrameworkTextClockFormat(const char* value); 64 CJ_EXPORT void FfiOHOSAceFrameworkTextClockOnChange(void (*callback)(int64_t timeStamp)); 65 CJ_EXPORT void FfiOHOSAceFrameworkTextClockTextColor(uint32_t color); 66 CJ_EXPORT void FfiOHOSAceFrameworkTextClockFontSize(double size, int32_t unit); 67 CJ_EXPORT void FfiOHOSAceFrameworkTextClockFontWeight(const char* fontWeight); 68 CJ_EXPORT void FfiOHOSAceFrameworkTextClockFontStyle(int32_t value); 69 CJ_EXPORT void FfiOHOSAceFrameworkTextClockFontFamily(const char* fontFamily); 70 CJ_EXPORT void FfiOHOSAceFrameworkTextClockTextShadow(VectorStringPtr vecContent); 71 CJ_EXPORT void FfiOHOSAceFrameworkTextClockFontFeature(const char* fontFeature); 72 CJ_EXPORT int64_t FfiOHOSAceFrameworkTextClockControllerCtor(); 73 CJ_EXPORT void FfiOHOSAceFrameworkTextClockControllerStart(int64_t selfID); 74 CJ_EXPORT void FfiOHOSAceFrameworkTextClockControllerStop(int64_t selfID); 75 } 76 77 #endif // OHOS_ACE_FRAMEWORK_CJ_TEXT_CLOCK_FFI_H 78