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 I_POINTER_DRAWING_MANAGER_H 17 #define I_POINTER_DRAWING_MANAGER_H 18 19 #include <map> 20 #include <memory> 21 22 #include "pixel_map.h" 23 #include "pointer_style.h" 24 #include "window_info.h" 25 #include "struct_multimodal.h" 26 27 namespace OHOS { 28 namespace MMI { 29 class IPointerDrawingManager { 30 public: 31 IPointerDrawingManager() = default; 32 virtual ~IPointerDrawingManager() = default; 33 34 static std::shared_ptr<IPointerDrawingManager> GetInstance(); DrawPointer(int32_t displayId,int32_t physicalX,int32_t physicalY,const PointerStyle pointerStyle,Direction direction)35 virtual void DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, 36 const PointerStyle pointerStyle, Direction direction) {} UpdateDisplayInfo(const DisplayInfo & displayInfo)37 virtual void UpdateDisplayInfo(const DisplayInfo& displayInfo) {} OnDisplayInfo(const DisplayGroupInfo & displayGroupInfo)38 virtual void OnDisplayInfo(const DisplayGroupInfo& displayGroupInfo) {} OnWindowInfo(const WinInfo & info)39 virtual void OnWindowInfo(const WinInfo &info) {} Init()40 virtual bool Init() 41 { 42 return true; 43 } DeletePointerVisible(int32_t pid)44 virtual void DeletePointerVisible(int32_t pid) {} SetPointerVisible(int32_t pid,bool visible)45 virtual int32_t SetPointerVisible(int32_t pid, bool visible) 46 { 47 return 0; 48 } GetPointerVisible(int32_t pid)49 virtual bool GetPointerVisible(int32_t pid) 50 { 51 return true; 52 } SetPointerColor(int32_t color)53 virtual int32_t SetPointerColor(int32_t color) 54 { 55 return 0; 56 } GetPointerColor()57 virtual int32_t GetPointerColor() 58 { 59 return 0; 60 } SetPointerStyle(int32_t pid,int32_t windowId,PointerStyle pointerStyle)61 virtual int32_t SetPointerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle) 62 { 63 return 0; 64 } ClearWindowPointerStyle(int32_t pid,int32_t windowId)65 virtual int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId) 66 { 67 return 0; 68 } GetPointerStyle(int32_t pid,int32_t windowId,PointerStyle & pointerStyle)69 virtual int32_t GetPointerStyle(int32_t pid, int32_t windowId, PointerStyle &pointerStyle) 70 { 71 return 0; 72 } DrawPointerStyle(const PointerStyle & pointerStyle)73 virtual void DrawPointerStyle(const PointerStyle& pointerStyle) {} IsPointerVisible()74 virtual bool IsPointerVisible() 75 { 76 return false; 77 } SetPointerLocation(int32_t x,int32_t y)78 virtual void SetPointerLocation(int32_t x, int32_t y) {} SetMouseDisplayState(bool state)79 virtual void SetMouseDisplayState(bool state) {} GetMouseDisplayState()80 virtual bool GetMouseDisplayState() const 81 { 82 return true; 83 } SetCustomCursor(void * pixelMap,int32_t pid,int32_t windowId,int32_t focusX,int32_t focusY)84 virtual int32_t SetCustomCursor(void* pixelMap, int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) 85 { 86 return 0; 87 } SetMouseIcon(int32_t pid,int32_t windowId,void * pixelMap)88 virtual int32_t SetMouseIcon(int32_t pid, int32_t windowId, void* pixelMap) 89 { 90 return 0; 91 } SetMouseHotSpot(int32_t pid,int32_t windowId,int32_t hotSpotX,int32_t hotSpotY)92 virtual int32_t SetMouseHotSpot(int32_t pid, int32_t windowId, int32_t hotSpotX, int32_t hotSpotY) 93 { 94 return 0; 95 } SetPointerSize(int32_t size)96 virtual int32_t SetPointerSize(int32_t size) 97 { 98 return 0; 99 } GetPointerSize()100 virtual int32_t GetPointerSize() 101 { 102 return 0; 103 } GetLastMouseStyle()104 virtual PointerStyle GetLastMouseStyle() 105 { 106 return {}; 107 } GetMouseIconPath()108 virtual std::map<MOUSE_ICON, IconStyle> GetMouseIconPath() 109 { 110 return {}; 111 } 112 public: 113 static inline std::shared_ptr<IPointerDrawingManager> iPointDrawMgr_ { nullptr }; 114 }; 115 } // namespace MMI 116 } // namespace OHOS 117 #endif // I_POINTER_DRAWING_MANAGER_H 118