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 OHOS_WINDOW_AGENT_H
17 #define OHOS_WINDOW_AGENT_H
18 
19 #include "zidl/window_stub.h"
20 #include "window_impl.h"
21 #include "window_property.h"
22 #include "wm_common.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 class WindowAgent : public WindowStub {
27 public:
28     explicit WindowAgent(sptr<WindowImpl>& window);
29     ~WindowAgent() = default;
30     WMError UpdateWindowRect(const struct Rect& rect, bool decoStatus, WindowSizeChangeReason reason,
31         const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override;
32     WMError UpdateWindowMode(WindowMode mode) override;
33     WMError UpdateWindowModeSupportType(uint32_t windowModeSupportType) override;
34     WMError UpdateFocusStatus(bool focused) override;
35     WMError UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) override;
36     WMError UpdateWindowState(WindowState state) override;
37     WMError UpdateWindowDragInfo(const PointInfo& point, DragEvent event) override;
38     WMError UpdateDisplayId(DisplayId from, DisplayId to) override;
39     WMError UpdateOccupiedAreaChangeInfo(const sptr<OccupiedAreaChangeInfo>& info,
40         const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override;
41     WMError UpdateOccupiedAreaAndRect(const sptr<OccupiedAreaChangeInfo>& info, const Rect& rect,
42         const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override;
43     WMError UpdateActiveStatus(bool isActive) override;
44     sptr<WindowProperty> GetWindowProperty() override;
45     WMError NotifyTouchOutside() override;
46     WMError NotifyScreenshot() override;
47     WMError DumpInfo(const std::vector<std::string>& params) override;
48     WMError NotifyDestroy(void) override;
49     WMError NotifyForeground(void) override;
50     WMError NotifyBackground(void) override;
51     WMError NotifyWindowClientPointUp(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override;
52     WMError UpdateZoomTransform(const Transform& trans, bool isDisplayZoomOn) override;
53     WMError RestoreSplitWindowMode(uint32_t mode) override;
54     void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent> event) override;
55     void NotifyForegroundInteractiveStatus(bool interactive) override;
56 
57 private:
58     sptr<WindowImpl> window_;
59 };
60 } // namespace Rosen
61 } // namespace OHOS
62 #endif // OHOS_WINDOW_AGENT_H
63