• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_BASE_WINDOW_ACE_DRAG_WINDOW_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_WINDOW_ACE_DRAG_WINDOW_H
18 
19 #include "base/image/pixel_map.h"
20 #include "base/geometry/offset.h"
21 #include "base/memory/ace_type.h"
22 
23 namespace txt {
24 class Paragraph;
25 }
26 
27 namespace OHOS::Ace {
28 
29 class RenderText;
30 
31 namespace NG {
32 class FrameNode;
33 }
34 
35 class ACE_EXPORT DragWindow : public AceType {
36     DECLARE_ACE_TYPE(DragWindow, AceType);
37 
38 public:
39     static RefPtr<DragWindow> CreateDragWindow(const std::string& windowName, int32_t x, int32_t y, uint32_t width,
40         uint32_t height);
41     virtual void MoveTo(int32_t x, int32_t y) const = 0;
42     virtual void Destroy() const = 0;
43     virtual void DrawPixelMap(const RefPtr<PixelMap>& pixelmap) = 0;
44     virtual void DrawFrameNode(const RefPtr<NG::FrameNode>& rootNode) = 0;
45     virtual void DrawImage(void* skImage) = 0;
46     virtual void DrawText(std::shared_ptr<txt::Paragraph> paragraph_,
47         const Offset& offset, const RefPtr<RenderText>& renderText) = 0;
SetOffset(int32_t offsetX,int32_t offsetY)48     void SetOffset(int32_t offsetX, int32_t offsetY)
49     {
50         offsetX_ = offsetX;
51         offsetY_ = offsetY;
52     }
53 
SetSize(int32_t width,int32_t height)54     void SetSize(int32_t width, int32_t height)
55     {
56         width_ = width;
57         height_ = height;
58     }
59 
60 protected:
61     int32_t width_ = 0;
62     int32_t height_ = 0;
63     int32_t offsetX_ = 0;
64     int32_t offsetY_ = 0;
65 };
66 } // namespace OHOS::Ace
67 
68 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_WINDOW_ACE_DRAG_WINDOW_H
69