• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_NG_PATTERNS_NAVIGATION_NAVDESTINATION_CONTENT_PATTERN_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVDESTINATION_CONTENT_PATTERN_H
18 
19 #include "base/memory/referenced.h"
20 #include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
21 #include "core/components_ng/pattern/navigation/custom_safe_area_expander.h"
22 #include "core/components_ng/pattern/navigation/nav_content_layout_property_base.h"
23 
24 namespace OHOS::Ace::NG {
25 class NavDestinationContentPattern : public LinearLayoutPattern, public CustomSafeAreaExpander {
26     DECLARE_ACE_TYPE(NavDestinationContentPattern, LinearLayoutPattern, CustomSafeAreaExpander);
27 
28 public:
NavDestinationContentPattern(bool isVertical)29     explicit NavDestinationContentPattern(bool isVertical) : LinearLayoutPattern(isVertical) {}
30     ~NavDestinationContentPattern() override = default;
31 
32 private:
CustomizeExpandSafeArea()33     bool CustomizeExpandSafeArea() override
34     {
35         auto host = GetHost();
36         CHECK_NULL_RETURN(host, false);
37         return RunCustomizeExpandIfNeeded(host);
38     }
39 
IsEnableMatchParent()40     bool IsEnableMatchParent() override
41     {
42         return true;
43     }
44 
IsEnableFix()45     bool IsEnableFix() override
46     {
47         return true;
48     }
49 
IsEnableChildrenMatchParent()50     bool IsEnableChildrenMatchParent() override
51     {
52         return true;
53     }
54 
CreateLayoutProperty()55     RefPtr<LayoutProperty> CreateLayoutProperty() override
56     {
57         return MakeRefPtr<NavContentLayoutPropertyBase>(GetIsVertical());
58     }
59 };
60 } // namespace OHOS::Ace::NG
61 
62 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVDESTINATION_CONTENT_PATTERN_H
63