1 /*
2  * Copyright (c) 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 OHOS_WINDOW_INTERFACE_H
17 #define OHOS_WINDOW_INTERFACE_H
18 
19 #include "iremote_broker.h"
20 #include "window.h"
21 #include "window_property.h"
22 #include "wm_common.h"
23 #include "wm_common_inner.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 class RSTransaction;
28 class IWindow : public IRemoteBroker {
29 public:
30     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindow");
31 
32     enum class WindowMessage : uint32_t {
33         TRANS_ID_UPDATE_WINDOW_RECT,
34         TRANS_ID_UPDATE_WINDOW_MODE,
35         TRANS_ID_UPDATE_MODE_SUPPORT_INFO,
36         TRANS_ID_UPDATE_FOCUS_STATUS,
37         TRANS_ID_UPDATE_AVOID_AREA,
38         TRANS_ID_UPDATE_WINDOW_STATE,
39         TRANS_ID_UPDATE_DRAG_EVENT,
40         TRANS_ID_UPDATE_DISPLAY_ID,
41         TRANS_ID_UPDATE_OCCUPIED_AREA,
42         TRANS_ID_UPDATE_OCCUPIED_AREA_AND_RECT,
43         TRANS_ID_UPDATE_ACTIVE_STATUS,
44         TRANS_ID_GET_WINDOW_PROPERTY,
45         TRANS_ID_NOTIFY_OUTSIDE_PRESSED,
46         TRANS_ID_NOTIFY_SCREEN_SHOT,
47         TRANS_ID_DUMP_INFO,
48         TRANS_ID_NOTIFY_DESTROY,
49         TRANS_ID_NOTIFY_FOREGROUND,
50         TRANS_ID_NOTIFY_BACKGROUND,
51         TRANS_ID_NOTIFY_CLIENT_POINT_UP,
52         TRANS_ID_UPDATE_ZOOM_TRANSFORM,
53         TRANS_ID_RESTORE_SPLIT_WINDOW_MODE,
54         TRANS_ID_CONSUME_KEY_EVENT,
55         TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS,
56     };
57 
58     virtual WMError UpdateWindowRect(const struct Rect& rect, bool decoStatus, WindowSizeChangeReason reason,
59         const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) = 0;
60     virtual WMError UpdateWindowMode(WindowMode mode) = 0;
61     virtual WMError UpdateWindowModeSupportType(uint32_t windowModeSupportType) = 0;
62     virtual WMError UpdateFocusStatus(bool focused) = 0;
63     virtual WMError UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) = 0;
64     virtual WMError UpdateWindowState(WindowState state) = 0;
65     virtual WMError UpdateWindowDragInfo(const PointInfo& point, DragEvent event) = 0;
66     virtual WMError UpdateDisplayId(DisplayId from, DisplayId to) = 0;
67     virtual WMError UpdateOccupiedAreaChangeInfo(const sptr<OccupiedAreaChangeInfo>& info,
68         const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) = 0;
69     virtual WMError UpdateActiveStatus(bool isActive) = 0;
70     virtual sptr<WindowProperty> GetWindowProperty() = 0;
71     virtual WMError NotifyTouchOutside() = 0;
72     virtual WMError NotifyScreenshot() = 0;
73     virtual WMError DumpInfo(const std::vector<std::string>& params) = 0;
74     virtual WMError NotifyDestroy(void) = 0;
75     virtual WMError NotifyForeground(void) = 0;
76     virtual WMError NotifyBackground(void) = 0;
77     virtual WMError NotifyWindowClientPointUp(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) = 0;
78     virtual WMError UpdateZoomTransform(const Transform& trans, bool isDisplayZoomOn) = 0;
79     virtual WMError RestoreSplitWindowMode(uint32_t mode) = 0;
80     virtual void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent> event) = 0;
81     virtual WMError UpdateOccupiedAreaAndRect(const sptr<OccupiedAreaChangeInfo>& info, const Rect& rect,
82         const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) = 0;
83     virtual void NotifyForegroundInteractiveStatus(bool interactive) = 0;
84 };
85 } // namespace Rosen
86 } // namespace OHOS
87 #endif // OHOS_WINDOW_INTERFACE_H
88