1 /* 2 * Copyright (c) 2021 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TRIANGLE_TRIANGLE_COMPONENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TRIANGLE_TRIANGLE_COMPONENT_H 18 19 #include "core/pipeline/base/constants.h" 20 #include "core/pipeline/base/sole_child_component.h" 21 22 namespace OHOS::Ace { 23 24 class TriangleComponent : public RenderComponent { 25 DECLARE_ACE_TYPE(TriangleComponent, RenderComponent); 26 27 public: 28 TriangleComponent() = default; 29 ~TriangleComponent() override = default; 30 31 RefPtr<RenderNode> CreateRenderNode() override; 32 RefPtr<Element> CreateElement() override; 33 GetWidth()34 const Dimension& GetWidth() const 35 { 36 return width_; 37 } SetWidth(const Dimension & width)38 void SetWidth(const Dimension& width) 39 { 40 width_ = width; 41 } 42 GetHeight()43 const Dimension& GetHeight() const 44 { 45 return height_; 46 } SetHeight(const Dimension & height)47 void SetHeight(const Dimension& height) 48 { 49 height_ = height; 50 } 51 GetColor()52 const Color& GetColor() const 53 { 54 return color_; 55 } SetColor(const Color & color)56 void SetColor(const Color& color) 57 { 58 color_ = color; 59 } 60 GetPadding()61 const Dimension& GetPadding() const 62 { 63 return padding_; 64 } SetPadding(const Dimension & value)65 void SetPadding(const Dimension& value) 66 { 67 padding_ = value; 68 } 69 70 private: 71 Dimension width_; 72 Dimension height_; 73 Dimension padding_; 74 Color color_; 75 }; 76 77 } // namespace OHOS::Ace 78 79 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TRIANGLE_TRIANGLE_COMPONENT_H 80