1 /*
2  * Copyright (c) 2020-2021 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 GRAPHIC_LITE_IWINDOWS_MANAGER_H
17 #define GRAPHIC_LITE_IWINDOWS_MANAGER_H
18 
19 #include "iwindow.h"
20 #include "gfx_utils/geometry2d.h"
21 #include "gfx_utils/input_event_info.h"
22 #include "gfx_utils/list.h"
23 
24 namespace OHOS {
25 /**
26  * @brief The IWindowsManager class is an abstract definition of windows manager.
27  *        Provides a series of client/interfaces for window management, event processing, etc.
28  */
29 class IWindowsManager {
30 public:
31     class ScreenshotListener {
32     public:
33         virtual void OnScreenshotEnd(uint8_t* virAddr, uint32_t width, uint32_t height,
34                                      ImagePixelFormat format, uint32_t stride) = 0;
35     };
36 
IWindowsManager()37     IWindowsManager() {}
38 
~IWindowsManager()39     virtual ~IWindowsManager() {}
40 
41     /**
42      * @brief Get the IWindowsManager's singleton.
43      * @return IWindowsManager's singleton
44      */
45     static IWindowsManager* GetInstance();
46 
47     /**
48      * @brief Do some initialization after creating the windows manager object.
49      * @return The result of initialize.
50      */
51     virtual int Init() = 0;
52 
53     virtual IWindow* CreateWindow(const LiteWinConfig& config) = 0;
54 
55     virtual void RemoveWindow(IWindow* win) = 0;
56 
57     virtual void GetEventData(DeviceData* data) = 0;
58 
59     virtual void Screenshot() = 0;
60 
61     virtual void SetScreenshotListener(ScreenshotListener* listener) = 0;
62 };
63 }
64 #endif // GRAPHIC_LITE_IWINDOWS_MANAGER_H
65