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_DIVIDER_DIVIDER_COMPONENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DIVIDER_DIVIDER_COMPONENT_H 18 19 #include "core/components/common/properties/color.h" 20 #include "core/components/divider/divider_element.h" 21 #include "core/pipeline/base/render_component.h" 22 23 namespace OHOS::Ace { 24 25 class ACE_EXPORT DividerComponent : public RenderComponent { 26 DECLARE_ACE_TYPE(DividerComponent, RenderComponent); 27 28 public: 29 RefPtr<RenderNode> CreateRenderNode() override; 30 CreateElement()31 RefPtr<Element> CreateElement() override 32 { 33 return AceType::MakeRefPtr<DividerElement>(); 34 } 35 GetDividerColor()36 const Color& GetDividerColor() const 37 { 38 return dividerColor_; 39 } 40 IsVertical()41 bool IsVertical() const 42 { 43 return vertical_; 44 } 45 SetDividerColor(const Color & color)46 void SetDividerColor(const Color& color) 47 { 48 dividerColor_ = color; 49 } 50 SetVertical(bool vertical)51 void SetVertical(bool vertical) 52 { 53 vertical_ = vertical; 54 } 55 GetStrokeWidth()56 const Dimension& GetStrokeWidth() const 57 { 58 return strokeWidth_; 59 } 60 SetStrokeWidth(const Dimension & strokeWidth)61 void SetStrokeWidth(const Dimension& strokeWidth) 62 { 63 strokeWidth_ = strokeWidth; 64 } 65 GetLineCap()66 LineCap GetLineCap() const 67 { 68 return lineCap_; 69 } 70 SetLineCap(LineCap lineCap)71 void SetLineCap(LineCap lineCap) 72 { 73 lineCap_ = lineCap; 74 } 75 76 private: 77 Color dividerColor_; 78 bool vertical_ = false; 79 LineCap lineCap_ = LineCap::BUTT; 80 Dimension strokeWidth_ = Dimension(1.0); 81 }; 82 83 } // namespace OHOS::Ace 84 85 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DIVIDER_DIVIDER_COMPONENT_H 86