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/geometry/offset.h" 20 #include "base/image/pixel_map.h" 21 #include "base/memory/ace_type.h" 22 23 namespace OHOS::Rosen { 24 class Typography; 25 } 26 27 namespace OHOS::Ace { 28 29 class RenderText; 30 31 namespace NG { 32 class FrameNode; 33 class Paragraph; 34 class TextPattern; 35 } // namespace NG 36 37 class ACE_EXPORT DragWindow : public AceType { 38 DECLARE_ACE_TYPE(DragWindow, AceType); 39 40 public: 41 struct DragWindowParams { 42 std::string windowName; 43 int32_t x = 0; 44 int32_t y = 0; 45 uint32_t width = 0; 46 uint32_t height = 0; 47 int32_t parentWindowId = -1; 48 }; 49 50 static RefPtr<DragWindow> CreateDragWindow( 51 const std::string& windowName, int32_t x, int32_t y, uint32_t width, uint32_t height); 52 static RefPtr<DragWindow> CreateDragWindow(const DragWindowParams& params); 53 54 static RefPtr<DragWindow> CreateTextDragWindow( 55 const std::string& windowName, int32_t x, int32_t y, uint32_t width, uint32_t height); 56 virtual void MoveTo(int32_t x, int32_t y) const = 0; 57 virtual void TextDragWindowMove(double x, double y) const = 0; 58 virtual void Destroy() const = 0; 59 virtual void DrawPixelMap(const RefPtr<PixelMap>& pixelmap) = 0; 60 virtual void DrawFrameNode(const RefPtr<NG::FrameNode>& rootNode) = 0; 61 virtual void DrawImage(void* drawingImage) = 0; 62 virtual void DrawText( 63 std::shared_ptr<Rosen::Typography> paragraph_, const Offset& offset, const RefPtr<RenderText>& renderText) = 0; 64 virtual void DrawTextNG(const RefPtr<NG::Paragraph>& paragraph, const RefPtr<NG::TextPattern>& textPattern) = 0; 65 SetOffset(int32_t offsetX,int32_t offsetY)66 void SetOffset(int32_t offsetX, int32_t offsetY) 67 { 68 offsetX_ = offsetX; 69 offsetY_ = offsetY; 70 } 71 SetSize(int32_t width,int32_t height)72 void SetSize(int32_t width, int32_t height) 73 { 74 width_ = width; 75 height_ = height; 76 } 77 78 protected: 79 int32_t width_ = 0; 80 int32_t height_ = 0; 81 int32_t offsetX_ = 0; 82 int32_t offsetY_ = 0; 83 }; 84 } // namespace OHOS::Ace 85 86 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_WINDOW_ACE_DRAG_WINDOW_H 87