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_TIP_TIP_COMPONENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TIP_TIP_COMPONENT_H 18 19 #include "base/geometry/dimension.h" 20 #include "core/components/common/properties/color.h" 21 #include "core/components/text/text_component.h" 22 #include "core/pipeline/base/render_component.h" 23 #include "core/pipeline/base/sole_child_component.h" 24 25 namespace OHOS::Ace { 26 27 class TipComponent : public SoleChildComponent { 28 DECLARE_ACE_TYPE(TipComponent, SoleChildComponent); 29 30 public: TipComponent(const RefPtr<Component> & child)31 explicit TipComponent(const RefPtr<Component>& child) : SoleChildComponent(child) {} 32 33 ~TipComponent() override = default; 34 RefPtr<Element> CreateElement() override; 35 RefPtr<RenderNode> CreateRenderNode() override; 36 GetBgColor()37 const Color& GetBgColor() const 38 { 39 return bgColor_; 40 } 41 SetBgColor(const Color & color)42 void SetBgColor(const Color& color) 43 { 44 bgColor_ = color; 45 } 46 GetDirection()47 Axis GetDirection() const 48 { 49 return axis_; 50 } 51 SetDirection(Axis axis)52 void SetDirection(Axis axis) 53 { 54 axis_ = axis; 55 } 56 57 private: 58 Color bgColor_ = Color::BLACK; 59 Axis axis_ = Axis::HORIZONTAL; 60 }; 61 62 } // namespace OHOS::Ace 63 64 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TIP_TIP_COMPONENT_H 65