1 /* 2 * Copyright (c) 2022-2023 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_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_TAB_CONTENT_MODEL_IMPL_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_TAB_CONTENT_MODEL_IMPL_H 18 19 #include "core/components_ng/pattern/tabs/tab_content_model.h" 20 #include "core/components_v2/tabs/tab_content_item_component.h" 21 22 namespace OHOS::Ace::Framework { 23 24 class TabContentModelImpl : public OHOS::Ace::TabContentModel { 25 public: 26 void Create(std::function<void()>&& deepRenderFunc) override; 27 void Create() override; 28 void Pop() override; 29 void SetTabBar(const std::optional<std::string>& text, const std::optional<std::string>& icon, 30 std::function<void()>&& builder, bool useContentOnly) override; SetTabBarStyle(TabBarStyle tabBarStyle)31 void SetTabBarStyle(TabBarStyle tabBarStyle) override {} SetIndicator(const IndicatorStyle & indicator)32 void SetIndicator(const IndicatorStyle& indicator) override {} SetBoard(const BoardStyle & board)33 void SetBoard(const BoardStyle& board) override {} SetSelectedMode(SelectedMode selectedMode)34 void SetSelectedMode(SelectedMode selectedMode) override {} SetLabelStyle(const LabelStyle & labelStyle)35 void SetLabelStyle(const LabelStyle& labelStyle) override {} SetPadding(const NG::PaddingProperty & padding)36 void SetPadding(const NG::PaddingProperty& padding) override {} SetLayoutMode(LayoutMode layoutMode)37 void SetLayoutMode(LayoutMode layoutMode) override {} SetVerticalAlign(FlexAlign verticalAlign)38 void SetVerticalAlign(FlexAlign verticalAlign) override {} SetSymmetricExtensible(bool isExtensible)39 void SetSymmetricExtensible(bool isExtensible) override {} SetId(const std::string & id)40 void SetId(const std::string& id) override {} 41 42 private: 43 RefPtr<Component> ProcessTabBarBuilderFunction( 44 RefPtr<V2::TabContentItemComponent>& tabContent, std::function<void()>&& builderFunc); 45 RefPtr<Component> ProcessTabBarTextIconPair(RefPtr<V2::TabContentItemComponent>& tabContent, 46 const std::optional<std::string>& textVal, const std::optional<std::string>& iconVal); 47 RefPtr<Component> CreateTabBarLabelComponent( 48 RefPtr<V2::TabContentItemComponent>& tabContent, const std::string& labelStr); 49 RefPtr<Component> ProcessTabBarLabel( 50 RefPtr<V2::TabContentItemComponent>& tabContent, const std::optional<std::string>& textVal); 51 }; 52 53 } // namespace OHOS::Ace::Framework 54 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_TAB_CONTENT_MODEL_IMPL_H 55