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 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_row_split_ffi.h" 17 18 #include "bridge/cj_frontend/interfaces/cj_ffi/utils.h" 19 #include "bridge/common/utils/utils.h" 20 #include "core/components_ng/base/view_abstract_model.h" 21 #include "core/common/container.h" 22 #include "core/components_ng/pattern/linear_split/linear_split_model.h" 23 #include "bridge/cj_frontend/cppview/shape_abstract.h" 24 25 using namespace OHOS::Ace; 26 using namespace OHOS::FFI; 27 using namespace OHOS::Ace::Framework; 28 29 extern "C" { FfiOHOSAceFrameworkRowSplitCreate()30void FfiOHOSAceFrameworkRowSplitCreate() 31 { 32 LinearSplitModel::GetInstance()->Create(NG::SplitType::ROW_SPLIT); 33 } 34 FfiOHOSAceFrameworkRowSplitResizeable(bool resizeable)35void FfiOHOSAceFrameworkRowSplitResizeable(bool resizeable) 36 { 37 LinearSplitModel::GetInstance()->SetResizable(NG::SplitType::ROW_SPLIT, resizeable); 38 } 39 FfiOHOSAceFrameworkRowSplitClip(bool isClip)40void FfiOHOSAceFrameworkRowSplitClip(bool isClip) 41 { 42 ViewAbstractModel::GetInstance()->SetClipEdge(isClip); 43 } 44 FfiOHOSAceFrameworkRowSplitClipByShape(int64_t shapeId)45void FfiOHOSAceFrameworkRowSplitClipByShape(int64_t shapeId) 46 { 47 auto context = FFIData::GetData<NativeShapeAbstract>(shapeId); 48 if (context != nullptr) { 49 ViewAbstractModel::GetInstance()->SetClipShape(context->GetBasicShape()); 50 } else { 51 LOGE("set clip error, Cannot get NativeShape by id: %{public}" PRId64, shapeId); 52 } 53 } 54 } 55