• 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_TOOLBARITEM_DECOR_TOOLBAR_PATTERN_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TOOLBARITEM_DECOR_TOOLBAR_PATTERN_H
18 
19 #include "core/components_ng/manager/focus/focus_view.h"
20 #include "core/components_ng/pattern/linear_layout/linear_layout_algorithm.h"
21 #include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
22 #include "core/components_ng/pattern/linear_layout/linear_layout_property.h"
23 #include "core/components_ng/pattern/pattern.h"
24 
25 namespace OHOS::Ace::NG {
26 
27 class ACE_EXPORT ToolBarRowPattern : public LinearLayoutPattern, public FocusView {
28     DECLARE_ACE_TYPE(ToolBarRowPattern, LinearLayoutPattern, FocusView);
29 
30 public:
ToolBarRowPattern()31     ToolBarRowPattern() : LinearLayoutPattern(false) {};
32     ~ToolBarRowPattern() override = default;
33 
GetRouteOfFirstScope()34     std::list<int32_t> GetRouteOfFirstScope() override
35     {
36         return { 1 };
37     }
38 
IsAtomicNode()39     bool IsAtomicNode() const override
40     {
41         return false;
42     }
43 
GetFocusPattern()44     FocusPattern GetFocusPattern() const override
45     {
46         return { FocusType::SCOPE, true };
47     }
48 
CreateLayoutProperty()49     RefPtr<LayoutProperty> CreateLayoutProperty() override
50     {
51         return MakeRefPtr<LinearLayoutProperty>(false);
52     }
53 
CreateLayoutAlgorithm()54     RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override
55     {
56         return MakeRefPtr<LinearLayoutAlgorithm>();
57     }
58 
59     ScopeFocusAlgorithm GetScopeFocusAlgorithm() override;
60     WeakPtr<FocusHub> GetNextFocusNode(FocusStep step, const WeakPtr<FocusHub>& currentFocusNode);
61 
62 private:
63     ACE_DISALLOW_COPY_AND_MOVE(ToolBarRowPattern);
64 };
65 
66 } // namespace OHOS::Ace::NG
67 
68 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TOOLBARITEM_DECOR_TOOLBAR_PATTERN_H