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 } 40 41 namespace OHOS::AbilityRuntime { 42 class AbilityContext; 43 class Context; 44 } 45 46 namespace OHOS::Ace { 47 class UIContent; 48 class ViewportConfig; 49 } 50 51 namespace OHOS::AAFwk { 52 class Want; 53 } 54 55 namespace OHOS { 56 namespace Rosen { 57 class RSSurfaceNode; 58 class RSTransaction; 59 using NotifyNativeWinDestroyFunc = std::function<void(std::string windowName)>; 60 using SendRenderDataCallback = bool (*)(const void*, const size_t, const int32_t, const int32_t, const uint64_t); 61 using ContentInfoCallback = std::function<void(std::string contentInfo)>; 62 63 class IWindowLifeCycle : virtual public RefBase { 64 }; 65 class IWindowChangeListener : virtual public RefBase { 66 }; 67 class IWindowSystemBarEnableListener : virtual public RefBase { 68 public: 69 virtual WMError OnSetSpecificBarProperty(WindowType type, const SystemBarProperty& property) = 0; 70 }; 71 class IIgnoreViewSafeAreaListener : virtual public RefBase { 72 public: 73 virtual void SetIgnoreViewSafeArea(bool ignoreViewSafeArea) = 0; 74 }; 75 class IAvoidAreaChangedListener : virtual public RefBase { 76 public: OnAvoidAreaChanged(const AvoidArea avoidArea,AvoidAreaType type)77 virtual void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) {} 78 }; 79 class IWindowDragListener : virtual public RefBase { 80 }; 81 class IDisplayMoveListener : virtual public RefBase { 82 }; 83 class IDispatchInputEventListener : virtual public RefBase { 84 }; 85 class OccupiedAreaChangeInfo : public Parcelable { 86 public: 87 virtual bool Marshalling(Parcel& parcel) const override; 88 static OccupiedAreaChangeInfo* Unmarshalling(Parcel& parcel); 89 }; 90 class IOccupiedAreaChangeListener : virtual public RefBase { 91 }; 92 class IAceAbilityHandler : virtual public RefBase { 93 }; 94 class IInputEventConsumer { 95 }; 96 class ITouchOutsideListener : virtual public RefBase { 97 }; 98 class IAnimationTransitionController : virtual public RefBase { 99 public: 100 virtual void AnimationForShown() = 0; 101 virtual void AnimationForHidden() = 0; 102 }; 103 class IScreenshotListener : virtual public RefBase { 104 }; 105 class IDialogTargetTouchListener : virtual public RefBase { 106 }; 107 class IDialogDeathRecipientListener : virtual public RefBase { 108 }; 109 class IWindowTitleButtonRectChangedListener : virtual public RefBase { 110 }; 111 class IWindowVisibilityChangedListener : virtual public RefBase { 112 }; 113 114 using WindowVisibilityListenerSptr = sptr<IWindowVisibilityChangedListener>; 115 116 class IWindowNoInteractionListener : virtual public RefBase { 117 }; 118 using IWindowNoInteractionListenerSptr = sptr<IWindowNoInteractionListener>; 119 120 static WMError DefaultCreateErrCode = WMError::WM_OK; 121 class WINDOW_EXPORT Window : public RefBase { 122 public: 123 static sptr<Window> Create(const std::string& windowName, 124 sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context = nullptr, 125 WMError& errCode = DefaultCreateErrCode); 126 static sptr<Window> Find(const std::string& windowName); 127 static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 128 static sptr<Window> GetTopWindowWithId(uint32_t mainWinId); 129 static std::vector<sptr<Window>> GetSubWindow(uint32_t parentId); 130 static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 131 static void UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 132 virtual std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const = 0; 133 virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const = 0; 134 virtual Rect GetRect() const = 0; 135 virtual Rect GetRequestRect() const = 0; 136 virtual WindowType GetType() const = 0; 137 virtual WindowMode GetMode() const = 0; 138 virtual float GetAlpha() const = 0; 139 virtual const std::string& GetWindowName() const = 0; 140 virtual uint32_t GetWindowId() const = 0; 141 virtual uint64_t GetDisplayId() const = 0; 142 virtual uint32_t GetWindowFlags() const = 0; 143 virtual WindowState GetWindowState() const = 0; 144 virtual WMError SetFocusable(bool isFocusable) = 0; 145 virtual bool GetFocusable() const = 0; 146 virtual WMError SetTouchable(bool isTouchable) = 0; 147 virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const = 0; 148 virtual bool GetTouchable() const = 0; 149 virtual bool IsLayoutFullScreen() const = 0; 150 virtual bool IsFullScreen() const = 0; 151 virtual WMError SetWindowMode(WindowMode mode) = 0; 152 virtual WMError SetWindowType(WindowType type) = 0; 153 virtual WMError SetAlpha(float alpha) = 0; 154 virtual WMError SetTransform(const Transform& trans) = 0; 155 virtual const Transform& GetTransform() const = 0; 156 virtual WMError RemoveWindowFlag(WindowFlag flag) = 0; 157 virtual WMError AddWindowFlag(WindowFlag flag) = 0; 158 virtual WMError SetWindowFlags(uint32_t flags) = 0; IsWindowRectAutoSave(bool & enabled)159 virtual WMError IsWindowRectAutoSave(bool& enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 160 virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) = 0; 161 virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) = 0; 162 virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) = 0; 163 virtual WMError SetSystemBarProperties(const std::map<WindowType, SystemBarProperty>& properties, 164 const std::map<WindowType, SystemBarPropertyFlag>& propertyFlags) = 0; 165 virtual WMError GetSystemBarProperties(std::map<WindowType, SystemBarProperty>& properties) = 0; 166 virtual WMError SetFullScreen(bool status) = 0; 167 virtual WMError SetLayoutFullScreen(bool status) = 0; 168 virtual WMError SetTitleAndDockHoverShown(bool titleHoverShowEnabled = true, 169 bool dockHoverShowEnabled = true) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 170 virtual WMError Destroy() = 0; 171 virtual WMError Show(uint32_t reason = 0, bool withAnimation = false, bool withFocus = true) = 0; 172 virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) = 0; 173 virtual WMError MoveTo(int32_t x, int32_t y, bool isMoveToGlobal = false) = 0; MoveToAsync(int32_t x,int32_t y)174 virtual WMError MoveToAsync(int32_t x, int32_t y) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } MoveWindowToGlobal(int32_t x,int32_t y)175 virtual WMError MoveWindowToGlobal(int32_t x, int32_t y) { return WMError::WM_OK; } GetGlobalScaledRect(Rect & globalScaledRect)176 virtual WMError GetGlobalScaledRect(Rect& globalScaledRect) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 177 virtual WMError Resize(uint32_t width, uint32_t height) = 0; ResizeAsync(uint32_t width,uint32_t height)178 virtual WMError ResizeAsync(uint32_t width, uint32_t height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 179 virtual WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) = 0; 180 virtual WMError SetKeepScreenOn(bool keepScreenOn) = 0; 181 virtual bool IsKeepScreenOn() const = 0; 182 virtual WMError SetTurnScreenOn(bool turnScreenOn) = 0; 183 virtual bool IsTurnScreenOn() const = 0; 184 virtual WMError SetBackgroundColor(const std::string& color) = 0; 185 virtual WMError SetTransparent(bool isTransparent) = 0; 186 virtual bool IsTransparent() const = 0; 187 virtual WMError SetBrightness(float brightness) = 0; 188 virtual float GetBrightness() const = 0; 189 virtual WMError SetCallingWindow(uint32_t windowId) = 0; 190 virtual WMError SetPrivacyMode(bool isPrivacyMode) = 0; 191 virtual bool IsPrivacyMode() const = 0; 192 virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) = 0; 193 virtual WMError BindDialogTarget(sptr<IRemoteObject> targetToken) = 0; 194 virtual WMError SetDialogBackGestureEnabled(bool isEnabled) = 0; 195 virtual WMError RaiseToAppTop() = 0; 196 virtual WMError SetSnapshotSkip(bool isSkip) = 0; 197 virtual WMError SetCornerRadius(float cornerRadius) = 0; 198 virtual WMError SetShadowRadius(float radius) = 0; 199 virtual WMError SetShadowColor(std::string color) = 0; 200 virtual WMError SetShadowOffsetX(float offsetX) = 0; 201 virtual WMError SetShadowOffsetY(float offsetY) = 0; 202 virtual WMError SetBlur(float radius) = 0; 203 virtual WMError SetBackdropBlur(float radius) = 0; 204 virtual WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) = 0; 205 virtual WMError RequestFocus() const = 0; RequestFocusByClient(bool isFocused)206 virtual WMError RequestFocusByClient(bool isFocused) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 207 virtual bool IsFocused() const = 0; 208 virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) = 0; 209 virtual void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) = 0; 210 virtual void ConsumeKeyEvent(const std::shared_ptr<MMI::KeyEvent>& inputEvent) = 0; 211 virtual void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& inputEvent) = 0; 212 virtual void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) = 0; 213 virtual int64_t GetVSyncPeriod() = 0; FlushFrameRate(uint32_t rate,int32_t animatorExpectedFrameRate,uint32_t rateType)214 virtual void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType) {} 215 virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) = 0; 216 virtual void UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration>& configuration) = 0; 217 virtual WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) = 0; 218 virtual WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) = 0; 219 virtual WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) = 0; 220 virtual WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) = 0; 221 virtual WMError RegisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) = 0; 222 virtual WMError UnregisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) = 0; 223 virtual WMError RegisterDragListener(const sptr<IWindowDragListener>& listener) = 0; 224 virtual WMError UnregisterDragListener(const sptr<IWindowDragListener>& listener) = 0; 225 virtual WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) = 0; 226 virtual WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) = 0; 227 virtual void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) = 0; UnregisterWindowDestroyedListener()228 virtual void UnregisterWindowDestroyedListener() {} 229 virtual WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) = 0; 230 virtual WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) = 0; 231 virtual WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) = 0; 232 virtual WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) = 0; 233 virtual WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener) = 0; 234 virtual WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) = 0; 235 virtual WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) = 0; 236 virtual WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) = 0; 237 virtual WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) = 0; 238 virtual void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) = 0; 239 virtual void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) = 0; 240 virtual WMError RegisterSystemBarEnableListener(const sptr<IWindowSystemBarEnableListener>& listener) = 0; 241 virtual WMError UnRegisterSystemBarEnableListener(const sptr<IWindowSystemBarEnableListener>& listener) = 0; 242 virtual WMError RegisterIgnoreViewSafeAreaListener(const sptr<IIgnoreViewSafeAreaListener>& listener) = 0; 243 virtual WMError UnRegisterIgnoreViewSafeAreaListener(const sptr<IIgnoreViewSafeAreaListener>& listener) = 0; 244 virtual void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) = 0; 245 virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) = 0; 246 virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage, 247 BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr, 248 AppExecFwk::Ability* ability = nullptr) = 0; 249 virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage, 250 AppExecFwk::Ability* ability = nullptr) 251 { 252 return WMError::WM_OK; 253 } 254 virtual WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage, 255 AppExecFwk::Ability* ability = nullptr) 256 { 257 return WMError::WM_OK; 258 } 259 virtual std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION) = 0; 260 virtual Ace::UIContent* GetUIContent() const = 0; 261 virtual void OnNewWant(const AAFwk::Want& want) = 0; 262 virtual void SetRequestedOrientation(Orientation) = 0; 263 virtual Orientation GetRequestedOrientation() = 0; 264 virtual void SetRequestWindowModeSupportType(uint32_t windowModeSupportType) = 0; 265 virtual uint32_t GetRequestWindowModeSupportType() const = 0; 266 virtual WMError SetTouchHotAreas(const std::vector<Rect>& rects) = 0; 267 virtual void GetRequestedTouchHotAreas(std::vector<Rect>& rects) const = 0; 268 virtual bool IsMainHandlerAvailable() const = 0; 269 virtual WMError SetAPPWindowLabel(const std::string& label) = 0; 270 virtual WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) = 0; 271 virtual WMError DisableAppWindowDecor() = 0; 272 virtual WMError Minimize() = 0; 273 virtual WMError Maximize() = 0; 274 virtual WMError Recover() = 0; Restore()275 virtual WMError Restore() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } SetWindowRectAutoSave(bool enabled)276 virtual WMError SetWindowRectAutoSave(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 277 virtual void StartMove() = 0; StartMoveWindow()278 virtual WmErrorCode StartMoveWindow() { return WmErrorCode::WM_OK; } 279 virtual WMError Close() = 0; 280 virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) = 0; 281 virtual bool IsSupportWideGamut() = 0; 282 virtual void SetColorSpace(ColorSpace colorSpace) = 0; 283 virtual ColorSpace GetColorSpace() = 0; 284 virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) = 0; 285 virtual std::shared_ptr<Media::PixelMap> Snapshot() = 0; 286 virtual WMError NotifyMemoryLevel(int32_t level) = 0; 287 virtual bool IsAllowHaveSystemSubWindow() = 0; 288 virtual WMError SetAspectRatio(float ratio) = 0; 289 virtual WMError ResetAspectRatio() = 0; 290 virtual KeyboardAnimationConfig GetKeyboardAnimationConfig() = 0; 291 virtual void SetNeedDefaultAnimation(bool needDefaultAnimation) = 0; 292 293 virtual void SetViewportConfig(const Ace::ViewportConfig& config) = 0; 294 virtual void UpdateViewportConfig() = 0; 295 virtual void SetOrientation(Orientation orientation) = 0; 296 virtual void SetSize(int32_t width, int32_t height) = 0; 297 virtual void SetDensity(float density) = 0; SetDefaultDensityEnabled(bool enabled)298 virtual WMError SetDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } GetDefaultDensityEnabled()299 virtual bool GetDefaultDensityEnabled() { return false; } GetVirtualPixelRatio()300 virtual float GetVirtualPixelRatio() { return 1.0f; } 301 virtual void UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type); 302 virtual void CreateSurfaceNode(const std::string name, const SendRenderDataCallback& callback) = 0; 303 virtual void SetContentInfoCallback(const ContentInfoCallback& callback) = 0; 304 virtual WMError SetResizeByDragEnabled(bool dragEnabled) = 0; 305 virtual WMError SetRaiseByClickEnabled(bool raiseEnabled) = 0; 306 virtual WMError RaiseAboveTarget(int32_t subWindowId) = 0; SetTopmost(bool topmost)307 virtual WMError SetTopmost(bool topmost) { return WMError::WM_OK; } IsTopmost()308 virtual bool IsTopmost() const { return false; } SetMainWindowTopmost(bool isTopmost)309 virtual WMError SetMainWindowTopmost(bool isTopmost) { return WMError::WM_OK; } IsMainWindowTopmost()310 virtual bool IsMainWindowTopmost() const { return false; } 311 virtual WMError HideNonSystemFloatingWindows(bool shouldHide) = 0; IsFloatingWindowAppType()312 virtual bool IsFloatingWindowAppType() const { return false; } IsPcOrPadCapabilityEnabled()313 virtual bool IsPcOrPadCapabilityEnabled() const { return false; } IsPcOrPadFreeMultiWindowMode()314 virtual bool IsPcOrPadFreeMultiWindowMode() const { return false; } 315 virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) = 0; 316 virtual WMError RegisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0; 317 virtual WMError UnregisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0; SetWindowLimits(WindowLimits & windowLimits)318 virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; } GetWindowLimits(WindowLimits & windowLimits)319 virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; } EnableDrag(bool enableDrag)320 virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)321 virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 322 { 323 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 324 } UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)325 virtual WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 326 { 327 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 328 } 329 virtual WMError SetSingleFrameComposerEnabled(bool enable) = 0; 330 virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) = 0; SetDecorVisible(bool isVisible)331 virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } SetWindowTitleMoveEnabled(bool enable)332 virtual WMError SetWindowTitleMoveEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } SetTitleButtonVisible(bool isMaximizeVisible,bool isMinimizeVisible,bool isSplitVisible,bool isCloseVisible)333 virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible, 334 bool isCloseVisible) 335 { 336 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 337 } SetDecorHeight(int32_t decorHeight)338 virtual WMError SetDecorHeight(int32_t decorHeight) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } GetDecorHeight(int32_t & height)339 virtual WMError GetDecorHeight(int32_t& height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } GetTitleButtonArea(TitleButtonRect & titleButtonRect)340 virtual WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect) 341 { 342 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 343 } RegisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)344 virtual WMError RegisterWindowTitleButtonRectChangeListener( 345 const sptr<IWindowTitleButtonRectChangedListener>& listener) 346 { 347 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 348 } UnregisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)349 virtual WMError UnregisterWindowTitleButtonRectChangeListener( 350 const sptr<IWindowTitleButtonRectChangedListener>& listener) 351 { 352 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 353 } 354 /** 355 * @brief Set the application modality of main window. 356 * 357 * @param isModal bool. 358 * @return WMError 359 */ SetWindowModal(bool isModal)360 virtual WMError SetWindowModal(bool isModal) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 361 /** 362 * @brief Set the modality of window. 363 * 364 * @param isModal bool. 365 * @param modalityType ModalityType. 366 * @return WMError 367 */ 368 virtual WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY) 369 { 370 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 371 } 372 virtual WMError Recover(uint32_t reason = 0) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 373 Maximize(MaximizePresentation present)374 virtual WMError Maximize(MaximizePresentation present) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 375 SetWindowMask(const std::vector<std::vector<uint32_t>> & windowMask)376 virtual WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask) 377 { 378 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 379 } 380 SetGrayScale(float grayScale)381 virtual WMError SetGrayScale(float grayScale) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 382 383 /** 384 * @brief Set the Dvsync object 385 * 386 * @param dvsyncSwitch bool. 387 * @return * void 388 */ SetUiDvsyncSwitch(bool dvsyncSwitch)389 virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) {} 390 SetImmersiveModeEnabledState(bool enable)391 virtual WMError SetImmersiveModeEnabledState(bool enable) { return WMError::WM_OK; } 392 GetImmersiveModeEnabledState()393 virtual bool GetImmersiveModeEnabledState() const { return true; } 394 GetWindowStatus(WindowStatus & windowStatus)395 virtual WMError GetWindowStatus(WindowStatus& windowStatus) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 396 397 /** 398 * @brief Set whether to enable gesture back. 399 * @param enable the value true means to enable gesture back, and false means the opposite. 400 * @return WM_OK means set success, others means set failed. 401 */ SetGestureBackEnabled(bool enable)402 virtual WMError SetGestureBackEnabled(bool enable) { return WMError::WM_OK; } 403 404 /** 405 * @brief Get whether to enable gesture back. 406 * @param enable the value true means to enable gesture back, and false means the opposite. 407 * @return WM_OK means get success, others means get failed. 408 */ GetGestureBackEnabled(bool & enable)409 virtual WMError GetGestureBackEnabled(bool& enable) { return WMError::WM_OK; } 410 411 /** 412 * @brief Flush layout size. 413 * 414 * @param width The width after layout 415 * @param height The height after layout 416 */ FlushLayoutSize(int32_t width,int32_t height)417 virtual void FlushLayoutSize(int32_t width, int32_t height) {} 418 419 /** 420 * @brief notify window remove starting window. 421 * 422 * @return WMError 423 */ NotifyRemoveStartingWindow()424 virtual WMError NotifyRemoveStartingWindow() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 425 }; 426 } 427 } 428 #endif // OHOS_ROSEN_WINDOW_H 429