• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 INTERFACES_INNERKITS_WMCLIENT_WINDOW_H
17 #define INTERFACES_INNERKITS_WMCLIENT_WINDOW_H
18 
19 #include <refbase.h>
20 #include <surface.h>
21 #include <promise.h>
22 
23 #include "window_manager_type.h"
24 
25 namespace OHOS {
26 class Window : public RefBase {
27 public:
28     virtual sptr<Surface> GetSurface() const = 0;
29     virtual sptr<IBufferProducer> GetProducer() const = 0;
30     virtual int32_t       GetID() const = 0;
31     virtual int32_t       GetX() const = 0;
32     virtual int32_t       GetY() const = 0;
33     virtual uint32_t      GetWidth() const = 0;
34     virtual uint32_t      GetHeight() const = 0;
35     virtual uint32_t      GetDestWidth() const = 0;
36     virtual uint32_t      GetDestHeight() const = 0;
37     virtual bool          GetVisibility() const = 0;
38     virtual WindowType    GetType() const = 0;
39     virtual WindowMode    GetMode() const = 0;
40 
41     virtual sptr<Promise<GSError>> Show() = 0;
42     virtual sptr<Promise<GSError>> Hide() = 0;
43     virtual sptr<Promise<GSError>> Move(int32_t x, int32_t y) = 0;
44     virtual sptr<Promise<GSError>> SwitchTop() = 0;
45     virtual sptr<Promise<GSError>> SetWindowType(WindowType type) = 0;
46     virtual sptr<Promise<GSError>> SetWindowMode(WindowMode mode) = 0;
47     virtual sptr<Promise<GSError>> Resize(uint32_t width, uint32_t height) = 0;
48     virtual sptr<Promise<GSError>> ScaleTo(uint32_t width, uint32_t height) = 0;
49     virtual GSError Rotate(WindowRotateType type) = 0;
50     virtual GSError Destroy() = 0;
51 
52     // prop listener
53     virtual void OnPositionChange(WindowPositionChangeFunc func) = 0;
54     virtual void OnSizeChange(WindowSizeChangeFunc func) = 0;
55     virtual void OnVisibilityChange(WindowVisibilityChangeFunc func) = 0;
56     virtual void OnTypeChange(WindowTypeChangeFunc func) = 0;
57     virtual void OnModeChange(WindowModeChangeFunc func) = 0;
58     virtual void OnSplitStatusChange(SplitStatusChangeFunc func) = 0;
59     virtual void OnBeforeFrameSubmit(BeforeFrameSubmitFunc func) = 0;
60 
61     // pip Mode
GetPIPMode()62     virtual bool GetPIPMode() const
63     {
64         return false;
65     }
66 
EnterPIPMode(int32_t x,int32_t y,uint32_t width,uint32_t height)67     virtual GSError EnterPIPMode(int32_t x, int32_t y,
68                                  uint32_t width, uint32_t height)
69     {
70         return GSERROR_NOT_SUPPORT;
71     }
ExitPIPMode()72     virtual GSError ExitPIPMode()
73     {
74         return GSERROR_NOT_SUPPORT;
75     }
OnPIPModeChange(WindowPIPModeChangeFunc func)76     virtual GSError OnPIPModeChange(WindowPIPModeChangeFunc func)
77     {
78         return GSERROR_NOT_SUPPORT;
79     }
80 };
81 } // namespace OHOS
82 
83 #endif // INTERFACES_INNERKITS_WMCLIENT_WINDOW_H
84