• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PATTERN_MENU_MENU_WRAPPER_PAINT_METHOD_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_MENU_MENU_WRAPPER_PAINT_METHOD_H
18 
19 #include "base/geometry/ng/size_t.h"
20 #include "base/memory/ace_type.h"
21 #include "base/memory/referenced.h"
22 #include "base/subwindow/subwindow_manager.h"
23 #include "base/utils/macros.h"
24 #include "base/utils/utils.h"
25 #include "core/components_ng/render/node_paint_method.h"
26 #include "core/components_v2/list/list_component.h"
27 
28 // @deprecated
29 namespace OHOS::Ace::NG {
30 struct MenuPathParams {
31     float radiusTopLeftPx = 0.0f;
32     float radiusTopRightPx = 0.0f;
33     float radiusBottomLeftPx = 0.0f;
34     float radiusBottomRightPx = 0.0f;
35     OffsetF childOffset = OffsetF();
36     SizeF frameSize = SizeF();
37     OffsetF arrowPosition = OffsetF();
38     Placement arrowPlacement = Placement::NONE;
39     bool didNeedArrow = false;
40 };
41 
42 class ACE_EXPORT MenuWrapperPaintMethod : public NodePaintMethod {
43     DECLARE_ACE_TYPE(MenuWrapperPaintMethod, NodePaintMethod)
44 public:
45     MenuWrapperPaintMethod() = default;
46     ~MenuWrapperPaintMethod() override = default;
47 
48     CanvasDrawFunction GetOverlayDrawFunction(PaintWrapper* paintWrapper) override;
49 
50 private:
51     void PaintDoubleBorder(RSCanvas& canvas, PaintWrapper* paintWrapper);
52     void PaintAndClipSinglePath(RSCanvas& canvas, PaintWrapper* paintWrapper, const MenuPathParams& path);
53     void BuildCompletePath(RSPath& rsPath, const MenuPathParams& params);
54     void BuildTopLinePath(RSPath& rsPath, const MenuPathParams& params);
55     void BuildRightLinePath(RSPath& rsPath, const MenuPathParams& params);
56     void BuildBottomLinePath(RSPath& rsPath, const MenuPathParams& params);
57     void BuildLeftLinePath(RSPath& rsPath, const MenuPathParams& params);
58     void BuildBottomArrowPath(RSPath& rsPath, float arrowX, float arrowY);
59     void BuildTopArrowPath(RSPath& rsPath, float arrowX, float arrowY);
60     void BuildRightArrowPath(RSPath& rsPath, float arrowX, float arrowY);
61     void BuildLeftArrowPath(RSPath& rsPath, float arrowX, float arrowY);
62     ACE_DISALLOW_COPY_AND_MOVE(MenuWrapperPaintMethod);
63 
64 };
65 } // namespace OHOS::Ace::NG
66 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_MENU_MENU_PAINT_METHOD_H