• 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_ADAPTER_OHOS_OSAL_DRAG_WINDOW_OHOS_H
17 #define FOUNDATION_ACE_ADAPTER_OHOS_OSAL_DRAG_WINDOW_OHOS_H
18 
19 #include "wm/window.h"
20 #include "wm/window_option.h"
21 #include "wm/wm_common.h"
22 
23 #ifdef ENABLE_ROSEN_BACKEND
24 #include "render_service_client/core/ui/rs_ui_director.h"
25 #include "transaction/rs_transaction_proxy.h"
26 #include "ui/rs_root_node.h"
27 #endif
28 
29 #include "base/window/drag_window.h"
30 
31 namespace OHOS::Ace {
32 class DragWindowOhos : public DragWindow {
33 public:
DragWindowOhos(OHOS::sptr<OHOS::Rosen::Window> dragWindow)34     explicit DragWindowOhos(OHOS::sptr<OHOS::Rosen::Window> dragWindow) : dragWindow_(dragWindow) {}
35     ~DragWindowOhos() = default;
36 
37     void MoveTo(int32_t x, int32_t y) const override;
38     void TextDragWindowMove(double x, double y) const override;
39     void Destroy() const override;
40     void DrawPixelMap(const RefPtr<PixelMap>& pixelMap) override;
41     void DrawFrameNode(const RefPtr<NG::FrameNode>& rootNode) override;
42     void DrawImage(void* drawingImage) override;
43     void DrawText(std::shared_ptr<Rosen::Typography> paragraph, const Offset& offset,
44         const RefPtr<RenderText>& renderText) override;
45     void DrawTextNG(const RefPtr<NG::Paragraph>& paragraph, const RefPtr<NG::TextPattern>& textPattern) override;
46 
47 private:
48     OHOS::sptr<Rosen::Window> dragWindow_;
49 #ifdef ENABLE_ROSEN_BACKEND
50     std::shared_ptr<Rosen::RSNode> rootNode_;
51     std::shared_ptr<Rosen::RSUIDirector> rsUiDirector_;
52 #endif
53 };
54 } // namespace OHOS::Ace
55 
56 #endif // FOUNDATION_ACE_ADAPTER_OHOS_OSAL_DRAG_WINDOW_OHOS_H