1 /*
2  * Copyright (c) 2021-2022 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_V2_INSPECTOR_TABS_COMPOSED_ELEMENT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_INSPECTOR_TABS_COMPOSED_ELEMENT_H
18 
19 #include "core/components/box/render_box.h"
20 #include "core/components/flex/render_flex.h"
21 #include "core/components/tab_bar/render_tab_bar.h"
22 #include "core/components/tab_bar/render_tab_content.h"
23 #include "core/components_v2/inspector/inspector_composed_element.h"
24 #include "core/components_v2/tabs/tabs_element.h"
25 #include "core/pipeline/base/composed_element.h"
26 
27 namespace OHOS::Ace::V2 {
28 
29 class ACE_EXPORT TabsComposedElement : public InspectorComposedElement {
DECLARE_ACE_TYPE(TabsComposedElement,InspectorComposedElement)30     DECLARE_ACE_TYPE(TabsComposedElement, InspectorComposedElement)
31 
32 public:
33     explicit TabsComposedElement(const ComposeId& id) : InspectorComposedElement(id) {}
34     ~TabsComposedElement() override = default;
35 
36     void Dump() override;
37     std::unique_ptr<JsonValue> ToJsonObject() const override;
38 
39     std::string GetBarPosition() const;
40     std::string GetIndex() const;
41     std::string GetVertical() const;
42     bool GetScrollable() const override;
43     std::string GetBarMode() const;
44     std::string GetBarWidth() const;
45     std::string GetBarHeight() const;
46     float GetAnimationDuration() const;
47 
GetTargetTypeId()48     AceType::IdType GetTargetTypeId() const override
49     {
50         return TabsElement::TypeId();
51     }
52 
53 private:
54     RefPtr<RenderFlex> GetRenderFlex() const;
55     RefPtr<RenderTabBar> GetRenderTabBar(const RefPtr<RenderNode>& node) const;
56     RefPtr<RenderTabContent> GetRenderTabContent(const RefPtr<RenderNode>& node) const;
57     RefPtr<RenderBox> GetRenderBox(const RefPtr<RenderNode>& node) const;
58 };
59 
60 } // namespace OHOS::Ace::V2
61 
62 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_INSPECTOR_TABS_COMPOSED_ELEMENT_H