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_CPP_VIEW_SHAPE_ABSTRACT_H 17 #define FRAMEWORKS_BRIDGE_CJ_FRONTEND_CPP_VIEW_SHAPE_ABSTRACT_H 18 19 #include "bridge/cj_frontend/cppview/interactable_view.h" 20 #include "bridge/cj_frontend/cppview/view_abstract.h" 21 22 namespace OHOS::Ace::Framework { 23 24 class ACE_EXPORT NativeShapeAbstract : public OHOS::FFI::FFIData { 25 public: 26 NativeShapeAbstract(); 27 ~NativeShapeAbstract() override; GetBasicShape()28 const RefPtr<BasicShape>& GetBasicShape() const 29 { 30 return basicShape_; 31 } 32 SetBasicShape(const RefPtr<BasicShape> & basicShape)33 void SetBasicShape(const RefPtr<BasicShape>& basicShape) 34 { 35 basicShape_ = basicShape; 36 } 37 38 void SetWidth(const Dimension& value); 39 void SetHeight(const Dimension& value); 40 void SetSize(const Dimension& width, const Dimension& height); 41 void SetOffset(const Dimension& x, const Dimension& y); 42 void SetFill(const Color& color); 43 44 protected: 45 RefPtr<BasicShape> basicShape_; 46 }; 47 48 class ACE_EXPORT NativeCircle : public NativeShapeAbstract { 49 public: 50 NativeCircle(const Dimension& width, const Dimension& height); 51 ~NativeCircle() override; 52 }; 53 54 class ACE_EXPORT NativeEllipse : public NativeShapeAbstract { 55 public: 56 NativeEllipse(const Dimension& width, const Dimension& height); 57 ~NativeEllipse() override; 58 }; 59 60 class ACE_EXPORT NativeRect : public NativeShapeAbstract { 61 public: 62 NativeRect(const Dimension& width, const Dimension& height); 63 ~NativeRect() override; 64 void SetRadiusWidth(const Dimension& value); 65 void SetRadiusHeight(const Dimension& value); 66 void SetRadius(const Dimension& value); 67 }; 68 69 class ACE_EXPORT NativePath : public NativeShapeAbstract { 70 public: 71 explicit NativePath(const std::string& pathCmd); 72 ~NativePath() override; 73 }; 74 75 } // namespace OHOS::Ace::Framework 76 #endif // FRAMEWORKS_BRIDGE_CJ_FRONTEND_CPP_VIEW_SHAPE_ABSTRACT_H 77