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_PATTERNS_NAVROUTER_NAVDESTINATION_LAYOUT_PROPERTY_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVROUTER_NAVDESTINATION_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/layout/layout_property.h"
23 #include "core/components_ng/pattern/navigation/navdestination_layout_property_base.h"
24 #include "core/components_ng/pattern/navigation/navigation_declaration.h"
25 #include "core/components_ng/property/property.h"
26 #include "core/image/image_source_info.h"
27 
28 namespace OHOS::Ace::NG {
29 
30 class ACE_EXPORT NavDestinationLayoutProperty : public NavDestinationLayoutPropertyBase {
31     DECLARE_ACE_TYPE(NavDestinationLayoutProperty, NavDestinationLayoutPropertyBase);
32 
33 public:
34     NavDestinationLayoutProperty() = default;
35     ~NavDestinationLayoutProperty() override = default;
36 
Clone()37     RefPtr<LayoutProperty> Clone() const override
38     {
39         auto copy = MakeRefPtr<NavDestinationLayoutProperty>();
40         copy->NavDestinationLayoutPropertyBase::UpdateBaseLayoutProperty(
41             DynamicCast<NavDestinationLayoutPropertyBase>(this));
42         copy->propNoPixMap_ = CloneNoPixMap();
43         copy->propImageSource_ = CloneImageSource();
44         copy->propPixelMap_ = ClonePixelMap();
45         return copy;
46     }
47 
Reset()48     void Reset() override
49     {
50         NavDestinationLayoutPropertyBase::Reset();
51         ResetNoPixMap();
52         ResetImageSource();
53         ResetPixelMap();
54     }
55 
56     // back button icon
57     ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(NoPixMap, bool, PROPERTY_UPDATE_MEASURE);
58     ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(ImageSource, ImageSourceInfo, PROPERTY_UPDATE_MEASURE);
59     ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(PixelMap, RefPtr<PixelMap>, PROPERTY_UPDATE_MEASURE);
60 };
61 
62 } // namespace OHOS::Ace::NG
63 
64 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVROUTER_NAVDESTINATION_LAYOUT_PROPERTY_H