• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_NG_PATTERN_NAVIGATION_NAV_BAR_LAYOUT_PROPERTY_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_NAVIGATION_NAV_BAR_LAYOUT_PROPERTY_H
18 
19 #include "base/geometry/dimension.h"
20 #include "base/utils/macros.h"
21 #include "core/components/common/layout/constants.h"
22 #include "core/components_ng/base/inspector_filter.h"
23 #include "core/components_ng/layout/layout_property.h"
24 #include "core/components_ng/pattern/navigation/navdestination_layout_property_base.h"
25 #include "core/components_ng/pattern/navigation/navigation_declaration.h"
26 #include "core/components_ng/property/property.h"
27 
28 namespace OHOS::Ace::NG {
29 
30 class ACE_EXPORT NavBarLayoutProperty : public NavDestinationLayoutPropertyBase {
31     DECLARE_ACE_TYPE(NavBarLayoutProperty, NavDestinationLayoutPropertyBase);
32 
33 public:
34     NavBarLayoutProperty() = default;
35 
36     ~NavBarLayoutProperty() override = default;
37 
Clone()38     RefPtr<LayoutProperty> Clone() const override
39     {
40         auto copy = MakeRefPtr<NavBarLayoutProperty>();
41         copy->NavDestinationLayoutPropertyBase::UpdateBaseLayoutProperty(
42             DynamicCast<NavDestinationLayoutPropertyBase>(this));
43         copy->propTitleMode_ = CloneTitleMode();
44         return copy;
45     }
46 
Reset()47     void Reset() override
48     {
49         NavDestinationLayoutPropertyBase::Reset();
50         ResetTitleMode();
51     }
52 
GetTitleModeString()53     std::string GetTitleModeString() const
54     {
55         switch (GetTitleModeValue(NavigationTitleMode::FREE)) {
56             case NavigationTitleMode::FREE:
57                 return "NavigationTitleMode.Free";
58             case NavigationTitleMode::FULL:
59                 return "NavigationTitleMode.Full";
60             case NavigationTitleMode::MINI:
61                 return "NavigationTitleMode.Mini";
62             default:
63                 return "NavigationTitleMode.Free";
64         }
65     }
66     ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(TitleMode, NavigationTitleMode, PROPERTY_UPDATE_MEASURE);
67 };
68 
69 } // namespace OHOS::Ace::NG
70 
71 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_NAVIGATION_NAV_BAR_LAYOUT_PROPERTY_H
72