• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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_ROSEN_WINDOW_H
17 #define OHOS_ROSEN_WINDOW_H
18 
19 #include <parcel.h>
20 #include <refbase.h>
21 #include <pixel_map.h>
22 #include <iremote_object.h>
23 
24 #include "wm_common.h"
25 #include "window_option.h"
26 
27 typedef struct napi_env__* napi_env;
28 typedef struct napi_value__* napi_value;
29 
30 namespace OHOS::MMI {
31 class PointerEvent;
32 class KeyEvent;
33 class AxisEvent;
34 }
35 
36 namespace OHOS::AppExecFwk {
37 class Configuration;
38 class Ability;
39 enum class SupportWindowMode;
40 }
41 
42 namespace OHOS::Global::Resource {
43 class ResourceManager;
44 } // namespace OHOS::Global::Resource
45 
46 namespace OHOS::AbilityRuntime {
47 class AbilityContext;
48 class Context;
49 }
50 
51 namespace OHOS::Ace {
52 class UIContent;
53 class ViewportConfig;
54 }
55 
56 namespace OHOS::AAFwk {
57 class Want;
58 }
59 
60 namespace OHOS {
61 namespace Rosen {
62 class RSSurfaceNode;
63 class RSTransaction;
64 using NotifyNativeWinDestroyFunc = std::function<void(std::string windowName)>;
65 using SendRenderDataCallback = bool (*)(const void*, const size_t, const int32_t, const int32_t, const uint64_t);
66 using ContentInfoCallback = std::function<void(std::string contentInfo)>;
67 
68 class IWindowLifeCycle : virtual public RefBase {
69 };
70 class IWindowChangeListener : virtual public RefBase {
71 };
72 class IWindowSystemBarEnableListener : virtual public RefBase {
73 public:
74     virtual WMError OnSetSpecificBarProperty(WindowType type, const SystemBarProperty& property) = 0;
75 };
76 class IIgnoreViewSafeAreaListener : virtual public RefBase {
77 public:
78     virtual void SetIgnoreViewSafeArea(bool ignoreViewSafeArea) = 0;
79 };
80 class IAvoidAreaChangedListener : virtual public RefBase {
81 public:
OnAvoidAreaChanged(const AvoidArea avoidArea,AvoidAreaType type)82     virtual void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) {}
83 };
84 class IWindowDragListener : virtual public RefBase {
85 };
86 class IDisplayMoveListener : virtual public RefBase {
87 };
88 class IDispatchInputEventListener : virtual public RefBase {
89 };
90 class OccupiedAreaChangeInfo : public Parcelable {
91 public:
92     virtual bool Marshalling(Parcel& parcel) const override;
93     static OccupiedAreaChangeInfo* Unmarshalling(Parcel& parcel);
94 };
95 class IOccupiedAreaChangeListener : virtual public RefBase {
96 };
97 class IAceAbilityHandler : virtual public RefBase {
98 };
99 class IInputEventConsumer {
100 };
101 class ITouchOutsideListener : virtual public RefBase {
102 };
103 class IAnimationTransitionController : virtual public RefBase {
104 public:
105     virtual void AnimationForShown() = 0;
106     virtual void AnimationForHidden() = 0;
107 };
108 class IScreenshotListener : virtual public RefBase {
109 };
110 class IDialogTargetTouchListener : virtual public RefBase {
111 };
112 class IDialogDeathRecipientListener : virtual public RefBase {
113 };
114 class IWindowTitleButtonRectChangedListener : virtual public RefBase {
115 };
116 class IWindowVisibilityChangedListener : virtual public RefBase {
117 };
118 
119 using WindowVisibilityListenerSptr = sptr<IWindowVisibilityChangedListener>;
120 
121 class IWindowNoInteractionListener : virtual public RefBase {
122 };
123 using IWindowNoInteractionListenerSptr = sptr<IWindowNoInteractionListener>;
124 
125 static WMError DefaultCreateErrCode = WMError::WM_OK;
126 class WINDOW_EXPORT Window : public RefBase {
127 public:
128     static sptr<Window> Create(const std::string& windowName,
129     sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context = nullptr,
130     WMError& errCode = DefaultCreateErrCode);
131     static sptr<Window> Find(const std::string& windowName);
132     static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr);
133     static sptr<Window> GetTopWindowWithId(uint32_t mainWinId);
134     static std::vector<sptr<Window>> GetSubWindow(uint32_t parentId);
135     static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration,
136        const std::vector<std::shared_ptr<AbilityRuntime::Context>>& ignoreWindowContexts = {});
137     static void UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration);
138     virtual std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const = 0;
139     virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const = 0;
140     virtual Rect GetRect() const = 0;
141     virtual Rect GetRequestRect() const = 0;
142     virtual WindowType GetType() const = 0;
143     virtual WindowMode GetWindowMode() const = 0;
144     virtual float GetAlpha() const = 0;
145     virtual const std::string& GetWindowName() const = 0;
146     virtual uint32_t GetWindowId() const = 0;
147     virtual uint64_t GetDisplayId() const = 0;
148     virtual uint32_t GetWindowFlags() const = 0;
149     virtual WindowState GetWindowState() const = 0;
150     virtual WMError SetFocusable(bool isFocusable) = 0;
151     virtual bool GetFocusable() const = 0;
152     virtual WMError SetTouchable(bool isTouchable) = 0;
153     virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const = 0;
154     virtual bool GetTouchable() const = 0;
155     virtual bool IsLayoutFullScreen() const = 0;
156     virtual bool IsFullScreen() const = 0;
157     virtual WMError SetWindowMode(WindowMode mode) = 0;
158     virtual WMError SetWindowType(WindowType type) = 0;
159     virtual WMError SetAlpha(float alpha) = 0;
160     virtual WMError SetTransform(const Transform& trans) = 0;
161     virtual const Transform& GetTransform() const = 0;
162     virtual WMError RemoveWindowFlag(WindowFlag flag) = 0;
163     virtual WMError AddWindowFlag(WindowFlag flag) = 0;
164     virtual WMError SetWindowFlags(uint32_t flags) = 0;
IsWindowRectAutoSave(bool & enabled)165     virtual WMError IsWindowRectAutoSave(bool& enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
166     virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) = 0;
SetAvoidAreaOption(uint32_t avoidAreaOption)167     virtual WMError SetAvoidAreaOption(uint32_t avoidAreaOption) { return WMError::WM_OK; }
GetAvoidAreaOption(uint32_t & avoidAreaOption)168     virtual WMError GetAvoidAreaOption(uint32_t& avoidAreaOption) { return WMError::WM_OK; }
UpdateSystemBarProperties(const std::unordered_map<WindowType,SystemBarProperty> & systemBarProperties,const std::unordered_map<WindowType,SystemBarPropertyFlag> & systemBarPropertyFlags)169     virtual WMError UpdateSystemBarProperties(
170         const std::unordered_map<WindowType, SystemBarProperty>& systemBarProperties,
171         const std::unordered_map<WindowType, SystemBarPropertyFlag>& systemBarPropertyFlags)
172         { return WMError::WM_OK; }
UpdateSpecificSystemBarEnabled(bool systemBarEnable,bool systemBarEnableAnimation,SystemBarProperty & property)173     virtual void UpdateSpecificSystemBarEnabled(bool systemBarEnable, bool systemBarEnableAnimation,
174         SystemBarProperty& property) {}
175     virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) = 0;
176     virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) = 0;
177     virtual WMError SetSystemBarProperties(const std::map<WindowType, SystemBarProperty>& properties,
178         const std::map<WindowType, SystemBarPropertyFlag>& propertyFlags) = 0;
179     virtual WMError GetSystemBarProperties(std::map<WindowType, SystemBarProperty>& properties) = 0;
180     virtual WMError SetFullScreen(bool status) = 0;
181     virtual WMError SetLayoutFullScreen(bool status) = 0;
182     virtual WMError SetTitleAndDockHoverShown(bool titleHoverShowEnabled = true,
183         bool dockHoverShowEnabled = true) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
184     virtual WMError Destroy() = 0;
185     virtual WMError Show(uint32_t reason = 0, bool withAnimation = false, bool withFocus = true) = 0;
186     virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) = 0;
187     virtual WMError MoveTo(int32_t x, int32_t y, bool isMoveToGlobal = false,
188         MoveConfiguration moveConfiguration = {}) = 0;
189     virtual WMError MoveToAsync(int32_t x, int32_t y,
190         MoveConfiguration moveConfiguration = {}) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
MoveWindowToGlobal(int32_t x,int32_t y,MoveConfiguration moveConfiguration)191     virtual WMError MoveWindowToGlobal(int32_t x, int32_t y,
192         MoveConfiguration moveConfiguration) { return WMError::WM_OK; }
GetGlobalScaledRect(Rect & globalScaledRect)193     virtual WMError GetGlobalScaledRect(Rect& globalScaledRect) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
194     virtual WMError Resize(uint32_t width, uint32_t height, const RectAnimationConfig& rectAnimationConfig = {}) = 0;
195     virtual WMError ResizeAsync(uint32_t width, uint32_t height,
196         const RectAnimationConfig& rectAnimationConfig = {}) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
197     virtual WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) = 0;
198     virtual WMError SetKeepScreenOn(bool keepScreenOn) = 0;
199     virtual bool IsKeepScreenOn() const = 0;
200     virtual WMError SetTurnScreenOn(bool turnScreenOn) = 0;
201     virtual bool IsTurnScreenOn() const = 0;
202     virtual WMError SetBackgroundColor(const std::string& color) = 0;
203     virtual WMError SetTransparent(bool isTransparent) = 0;
204     virtual bool IsTransparent() const = 0;
205     virtual WMError SetBrightness(float brightness) = 0;
206     virtual float GetBrightness() const = 0;
207     virtual WMError SetCallingWindow(uint32_t windowId) = 0;
208     virtual WMError SetPrivacyMode(bool isPrivacyMode) = 0;
209     virtual bool IsPrivacyMode() const = 0;
210     virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) = 0;
211     virtual WMError BindDialogTarget(sptr<IRemoteObject> targetToken) = 0;
212     virtual WMError SetDialogBackGestureEnabled(bool isEnabled) = 0;
213     virtual WMError RaiseToAppTop() = 0;
214     virtual WMError SetSnapshotSkip(bool isSkip) = 0;
215     virtual WMError SetCornerRadius(float cornerRadius) = 0;
SetWindowCornerRadius(float radius)216     virtual WMError SetWindowCornerRadius(float radius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
GetWindowCornerRadius(float & radius)217     virtual WMError GetWindowCornerRadius(float& radius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
218     virtual WMError SetShadowRadius(float radius) = 0;
SetWindowShadowRadius(float radius)219     virtual WMError SetWindowShadowRadius(float radius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
220     virtual WMError SetShadowColor(std::string color) = 0;
221     virtual WMError SetShadowOffsetX(float offsetX) = 0;
222     virtual WMError SetShadowOffsetY(float offsetY) = 0;
223     virtual WMError SetBlur(float radius) = 0;
224     virtual WMError SetBackdropBlur(float radius) = 0;
225     virtual WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) = 0;
226     virtual WMError RequestFocus() const = 0;
RequestFocusByClient(bool isFocused)227     virtual WMError RequestFocusByClient(bool isFocused) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
228     virtual bool IsFocused() const = 0;
229     virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) = 0;
230     virtual void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) = 0;
231     virtual void ConsumeKeyEvent(const std::shared_ptr<MMI::KeyEvent>& inputEvent) = 0;
232     virtual void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& inputEvent) = 0;
233     virtual void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) = 0;
234     virtual int64_t GetVSyncPeriod() = 0;
FlushFrameRate(uint32_t rate,int32_t animatorExpectedFrameRate,uint32_t rateType)235     virtual void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType) {}
236     virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) = 0;
237     virtual void UpdateConfigurationForSpecified(const std::shared_ptr<AppExecFwk::Configuration>& configuration,
238         const std::shared_ptr<Global::Resource::ResourceManager>& resourceManager) = 0;
239     virtual void UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration>& configuration) = 0;
240     virtual WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) = 0;
241     virtual WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) = 0;
242     virtual WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) = 0;
243     virtual WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) = 0;
244     virtual WMError RegisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener>& listener) = 0;
245     virtual WMError UnregisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener>& listener) = 0;
246     virtual WMError RegisterDragListener(const sptr<IWindowDragListener>& listener) = 0;
247     virtual WMError UnregisterDragListener(const sptr<IWindowDragListener>& listener) = 0;
248     virtual WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) = 0;
249     virtual WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) = 0;
250     virtual void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) = 0;
UnregisterWindowDestroyedListener()251     virtual void UnregisterWindowDestroyedListener() {}
252     virtual WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) = 0;
253     virtual WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) = 0;
254     virtual WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) = 0;
255     virtual WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) = 0;
256     virtual WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener) = 0;
257     virtual WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) = 0;
258     virtual WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) = 0;
259     virtual WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) = 0;
260     virtual WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) = 0;
261     virtual void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) = 0;
262     virtual void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) = 0;
263     virtual WMError RegisterSystemBarEnableListener(const sptr<IWindowSystemBarEnableListener>& listener) = 0;
264     virtual WMError UnRegisterSystemBarEnableListener(const sptr<IWindowSystemBarEnableListener>& listener) = 0;
265     virtual WMError RegisterIgnoreViewSafeAreaListener(const sptr<IIgnoreViewSafeAreaListener>& listener) = 0;
266     virtual WMError UnRegisterIgnoreViewSafeAreaListener(const sptr<IIgnoreViewSafeAreaListener>& listener) = 0;
267     virtual void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) = 0;
268     virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) = 0;
269     virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage,
270         BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr,
271         AppExecFwk::Ability* ability = nullptr) = 0;
272     virtual WMError NapiSetUIContentByName(const std::string& contentName, napi_env env, napi_value storage,
273         BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr,
274         AppExecFwk::Ability* ability = nullptr) { return WMError::WM_OK; }
275     virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage,
276         AppExecFwk::Ability* ability = nullptr)
277     {
278         return WMError::WM_OK;
279     }
280     virtual WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage,
281         AppExecFwk::Ability* ability = nullptr)
282     {
283         return WMError::WM_OK;
284     }
285     virtual std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION) = 0;
286     virtual Ace::UIContent* GetUIContent() const = 0;
287     virtual void OnNewWant(const AAFwk::Want& want) = 0;
288     virtual void SetRequestedOrientation(Orientation) = 0;
289     virtual Orientation GetRequestedOrientation() = 0;
290     virtual void SetRequestWindowModeSupportType(uint32_t windowModeSupportType) = 0;
291     virtual uint32_t GetRequestWindowModeSupportType() const = 0;
292     virtual WMError SetTouchHotAreas(const std::vector<Rect>& rects) = 0;
293     virtual void GetRequestedTouchHotAreas(std::vector<Rect>& rects) const = 0;
294     virtual bool IsMainHandlerAvailable() const = 0;
295     virtual WMError SetAPPWindowLabel(const std::string& label) = 0;
296     virtual WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) = 0;
297     virtual WMError DisableAppWindowDecor() = 0;
298     virtual WMError Minimize() = 0;
299     virtual WMError Maximize() = 0;
300     virtual WMError Recover() = 0;
Restore()301     virtual WMError Restore() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
302     virtual WMError SetWindowRectAutoSave(bool enabled,
303         bool isSaveBySpecifiedFlag = false) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
SetSupportedWindowModes(const std::vector<AppExecFwk::SupportWindowMode> & supportedWindowModes)304     virtual WMError SetSupportedWindowModes(const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes)
305     {
306         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
307     }
SetFollowParentMultiScreenPolicy(bool enabled)308     virtual WMError SetFollowParentMultiScreenPolicy(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
309     virtual void StartMove() = 0;
StartMoveWindow()310     virtual WmErrorCode StartMoveWindow() { return WmErrorCode::WM_OK; }
StartMoveWindowWithCoordinate(int32_t offsetX,int32_t offsetY)311     virtual WmErrorCode StartMoveWindowWithCoordinate(int32_t offsetX,
312         int32_t offsetY) { return WmErrorCode::WM_OK; }
StopMoveWindow()313     virtual WmErrorCode StopMoveWindow() { return WmErrorCode::WM_OK; }
314     virtual WMError Close() = 0;
315     virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) = 0;
316     virtual bool IsSupportWideGamut() = 0;
317     virtual void SetColorSpace(ColorSpace colorSpace) = 0;
318     virtual ColorSpace GetColorSpace() = 0;
319     virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) = 0;
320     virtual std::shared_ptr<Media::PixelMap> Snapshot() = 0;
321     virtual WMError SnapshotIgnorePrivacy(std::shared_ptr<Media::PixelMap>& pixelMap) = 0;
322     virtual WMError NotifyMemoryLevel(int32_t level) = 0;
323     virtual bool IsAllowHaveSystemSubWindow() = 0;
324     virtual WMError SetAspectRatio(float ratio) = 0;
325     virtual WMError ResetAspectRatio() = 0;
326     virtual KeyboardAnimationConfig GetKeyboardAnimationConfig() = 0;
327     virtual void SetNeedDefaultAnimation(bool needDefaultAnimation) = 0;
328 
329     virtual void SetViewportConfig(const Ace::ViewportConfig& config) = 0;
330     virtual void UpdateViewportConfig() = 0;
331     virtual void SetOrientation(Orientation orientation) = 0;
332     virtual void SetSize(int32_t width, int32_t height) = 0;
333     virtual void SetDensity(float density) = 0;
SetDefaultDensityEnabled(bool enabled)334     virtual WMError SetDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
GetDefaultDensityEnabled()335     virtual bool GetDefaultDensityEnabled() { return false; }
SetCustomDensity(float density)336     virtual WMError SetCustomDensity(float density) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
GetCustomDensity()337     virtual float GetCustomDensity() const { return UNDEFINED_DENSITY; }
GetWindowDensityInfo(WindowDensityInfo & densityInfo)338     virtual WMError GetWindowDensityInfo(
339         WindowDensityInfo& densityInfo) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
GetVirtualPixelRatio()340     virtual float GetVirtualPixelRatio() { return 1.0f; }
341     virtual void UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type);
342     virtual void CreateSurfaceNode(const std::string name, const SendRenderDataCallback& callback) = 0;
343     virtual void SetContentInfoCallback(const ContentInfoCallback& callback) = 0;
344     virtual WMError SetResizeByDragEnabled(bool dragEnabled) = 0;
345     virtual WMError SetRaiseByClickEnabled(bool raiseEnabled) = 0;
346     virtual WMError RaiseAboveTarget(int32_t subWindowId) = 0;
SetTopmost(bool topmost)347     virtual WMError SetTopmost(bool topmost) { return WMError::WM_OK; }
IsTopmost()348     virtual bool IsTopmost() const { return false; }
SetMainWindowTopmost(bool isTopmost)349     virtual WMError SetMainWindowTopmost(bool isTopmost) { return WMError::WM_OK; }
IsMainWindowTopmost()350     virtual bool IsMainWindowTopmost() const { return false; }
351     virtual WMError HideNonSystemFloatingWindows(bool shouldHide) = 0;
IsFloatingWindowAppType()352     virtual bool IsFloatingWindowAppType() const { return false; }
IsPcWindow()353     virtual bool IsPcWindow() const { return false; }
IsPcOrPadCapabilityEnabled()354     virtual bool IsPcOrPadCapabilityEnabled() const { return false; }
IsPcOrPadFreeMultiWindowMode()355     virtual bool IsPcOrPadFreeMultiWindowMode() const { return false; }
IsSceneBoardEnabled()356     virtual bool IsSceneBoardEnabled() const { return false; }
GetCompatibleModeInPc()357     virtual bool GetCompatibleModeInPc() const { return false; }
358     virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) = 0;
359     virtual WMError RegisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0;
360     virtual WMError UnregisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0;
361     virtual WMError SetWindowLimits(WindowLimits& windowLimits, bool isForcible = false) { return WMError::WM_OK; }
GetWindowLimits(WindowLimits & windowLimits)362     virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; }
EnableDrag(bool enableDrag)363     virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)364     virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener)
365     {
366         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
367     }
UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)368     virtual WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener)
369     {
370         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
371     }
372     virtual WMError SetSingleFrameComposerEnabled(bool enable) = 0;
373     virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) = 0;
SetDecorVisible(bool isVisible)374     virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
GetDecorVisible(bool & isVisible)375     virtual WMError GetDecorVisible(bool& isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
SetWindowTitleMoveEnabled(bool enable)376     virtual WMError SetWindowTitleMoveEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
SetWindowTitle(const std::string & title)377     virtual WMError SetWindowTitle(const std::string& title) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
SetTitleButtonVisible(bool isMaximizeVisible,bool isMinimizeVisible,bool isSplitVisible,bool isCloseVisible)378     virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible,
379         bool isCloseVisible)
380     {
381         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
382     }
SetDecorHeight(int32_t decorHeight)383     virtual WMError SetDecorHeight(int32_t decorHeight) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
GetDecorHeight(int32_t & height)384     virtual WMError GetDecorHeight(int32_t& height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
SetDecorButtonStyle(const DecorButtonStyle & style)385     virtual WMError SetDecorButtonStyle(const DecorButtonStyle& style)
386     {
387         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
388     }
GetDecorButtonStyle(DecorButtonStyle & style)389     virtual WMError GetDecorButtonStyle(DecorButtonStyle& style) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
GetTitleButtonArea(TitleButtonRect & titleButtonRect)390     virtual WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect)
391     {
392         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
393     }
SetWindowContainerColor(const std::string & activeColor,const std::string & inactiveColor)394     virtual WMError SetWindowContainerColor(const std::string& activeColor, const std::string& inactiveColor)
395     {
396         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
397     }
RegisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)398     virtual WMError RegisterWindowTitleButtonRectChangeListener(
399         const sptr<IWindowTitleButtonRectChangedListener>& listener)
400     {
401         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
402     }
UnregisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)403     virtual WMError UnregisterWindowTitleButtonRectChangeListener(
404         const sptr<IWindowTitleButtonRectChangedListener>& listener)
405     {
406         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
407     }
408 
409     /**
410      * @brief Set the application modality of main window.
411      *
412      * @param isModal bool.
413      * @return WMError
414      */
SetWindowModal(bool isModal)415     virtual WMError SetWindowModal(bool isModal) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
416 
417     /**
418      * @brief Set the modality of sub window.
419      *
420      * @param isModal bool.
421      * @param modalityType ModalityType.
422      * @return WMError
423      */
424     virtual WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY)
425     {
426         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
427     }
428 
429     /**
430      * @brief Set sub window zLevel
431      *
432      * @param zLevel zLevel of sub window to specify the hierarchical relationship among sub windows
433      * @return WM_OK means success, others mean set failed
434      */
SetSubWindowZLevel(int32_t zLevel)435     virtual WMError SetSubWindowZLevel(int32_t zLevel)
436     {
437         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
438     }
439 
440     /**
441      * @brief Get sub window zLevel
442      *
443      * @param zLevel sub window zLevel
444      * @return WM_OK means success, others mean get failed
445      */
GetSubWindowZLevel(int32_t & zLevel)446     virtual WMError GetSubWindowZLevel(int32_t& zLevel)
447     {
448         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
449     }
450 
451     virtual WMError Recover(uint32_t reason = 0) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
452 
Maximize(MaximizePresentation present)453     virtual WMError Maximize(MaximizePresentation present) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
454 
SetWindowMask(const std::vector<std::vector<uint32_t>> & windowMask)455     virtual WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask)
456     {
457         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
458     }
459 
SetGrayScale(float grayScale)460     virtual WMError SetGrayScale(float grayScale) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
461 
462     /**
463      * @brief Set the Dvsync object
464      *
465      * @param dvsyncSwitch bool.
466      * @return * void
467      */
SetUiDvsyncSwitch(bool dvsyncSwitch)468     virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) {}
469 
SetImmersiveModeEnabledState(bool enable)470     virtual WMError SetImmersiveModeEnabledState(bool enable) { return WMError::WM_OK; }
471 
GetImmersiveModeEnabledState()472     virtual bool GetImmersiveModeEnabledState() const { return true; }
473 
GetWindowStatus(WindowStatus & windowStatus)474     virtual WMError GetWindowStatus(WindowStatus& windowStatus) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
475 
NotifyExtensionTimeout(int32_t errorCode)476     virtual void NotifyExtensionTimeout(int32_t errorCode) {}
477 
478     /**
479      * @brief Set whether to enable gesture back.
480      * @param enable the value true means to enable gesture back, and false means the opposite.
481      * @return WM_OK means set success, others means set failed.
482      */
SetGestureBackEnabled(bool enable)483     virtual WMError SetGestureBackEnabled(bool enable) { return WMError::WM_OK; }
484 
485     /**
486      * @brief Get whether to enable gesture back.
487      * @param enable the value true means to enable gesture back, and false means the opposite.
488      * @return WM_OK means get success, others means get failed.
489      */
GetGestureBackEnabled(bool & enable)490     virtual WMError GetGestureBackEnabled(bool& enable) { return WMError::WM_OK; }
491 
492     /**
493      * @brief Flush layout size.
494      *
495      * @param width The width after layout
496      * @param height The height after layout
497      */
FlushLayoutSize(int32_t width,int32_t height)498     virtual void FlushLayoutSize(int32_t width, int32_t height) {}
499 
500     /**
501      * @brief notify window remove starting window.
502      *
503      * @return WMError
504      */
NotifyRemoveStartingWindow()505     virtual WMError NotifyRemoveStartingWindow() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
506 
507     /**
508      * @brief Enable or disable window delay raise
509      *
510      * @param isEnabled Enable or disable window delay raise
511      */
SetWindowDelayRaiseEnabled(bool isEnabled)512     virtual WMError SetWindowDelayRaiseEnabled(bool isEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
513 
514     /**
515      * @brief Get whether window delay raise is enabled
516      *
517      * @return True means window delay raise is enabled
518      */
IsWindowDelayRaiseEnabled()519     virtual bool IsWindowDelayRaiseEnabled() const { return false; }
520 
521     /**
522      * @brief Set whether to enable exclusively highlight.
523      *
524      * @param isExclusivelyHighlighted the value true means to exclusively highlight, and false means the opposite.
525      * @return WM_OK means set success, others means set failed.
526      */
SetExclusivelyHighlighted(bool isExclusivelyHighlighted)527     virtual WMError SetExclusivelyHighlighted(bool isExclusivelyHighlighted)
528     {
529         return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
530     }
531 
532     /**
533      * @brief Get highlight property of window.
534      *
535      * @param highlighted True means the window is highlighted, and false means the opposite.
536      * @return WM_OK means get success, others means get failed.
537      */
IsWindowHighlighted(bool & highlighted)538     virtual WMError IsWindowHighlighted(bool& highlighted) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
539 
540     /**
541      * @brief Get the api compatible version.
542      *
543      * @return Api compatible version
544      */
GetApiCompatibleVersion()545     virtual uint32_t GetApiCompatibleVersion() const { return 0; }
546 
547     /**
548      * @brief Get the root host window type of UIExtension.
549      *
550      * @return WindowType of the root host window.
551      */
GetRootHostWindowType()552     virtual WindowType GetRootHostWindowType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; }
553 
554     /**
555      * @brief Set the root host window type of UIExtension.
556      *
557      * @param WindowType of the root host window.
558      */
SetRootHostWindowType(WindowType & rootHostWindowType)559     virtual void SetRootHostWindowType(WindowType& rootHostWindowType) {}
560 
561     /**
562      * @brief Set the parent window of a sub window.
563      *
564      * @param newParentWindowId new parent window id.
565      * @return WM_OK means set parent window success, others means failed.
566      */
SetParentWindow(int32_t newParentWindowId)567     virtual WMError SetParentWindow(int32_t newParentWindowId) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
568 
569     /**
570      * @brief Get the parent window of a sub window.
571      *
572      * @param parentWindow parent window.
573      * @return WM_OK means get parent window success, others means failed.
574      */
GetParentWindow(sptr<Window> & parentWindow)575     virtual WMError GetParentWindow(sptr<Window>& parentWindow) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
576 
577     /**
578      * @brief Set the feature of subwindow follow the layout of the parent window.
579      *
580      * @param isFollow true - follow, false - not follow.
581      * @return WM_OK means set success.
582      */
SetFollowParentWindowLayoutEnabled(bool isFollow)583     virtual WMError SetFollowParentWindowLayoutEnabled(bool isFollow) { return WMError::WM_ERROR_SYSTEM_ABNORMALLY; }
584 
585       /**
586      * @brief Get is subwindow support maximize.
587      *
588      * @return true means subwindow support maximize, others means do not support.
589      */
IsSubWindowMaximizeSupported()590     virtual bool IsSubWindowMaximizeSupported() const { return false; }
591 };
592 }
593 }
594 #endif // OHOS_ROSEN_WINDOW_H
595