1 /* 2 * Copyright (c) 2024 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_NAVIGATION_OPTIONS_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_OPTIONS_H 18 19 #include <optional> 20 21 #include "core/components/common/properties/color.h" 22 #include "core/components/common/properties/decoration.h" 23 #include "core/components_ng/pattern/navigation/navigation_declaration.h" 24 25 namespace OHOS::Ace::NG { 26 struct NavigationBackgroundOptions { 27 std::optional<Color> color; 28 std::optional<BlurStyle> blurStyle; 29 30 bool operator== (const NavigationBackgroundOptions& other) const 31 { 32 return color == other.color && blurStyle == other.blurStyle; 33 } 34 35 bool operator!= (const NavigationBackgroundOptions& other) const 36 { 37 return !(*this == other); 38 } 39 }; 40 41 struct NavigationBarOptions { 42 std::optional<BarStyle> barStyle; 43 std::optional<CalcDimension> paddingStart; 44 std::optional<CalcDimension> paddingEnd; 45 46 bool operator== (const NavigationBarOptions& other) const 47 { 48 return barStyle == other.barStyle && paddingStart == other.paddingStart 49 && paddingEnd == other.paddingEnd; 50 } 51 52 bool operator!= (const NavigationBarOptions& other) const 53 { 54 return !(*this == other); 55 } 56 }; 57 58 using TextStyleApplyFunc = std::function<void(WeakPtr<FrameNode>)>; 59 struct NavigationTextOptions { 60 TextStyleApplyFunc mainTitleApplyFunc; 61 TextStyleApplyFunc subTitleApplyFunc; 62 ResetNavigationTextOptions63 void Reset() 64 { 65 mainTitleApplyFunc = nullptr; 66 subTitleApplyFunc = nullptr; 67 } 68 }; 69 70 struct NavigationTitlebarOptions { 71 NavigationBackgroundOptions bgOptions; 72 NavigationBarOptions brOptions; 73 NavigationTextOptions textOptions; 74 bool enableHoverMode = false; 75 76 bool operator== (const NavigationTitlebarOptions& other) const 77 { 78 return bgOptions == other.bgOptions && brOptions == other.brOptions 79 && enableHoverMode == other.enableHoverMode; 80 } 81 82 bool operator!= (const NavigationTitlebarOptions& other) const 83 { 84 return !(*this == other); 85 } 86 }; 87 88 struct NavigationToolbarOptions { 89 NavigationBackgroundOptions bgOptions; 90 // toolBar not support paddingStart and paddingEnd of NavigationBarOptions now 91 NavigationBarOptions brOptions; 92 93 bool operator== (const NavigationToolbarOptions& other) const 94 { 95 return bgOptions == other.bgOptions && brOptions == other.brOptions; 96 } 97 98 bool operator!= (const NavigationToolbarOptions& other) const 99 { 100 return !(*this == other); 101 } 102 }; 103 104 struct ImageOption { 105 bool noPixMap; 106 bool isValidImage; 107 }; 108 109 } // namespace OHOS::Ace::NG 110 111 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_OPTIONS_H 112