1 /* 2 * Copyright (c) 2021-2023 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 <refbase.h> 20 #include <parcel.h> 21 #include <iremote_object.h> 22 23 #include "dm_common.h" 24 #include "wm_common.h" 25 #include "window_option.h" 26 #include "occupied_area_change_info.h" 27 28 typedef struct napi_env__* napi_env; 29 typedef struct napi_value__* napi_value; 30 namespace OHOS::MMI { 31 class PointerEvent; 32 class KeyEvent; 33 class AxisEvent; 34 } 35 namespace OHOS::AppExecFwk { 36 class Configuration; 37 class Ability; 38 } 39 40 namespace OHOS::AbilityRuntime { 41 class AbilityContext; 42 class Context; 43 } 44 45 namespace OHOS::AAFwk { 46 class Want; 47 class WantParams; 48 } 49 50 namespace OHOS::Ace { 51 class UIContent; 52 } 53 54 namespace OHOS::Media { 55 class PixelMap; 56 } 57 58 namespace OHOS::Accessibility { 59 class AccessibilityEventInfo; 60 } 61 namespace OHOS { 62 namespace Rosen { 63 using NotifyNativeWinDestroyFunc = std::function<void(std::string windowName)>; 64 using NotifyTransferComponentDataFunc = std::function<void(const AAFwk::WantParams& wantParams)>; 65 using NotifyTransferComponentDataForResultFunc = std::function<AAFwk::WantParams(const AAFwk::WantParams& wantParams)>; 66 using KeyEventFilterFunc = std::function<bool(MMI::KeyEvent&)>; 67 class RSSurfaceNode; 68 class RSTransaction; 69 class ISession; 70 71 /** 72 * @class IWindowLifeCycle 73 * 74 * @brief IWindowLifeCycle is a listener used to notify caller that lifecycle of window. 75 */ 76 class IWindowLifeCycle : virtual public RefBase { 77 public: 78 /** 79 * @brief Notify caller that window is on the forground. 80 */ AfterForeground()81 virtual void AfterForeground() {} 82 /** 83 * @brief Notify caller that window is on the background. 84 */ AfterBackground()85 virtual void AfterBackground() {} 86 /** 87 * @brief Notify caller that window is focused. 88 */ AfterFocused()89 virtual void AfterFocused() {} 90 /** 91 * @brief Notify caller that window is unfocused. 92 */ AfterUnfocused()93 virtual void AfterUnfocused() {} 94 /** 95 * @brief Notify caller the error code when window go forground failed. 96 * 97 * @param ret Error code when window go forground failed. 98 */ ForegroundFailed(int32_t ret)99 virtual void ForegroundFailed(int32_t ret) {} 100 /** 101 * @brief Notify caller the error code when window go background failed. 102 * 103 * @param ret Error code when window go background failed. 104 */ BackgroundFailed(int32_t ret)105 virtual void BackgroundFailed(int32_t ret) {} 106 /** 107 * @brief Notify caller that window is active. 108 */ AfterActive()109 virtual void AfterActive() {} 110 /** 111 * @brief Notify caller that window is inactive. 112 */ AfterInactive()113 virtual void AfterInactive() {} 114 /** 115 * @brief Notify caller that window is resumed. 116 */ AfterResumed()117 virtual void AfterResumed() {} 118 /** 119 * @brief Notify caller that window is paused. 120 */ AfterPaused()121 virtual void AfterPaused() {} 122 /** 123 * @brief Notify caller that window is destroyed. 124 */ AfterDestroyed()125 virtual void AfterDestroyed() {} 126 }; 127 128 /** 129 * @class IWindowChangeListener 130 * 131 * @brief IWindowChangeListener is used to observe the window size or window mode when window changed. 132 */ 133 class IWindowChangeListener : virtual public RefBase { 134 public: 135 /** 136 * @brief Notify caller when window size changed. 137 * 138 * @param Rect Rect of the current window. 139 * @param reason Reason for window change. 140 * @param rsTransaction Synchronization transaction for animation 141 */ 142 virtual void OnSizeChange(Rect rect, WindowSizeChangeReason reason, 143 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 144 /** 145 * @brief Notify caller when window mode changed. 146 * 147 * @param mode Mode of the current window. 148 * @param hasDeco Window has decoration or not. 149 */ 150 virtual void OnModeChange(WindowMode mode, bool hasDeco = true) {} 151 }; 152 153 /** 154 * @class IWindowStatusChangeListener 155 * 156 * @brief IWindowStatusChangeListener is used to observe the window status when window status changed. 157 */ 158 class IWindowStatusChangeListener : virtual public RefBase { 159 public: 160 /** 161 * @brief Notify caller when window status changed. 162 * 163 * @param status Mode of the current window. 164 */ OnWindowStatusChange(WindowStatus status)165 virtual void OnWindowStatusChange(WindowStatus status) {} 166 }; 167 168 /** 169 * @class IAvoidAreaChangedListener 170 * 171 * @brief IAvoidAreaChangedListener is used to observe the avoid area when avoid area size changed. 172 */ 173 class IAvoidAreaChangedListener : virtual public RefBase { 174 public: 175 /** 176 * @brief Notify caller when avoid area size changed. 177 * 178 * @param avoidArea Area needed to be avoided. 179 * @param type Type of avoid area. 180 */ OnAvoidAreaChanged(const AvoidArea avoidArea,AvoidAreaType type)181 virtual void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) {} 182 }; 183 184 /** 185 * @class IWindowDragListener 186 * 187 * @brief IWindowDragListener is used to observe the drag status when drag window. 188 */ 189 class IWindowDragListener : virtual public RefBase { 190 public: 191 /** 192 * @brief Notify caller when drag window. 193 * 194 * @param x X-axis when drag window. 195 * @param y Y-axis when drag window. 196 * @param event Drag type. 197 */ OnDrag(int32_t x,int32_t y,DragEvent event)198 virtual void OnDrag(int32_t x, int32_t y, DragEvent event) {} 199 }; 200 201 /** 202 * @class IDisplayMoveListener 203 * 204 * @brief IDisplayMoveListener is used to observe display move status when display move. 205 */ 206 class IDisplayMoveListener : virtual public RefBase { 207 public: 208 /** 209 * @brief Notify caller when display move. 210 * 211 * @param from Display id before display start move. 212 * @param to Display id after display move end. 213 */ OnDisplayMove(DisplayId from,DisplayId to)214 virtual void OnDisplayMove(DisplayId from, DisplayId to) {} 215 }; 216 217 /** 218 * @class IDispatchInputEventListener 219 * 220 * @brief IDispatchInputEventListener is used to dispatch input event. 221 */ 222 class IDispatchInputEventListener : virtual public RefBase { 223 public: 224 /** 225 * @brief Dispatch PointerEvent. 226 * 227 * @param inputEvent Means PointerEvent. 228 */ OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent> & inputEvent)229 virtual void OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 230 /** 231 * @brief Dispatch KeyEvent. 232 * 233 * @param inputEvent Means KeyEvent. 234 */ OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent> & keyEvent)235 virtual void OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent) {} 236 }; 237 238 /** 239 * @class IOccupiedAreaChangeListener 240 * 241 * @brief IOccupiedAreaChangeListener is used to observe OccupiedArea change. 242 */ 243 class IOccupiedAreaChangeListener : virtual public RefBase { 244 public: 245 /** 246 * @brief Notify caller when OccupiedArea size change. 247 * 248 * @param info Occupied area info when occupied changed. 249 * @param rsTransaction Animation transaction. 250 */ 251 virtual void OnSizeChange(const sptr<OccupiedAreaChangeInfo>& info, 252 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 253 }; 254 255 /** 256 * @class IAceAbilityHandler 257 * 258 * @brief IAceAbilityHandler is used to control Ace Ability. 259 */ 260 class IAceAbilityHandler : virtual public RefBase { 261 public: 262 /** 263 * @brief Set BackgroundColor 264 * 265 * @param color Color of Background. 266 */ SetBackgroundColor(uint32_t color)267 virtual void SetBackgroundColor(uint32_t color) {} 268 /** 269 * @brief Get BackgroundColor. 270 * 271 * @return Value of BackgroundColor and default color is white. 272 */ GetBackgroundColor()273 virtual uint32_t GetBackgroundColor() { return 0xffffffff; } 274 }; 275 276 /** 277 * @class IInputEventConsumer 278 * 279 * @brief IInputEventConsumer is a Listener to observe InputEvent consumed or not. 280 */ 281 class IInputEventConsumer { 282 public: 283 /** 284 * @brief Default construct func of IInputEventConsumer. 285 */ 286 IInputEventConsumer() = default; 287 /** 288 * @brief Default Destructor func of IInputEventConsumer. 289 */ 290 virtual ~IInputEventConsumer() = default; 291 /** 292 * @brief Observe KeyEvent of Multi-Model Input. 293 * 294 * @param keyEvent KeyEvent of Multi-Model Input. 295 */ OnInputEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)296 virtual bool OnInputEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) const { return false; } 297 /** 298 * @brief Observe PointerEvent of Multi-Model Input. 299 * 300 * @param pointerEvent PointerEvent of Multi-Model Input. 301 */ OnInputEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)302 virtual bool OnInputEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) const { return false; } 303 /** 304 * @brief Observe axisEvent of Multi-Model Input. 305 * 306 * @param axisEvent AxisEvent of Multi-Model Input. 307 */ OnInputEvent(const std::shared_ptr<MMI::AxisEvent> & axisEvent)308 virtual bool OnInputEvent(const std::shared_ptr<MMI::AxisEvent>& axisEvent) const { return false; } 309 }; 310 311 /** 312 * @class ITouchOutsideListener 313 * 314 * @brief ITouchOutsideListener is a Listener to observe event when touch outside the window. 315 */ 316 class ITouchOutsideListener : virtual public RefBase { 317 public: 318 /** 319 * @brief Observe the event when touch outside the window. 320 */ OnTouchOutside()321 virtual void OnTouchOutside() const {} 322 }; 323 324 /** 325 * @class IAnimationTransitionController 326 * 327 * @brief IAnimationTransitionController is a Listener to observe event about animation. 328 */ 329 class IAnimationTransitionController : virtual public RefBase { 330 public: 331 /** 332 * @brief Observe the event when animation show. 333 */ AnimationForShown()334 virtual void AnimationForShown() {} 335 /** 336 * @brief Observe the event when animation hide. 337 */ AnimationForHidden()338 virtual void AnimationForHidden() {} 339 }; 340 341 /** 342 * @class IScreenshotListener 343 * 344 * @brief IScreenshotListener is a Listener to observe event when screenshot happened. 345 */ 346 class IScreenshotListener : virtual public RefBase { 347 public: 348 /** 349 * @brief Observe event when screenshot happened. 350 */ OnScreenshot()351 virtual void OnScreenshot() {} 352 }; 353 354 /** 355 * @class IDialogTargetTouchListener 356 * 357 * @brief IDialogTargetTouchListener is a Listener to observe event when touch dialog window. 358 */ 359 class IDialogTargetTouchListener : virtual public RefBase { 360 public: 361 /** 362 * @brief Observe event when touch dialog window. 363 */ OnDialogTargetTouch()364 virtual void OnDialogTargetTouch() const {} 365 }; 366 367 /** 368 * @class IDialogDeathRecipientListener 369 * 370 * @brief IDialogDeathRecipientListener is a Listener to observe event when mainwindow(bind to dialog) destroyed. 371 */ 372 class IDialogDeathRecipientListener : virtual public RefBase { 373 public: 374 /** 375 * @brief Observe event when mainwindow(bind to dialog) destroyed. 376 */ OnDialogDeathRecipient()377 virtual void OnDialogDeathRecipient() const {} 378 }; 379 380 /** 381 * @class IWindowVisibilityChangedListener 382 * 383 * @brief Listener to observe one window visibility changed. 384 */ 385 class IWindowVisibilityChangedListener : virtual public RefBase { 386 public: OnWindowVisibilityChangedCallback(const bool isVisible)387 virtual void OnWindowVisibilityChangedCallback(const bool isVisible) {}; 388 }; 389 using IWindowVisibilityListenerSptr = sptr<IWindowVisibilityChangedListener>; 390 391 /** 392 * @class IDisplayIdChangeListener 393 * 394 * @brief Listener to observe one window displayId changed. 395 */ 396 class IDisplayIdChangeListener : virtual public RefBase { 397 public: 398 /** 399 * @brief Notify caller when window displayId changed. 400 */ OnDisplayIdChanged(DisplayId displayId)401 virtual void OnDisplayIdChanged(DisplayId displayId) {} 402 }; 403 using IDisplayIdChangeListenerSptr = sptr<IDisplayIdChangeListener>; 404 405 /** 406 * @class IWindowNoInteractionListenerSptr 407 * 408 * @brief Listener to observe no interaction event for a long time of window. 409 */ 410 class IWindowNoInteractionListener : virtual public RefBase { 411 public: 412 /** 413 * @brief Observe event when no interaction for a long time. 414 */ OnWindowNoInteractionCallback()415 virtual void OnWindowNoInteractionCallback() {}; 416 417 /** 418 * @brief Set timeout of the listener. 419 * 420 * @param timeout. 421 */ SetTimeout(int64_t timeout)422 virtual void SetTimeout(int64_t timeout) {}; 423 424 /** 425 * @brief get timeout of the listener. 426 * 427 * @return timeout. 428 */ GetTimeout()429 virtual int64_t GetTimeout() const { return 0;}; 430 }; 431 using IWindowNoInteractionListenerSptr = sptr<IWindowNoInteractionListener>; 432 433 /** 434 * @class IWindowTitleButtonRectChangedListener 435 * 436 * @brief Listener to observe event when window size or the height of title bar changed. 437 */ 438 class IWindowTitleButtonRectChangedListener : virtual public RefBase { 439 public: 440 /** 441 * @brief Notify caller when window size or the height of title bar changed. 442 * @param titleButtonRect An area of title buttons relative to the upper right corner of the window. 443 */ OnWindowTitleButtonRectChanged(const TitleButtonRect & titleButtonRect)444 virtual void OnWindowTitleButtonRectChanged(const TitleButtonRect& titleButtonRect) {} 445 }; 446 447 /** 448 * @class IWindowRectChangeListener 449 * 450 * @brief IWindowRectChangeListener is used to observe the window rect and its changing reason when window changed. 451 */ 452 class IWindowRectChangeListener : virtual public RefBase { 453 public: 454 /** 455 * @brief Notify caller when window rect changed. 456 * 457 * @param Rect Rect of the current window. 458 * @param reason Reason for window size change. 459 */ OnRectChange(Rect rect,WindowSizeChangeReason reason)460 virtual void OnRectChange(Rect rect, WindowSizeChangeReason reason) {} 461 }; 462 463 /** 464 * @class ISubWindowCloseListener 465 * 466 * @brief ISubWindowCloseListener is used to observe the window rect and its changing reason when window changed. 467 */ 468 class ISubWindowCloseListener : virtual public RefBase { 469 public: 470 /** 471 * @brief Notify caller when subwindow closed. 472 * 473 * @param terminateCloseProcess Whather need to terminate the subwindow close process. 474 */ OnSubWindowClose(bool & terminateCloseProcess)475 virtual void OnSubWindowClose(bool& terminateCloseProcess) {} 476 }; 477 478 /** 479 * @class IMainWindowCloseListener 480 * 481 * @brief IMainWindowCloseListener is used for preprocessing when the main window exits. 482 */ 483 class IMainWindowCloseListener : virtual public RefBase { 484 public: 485 /** 486 * @brief Notify caller when main window closed. 487 * 488 * @param terminateCloseProcess Whether need to terminate the main window close process. 489 */ OnMainWindowClose(bool & terminateCloseProcess)490 virtual void OnMainWindowClose(bool& terminateCloseProcess) {} 491 }; 492 493 /** 494 * @class ISwitchFreeMultiWindowListener 495 * 496 * @brief ISwitchFreeMultiWindowListener is used to observe the free multi window state when it changed. 497 */ 498 class ISwitchFreeMultiWindowListener : virtual public RefBase { 499 public: 500 /** 501 * @brief Notify caller when free multi window state changed. 502 * 503 * @param enable Whether free multi window state enabled. 504 */ OnSwitchFreeMultiWindow(bool enable)505 virtual void OnSwitchFreeMultiWindow(bool enable) {} 506 }; 507 508 /** 509 * @class IKeyboardPanelInfoChangeListener 510 * 511 * @brief IKeyboardPanelInfoChangeListener is used to observe the keyboard panel info. 512 */ 513 class IKeyboardPanelInfoChangeListener : virtual public RefBase { 514 public: 515 /** 516 * @brief Notify caller when keyboard info changed. 517 * 518 * @param KeyboardPanelInfo keyboardPanelInfo of the keyboard panel; 519 */ OnKeyboardPanelInfoChanged(const KeyboardPanelInfo & keyboardPanelInfo)520 virtual void OnKeyboardPanelInfoChanged(const KeyboardPanelInfo& keyboardPanelInfo) {} 521 }; 522 523 static WMError DefaultCreateErrCode = WMError::WM_OK; 524 class Window : virtual public RefBase { 525 public: 526 /** 527 * @brief create window, include main_window/sub_window/system_window 528 * 529 * @param windowName window name, identify window instance 530 * @param option window propertion 531 * @param context ability context 532 * @return sptr<Window> If create window success,return window instance;Otherwise, return nullptr 533 */ 534 static sptr<Window> Create(const std::string& windowName, 535 sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context = nullptr, 536 WMError& errCode = DefaultCreateErrCode); 537 538 /** 539 * @brief create main/uiextension window with session 540 * 541 * @param option window propertion 542 * @param context ability context 543 * @param iSession session token of window session 544 * @param errCode error code of create window 545 * @param identityToken identity token of sceneSession 546 * @return sptr<Window> If create window success, return window instance; Otherwise, return nullptr 547 */ 548 static sptr<Window> Create(sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context, 549 const sptr<IRemoteObject>& iSession, WMError& errCode = DefaultCreateErrCode, 550 const std::string& identityToken = ""); 551 552 /** 553 * @brief create pip window with session 554 * 555 * @param option window propertion 556 * @param pipTemplateInfo pipTemplateInfo 557 * @param context ability context 558 * @param errCode error code of create pip window 559 * @return sptr<Window> If create pip window success, return window instance; Otherwise, return nullptr 560 */ 561 static sptr<Window> CreatePiP(sptr<WindowOption>& option, const PiPTemplateInfo& pipTemplateInfo, 562 const std::shared_ptr<OHOS::AbilityRuntime::Context>& context, WMError& errCode = DefaultCreateErrCode); 563 564 /** 565 * @brief find window by windowName 566 * 567 * @param windowName 568 * @return sptr<Window> Return the window instance founded 569 */ 570 static sptr<Window> Find(const std::string& windowName); 571 572 /** 573 * @brief Get parent main windowId, which is used for mainWindow,subWindow or dialog 574 * 575 * @param windowId window id that need to get parent main window 576 * @return uint32_t Return the parent main window id 577 */ 578 static uint32_t GetParentMainWindowId(uint32_t windowId); 579 580 /** 581 * @brief Get the final show window by context. Its implemented in api8 582 * 583 * @param context Indicates the context on which the window depends 584 * @return sptr<Window> 585 */ 586 static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 587 /** 588 * @brief Get the final show window by id. Its implemented in api8 589 * 590 * @param mainWinId main window id? 591 * @return sptr<Window> 592 */ 593 static sptr<Window> GetTopWindowWithId(uint32_t mainWinId); 594 /** 595 * @brief Get the main window by context. 596 * 597 * @param context Indicates the context on which the window depends 598 * @return sptr<Window> 599 */ 600 static sptr<Window> GetMainWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 601 /** 602 * @brief Get the all sub windows by parent 603 * 604 * @param parentId parent window id 605 * @return std::vector<sptr<Window>> 606 */ 607 static std::vector<sptr<Window>> GetSubWindow(uint32_t parentId); 608 609 /** 610 * @brief Update configuration for all windows 611 * 612 * @param configuration configuration for app 613 */ 614 static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 615 616 /** 617 * @brief Update configuration synchronously for all windows. 618 * 619 * @param configuration configuration for app. 620 */ 621 static void UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 622 623 /** 624 * @brief Get surface node from RS 625 * 626 * @return Surface node from RS 627 */ GetSurfaceNode()628 virtual std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const { return nullptr; } 629 /** 630 * @brief Get ability context 631 * 632 * @return Ability context from AbilityRuntime 633 */ GetContext()634 virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const { return nullptr; } 635 /** 636 * @brief Get the window show rect 637 * 638 * @return Rect of window 639 */ GetRect()640 virtual Rect GetRect() const { return {}; } 641 /** 642 * @brief Get window default rect from window property. 643 * 644 * @return Rect of window. 645 */ GetRequestRect()646 virtual Rect GetRequestRect() const { return {}; } 647 /** 648 * @brief Get the window type 649 * 650 * @return Type of window 651 */ GetType()652 virtual WindowType GetType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 653 /** 654 * @brief Get the window mode. 655 * 656 * @return Mode of window. 657 */ GetMode()658 virtual WindowMode GetMode() const { return WindowMode::WINDOW_MODE_UNDEFINED; } 659 /** 660 * @brief Get alpha of window. 661 * 662 * @return Alpha of window. 663 */ GetAlpha()664 virtual float GetAlpha() const { return 0.0f; } 665 /** 666 * @brief Get the name of window. 667 * 668 * @return Name of window. 669 */ GetWindowName()670 virtual const std::string& GetWindowName() const 671 { 672 static const std::string name; 673 return name; 674 } 675 /** 676 * @brief Get id of window. 677 * 678 * @return ID of window. 679 */ GetWindowId()680 virtual uint32_t GetWindowId() const { return INVALID_WINDOW_ID; } 681 /** 682 * @brief Get displayId of window. 683 * 684 * @return displayId of window. 685 */ GetDisplayId()686 virtual uint64_t GetDisplayId() const { return DISPLAY_ID_INVALID; } 687 /** 688 * @brief Get flag of window. 689 * 690 * @return Flag of window. 691 */ GetWindowFlags()692 virtual uint32_t GetWindowFlags() const { return 0; } 693 /** 694 * @brief Get state of window. 695 * 696 * @return Current state of window. 697 */ GetWindowState()698 virtual WindowState GetWindowState() const { return WindowState::STATE_INITIAL; } 699 /** 700 * @brief Set focusable property of window. 701 * 702 * @param isFocusable Window can be focused or not. 703 * @return Errorcode of window. 704 */ SetFocusable(bool isFocusable)705 virtual WMError SetFocusable(bool isFocusable) { return WMError::WM_OK; } 706 /** 707 * @brief Get focusable property of window. 708 * 709 * @return True means window can be focused, false means window cannot be focused. 710 */ GetFocusable()711 virtual bool GetFocusable() const { return false; } 712 /** 713 * @brief Set touchable property of window. 714 * 715 * @param isTouchable Window can be touched or not. 716 * @return Errorcode of window. 717 */ SetTouchable(bool isTouchable)718 virtual WMError SetTouchable(bool isTouchable) { return WMError::WM_OK; } 719 /** 720 * @brief Get touchable property of window. 721 * 722 * @return True means window can be touched, false means window cannot be touched. 723 */ GetTouchable()724 virtual bool GetTouchable() const { return false; } 725 /** 726 * @brief Get SystemBarProperty By WindowType. 727 * 728 * @param type Type of window. 729 * @return Property of system bar. 730 */ GetSystemBarPropertyByType(WindowType type)731 virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const { return {}; } 732 /** 733 * @brief judge this window is full screen. 734 * 735 * @return true If SetFullScreen(true) is called , return true. 736 * @return false default return false 737 */ IsFullScreen()738 virtual bool IsFullScreen() const { return false; } 739 /** 740 * @brief judge window layout is full screen 741 * 742 * @return true this window layout is full screen 743 * @return false this window layout is not full screen 744 */ IsLayoutFullScreen()745 virtual bool IsLayoutFullScreen() const { return false; } 746 /** 747 * @brief Set the Window Type 748 * 749 * @param type window type 750 * @return WMError 751 */ SetWindowType(WindowType type)752 virtual WMError SetWindowType(WindowType type) { return WMError::WM_OK; } 753 /** 754 * @brief Set the Window Mode 755 * 756 * @param mode window mode 757 * @return WMError 758 */ SetWindowMode(WindowMode mode)759 virtual WMError SetWindowMode(WindowMode mode) { return WMError::WM_OK; } 760 /** 761 * @brief Set whether the window is topmost 762 * 763 * @param topmost whether window is topmost 764 * @return WMError 765 */ SetTopmost(bool topmost)766 virtual WMError SetTopmost(bool topmost) { return WMError::WM_OK; } 767 /** 768 * @brief Get whether window is topmost 769 * 770 * @return True means window is topmost 771 */ IsTopmost()772 virtual bool IsTopmost() const { return false; } 773 /** 774 * @brief Set whether the main window is topmost 775 * 776 * @param isTopmost whether main window is topmost 777 * @return WMError 778 */ SetMainWindowTopmost(bool isTopmost)779 virtual WMError SetMainWindowTopmost(bool isTopmost) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 780 /** 781 * @brief Get whether main window is topmost 782 * 783 * @return True means main window is topmost 784 */ IsMainWindowTopmost()785 virtual bool IsMainWindowTopmost() const { return false; } 786 /** 787 * @brief Set alpha of window. 788 * 789 * @param alpha Alpha of window. 790 * @return WM_OK means success, others means set failed. 791 */ SetAlpha(float alpha)792 virtual WMError SetAlpha(float alpha) { return WMError::WM_OK; } 793 /** 794 * @brief Set transform of window property. 795 * 796 * @param trans Window Transform. 797 * @return WMError 798 */ SetTransform(const Transform & trans)799 virtual WMError SetTransform(const Transform& trans) { return WMError::WM_OK; } 800 /** 801 * @brief Get transform of window property. 802 * 803 * @return Property of transform. 804 */ GetTransform()805 virtual const Transform& GetTransform() const 806 { 807 static const Transform trans; 808 return trans; 809 } 810 /** 811 * @brief Add window flag. 812 * 813 * @param flag Flag of window. 814 * @return WM_OK means add success, others means failed. 815 */ AddWindowFlag(WindowFlag flag)816 virtual WMError AddWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 817 /** 818 * @brief Remove window flag. 819 * 820 * @param flag Flag of window 821 * @return WM_OK means remove success, others means failed. 822 */ RemoveWindowFlag(WindowFlag flag)823 virtual WMError RemoveWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 824 /** 825 * @brief Set window flag. 826 * 827 * @param flags Flag of window 828 * @return WM_OK means set success, others means failed. 829 */ SetWindowFlags(uint32_t flags)830 virtual WMError SetWindowFlags(uint32_t flags) { return WMError::WM_OK; } 831 /** 832 * @brief Set the System Bar(include status bar and nav bar) Property 833 * 834 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 835 * @param property system bar prop,include content color, background color 836 * @return WMError 837 */ SetSystemBarProperty(WindowType type,const SystemBarProperty & property)838 virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) { return WMError::WM_OK; } 839 /** 840 * @brief Get the Avoid Area By Type object 841 * 842 * @param type avoid area type.@see reference 843 * @param avoidArea 844 * @return WMError 845 */ GetAvoidAreaByType(AvoidAreaType type,AvoidArea & avoidArea)846 virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) { return WMError::WM_OK; } 847 /** 848 * @brief Set this window layout full screen, with hide status bar and nav bar above on this window 849 * 850 * @param status 851 * @return WMError 852 */ SetLayoutFullScreen(bool status)853 virtual WMError SetLayoutFullScreen(bool status) { return WMError::WM_OK; } 854 /** 855 * @brief Set this window full screen, with hide status bar and nav bar 856 * 857 * @param status if true, hide status bar and nav bar; Otherwise, show status bar and nav bar 858 * @return WMError 859 */ 860 861 /** 862 * @brief Set whether the title bar and dock bar will show, when the mouse hovers over hot area. 863 * 864 * @param isTitleHoverShown 865 * @param isDockHoverShown 866 * @return WMError 867 */ 868 virtual WMError SetTitleAndDockHoverShown(bool isTitleHoverShown = true, 869 bool isDockHoverShown = true) 870 { 871 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 872 } 873 SetFullScreen(bool status)874 virtual WMError SetFullScreen(bool status) { return WMError::WM_OK; } 875 /** 876 * @brief destroy window 877 * 878 * @return WMError 879 */ Destroy()880 virtual WMError Destroy() { return WMError::WM_OK; } 881 /** 882 * @brief Show window 883 * 884 * @param reason Reason for window state change. 885 * @param withAnimation True means window show with animation, false means window show without animation. 886 * @param withFocus True means window can get focus when it shows to foreground, false means the opposite. 887 * @return WM_OK means window show success, others means failed. 888 */ 889 virtual WMError Show(uint32_t reason = 0, bool withAnimation = false, 890 bool withFocus = true) { return WMError::WM_OK; } 891 /** 892 * @brief Hide window 893 * 894 * @param reason Reason for window state change. 895 * @param withAnimation True means window show with animation, false means window show without animation. 896 * @param isFromInnerkits True means remove command is from inner kits. 897 * @return WM_OK means window hide success, others means failed. 898 */ 899 virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) 900 { 901 return WMError::WM_OK; 902 } 903 /** 904 * @brief notify window first frame drawing completed. 905 * 906 * @return WMError 907 */ NotifyDrawingCompleted()908 virtual WMError NotifyDrawingCompleted() { return WMError::WM_OK; } 909 /** 910 * @brief notify window remove starting window. 911 * 912 * @return WMError 913 */ NotifyRemoveStartingWindow()914 virtual WMError NotifyRemoveStartingWindow() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 915 /** 916 * @brief move the window to (x, y) 917 * 918 * @param x 919 * @param y 920 * @return WMError 921 */ 922 virtual WMError MoveTo(int32_t x, int32_t y, bool isMoveToGlobal = false) { return WMError::WM_OK; } 923 /** 924 * @brief move the window to (x, y) 925 * 926 * @param x 927 * @param y 928 * @return WMError 929 */ MoveToAsync(int32_t x,int32_t y)930 virtual WMError MoveToAsync(int32_t x, int32_t y) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 931 /** 932 * @brief move the window to global (x, y) 933 * 934 * @param x 935 * @param y 936 * @return WMError 937 */ MoveWindowToGlobal(int32_t x,int32_t y)938 virtual WMError MoveWindowToGlobal(int32_t x, int32_t y) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 939 /** 940 * @brief Get window global scaled rect. 941 * 942 * @param Rect 943 * @return WMError 944 */ GetGlobalScaledRect(Rect & globalScaledRect)945 virtual WMError GetGlobalScaledRect(Rect& globalScaledRect) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 946 /** 947 * @brief resize the window instance (w,h) 948 * 949 * @param width 950 * @param height 951 * @return WMError 952 */ Resize(uint32_t width,uint32_t height)953 virtual WMError Resize(uint32_t width, uint32_t height) { return WMError::WM_OK; } 954 /** 955 * @brief resize the window instance (w,h) 956 * 957 * @param width 958 * @param height 959 * @return WMError 960 */ ResizeAsync(uint32_t width,uint32_t height)961 virtual WMError ResizeAsync(uint32_t width, uint32_t height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 962 /** 963 * @brief set the window gravity 964 * 965 * @param gravity 966 * @param percent 967 * @return WMError 968 */ SetWindowGravity(WindowGravity gravity,uint32_t percent)969 virtual WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) { return WMError::WM_OK; } 970 /** 971 * @brief Set the screen always on 972 * 973 * @param keepScreenOn 974 * @return WMError 975 */ SetKeepScreenOn(bool keepScreenOn)976 virtual WMError SetKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; } 977 /** 978 * @brief Get the screen is always on or not. 979 * 980 * @return True means screen is always on, false means the opposite. 981 */ IsKeepScreenOn()982 virtual bool IsKeepScreenOn() const { return false; } 983 /** 984 * @brief Set the screen on 985 * 986 * @param turnScreenOn True means turn screen on, false means the opposite. 987 * @return WM_OK means set success, others means set failed. 988 */ SetTurnScreenOn(bool turnScreenOn)989 virtual WMError SetTurnScreenOn(bool turnScreenOn) { return WMError::WM_OK; } 990 /** 991 * @brief Get the screen is on or not. 992 * 993 * @return True means screen is on, false means screen is off. 994 */ IsTurnScreenOn()995 virtual bool IsTurnScreenOn() const { return false; } 996 /** 997 * @brief Set Background color. 998 * 999 * @param color Background color. 1000 * @return WM_OK means set success, others means set failed. 1001 */ SetBackgroundColor(const std::string & color)1002 virtual WMError SetBackgroundColor(const std::string& color) { return WMError::WM_OK; } 1003 /** 1004 * @brief Set transparent status. 1005 * 1006 * @param isTransparent True means set window transparent, false means the opposite. 1007 * @return WM_OK means set success, others means set failed. 1008 */ SetTransparent(bool isTransparent)1009 virtual WMError SetTransparent(bool isTransparent) { return WMError::WM_OK; } 1010 /** 1011 * @brief Get transparent status. 1012 * 1013 * @return True means window is transparent, false means the opposite. 1014 */ IsTransparent()1015 virtual bool IsTransparent() const { return false; } 1016 /** 1017 * @brief Set brightness value of window. 1018 * 1019 * @param brightness Brightness of window. 1020 * @return WM_OK means set success, others means set failed. 1021 */ SetBrightness(float brightness)1022 virtual WMError SetBrightness(float brightness) { return WMError::WM_OK; } 1023 /** 1024 * @brief Get brightness value of window. 1025 * 1026 * @return Brightness value of window. 1027 */ GetBrightness()1028 virtual float GetBrightness() const { return 0.0f; } 1029 /** 1030 * @brief Set calling window. 1031 * 1032 * @param windowId Window id. 1033 * @return WM_OK means set success, others means set failed. 1034 */ SetCallingWindow(uint32_t windowId)1035 virtual WMError SetCallingWindow(uint32_t windowId) { return WMError::WM_OK; } 1036 /** 1037 * @brief Set privacy mode of window. 1038 * 1039 * @param isPrivacyMode True means set window private, false means not set window private. 1040 * @return WM_OK means set success, others means set failed. 1041 */ SetPrivacyMode(bool isPrivacyMode)1042 virtual WMError SetPrivacyMode(bool isPrivacyMode) { return WMError::WM_OK; } 1043 /** 1044 * @brief Get privacy property of window. 1045 * 1046 * @return True means window is private and cannot be screenshot or recorded. 1047 */ IsPrivacyMode()1048 virtual bool IsPrivacyMode() const { return false; } 1049 /** 1050 * @brief Set privacy mode by system. 1051 * 1052 * @param isSystemPrivacyMode True means set window private, false means not set window private. 1053 */ SetSystemPrivacyMode(bool isSystemPrivacyMode)1054 virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) {} 1055 /** 1056 * @brief Bind Dialog window to target token. 1057 * 1058 * @param targetToken Window token of target. 1059 * @return WM_OK means set success, others means set failed. 1060 */ BindDialogTarget(sptr<IRemoteObject> targetToken)1061 virtual WMError BindDialogTarget(sptr<IRemoteObject> targetToken) { return WMError::WM_OK; } 1062 /** 1063 * @brief Set whether the dialog window responds to back gesture. 1064 * 1065 * @param isEnabled Responds to back gesture if true, or ignore back gesture if false. 1066 * @return WM_OK means set success, others means set failed. 1067 */ SetDialogBackGestureEnabled(bool isEnabled)1068 virtual WMError SetDialogBackGestureEnabled(bool isEnabled) 1069 { 1070 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1071 } 1072 /** 1073 * @brief Raise zorder of window to the top of APP Mainwindow. 1074 * 1075 * @return WM_OK means raise success, others means raise failed. 1076 */ RaiseToAppTop()1077 virtual WMError RaiseToAppTop() { return WMError::WM_OK; } 1078 /** 1079 * @brief Set skip flag of snapshot. 1080 * 1081 * @param isSkip True means skip the snapshot, false means the opposite. 1082 * @return WM_OK means set success, others means set failed. 1083 */ SetSnapshotSkip(bool isSkip)1084 virtual WMError SetSnapshotSkip(bool isSkip) { return WMError::WM_OK; } 1085 1086 // window effect 1087 /** 1088 * @brief Set corner radius of window. 1089 * 1090 * @param cornerRadius Corner radius of window 1091 * @return WM_OK means set success, others means set failed. 1092 */ SetCornerRadius(float cornerRadius)1093 virtual WMError SetCornerRadius(float cornerRadius) { return WMError::WM_OK; } 1094 /** 1095 * @brief Set shadow radius of window. 1096 * 1097 * @param radius Shadow radius of window 1098 * @return WM_OK means set success, others means set failed. 1099 */ SetShadowRadius(float radius)1100 virtual WMError SetShadowRadius(float radius) { return WMError::WM_OK; } 1101 /** 1102 * @brief Set shadow color of window. 1103 * 1104 * @param color Shadow color of window. 1105 * @return WM_OK means set success, others means set failed. 1106 */ SetShadowColor(std::string color)1107 virtual WMError SetShadowColor(std::string color) { return WMError::WM_OK; } 1108 /** 1109 * @brief Set shadow X offset. 1110 * 1111 * @param offsetX Shadow x-axis offset. 1112 * @return WM_OK means set success, others means set failed. 1113 */ SetShadowOffsetX(float offsetX)1114 virtual WMError SetShadowOffsetX(float offsetX) { return WMError::WM_OK; } 1115 /** 1116 * @brief Set shadow Y offset. 1117 * 1118 * @param offsetY Shadow y-axis offset. 1119 * @return WM_OK means set success, others means set failed. 1120 */ SetShadowOffsetY(float offsetY)1121 virtual WMError SetShadowOffsetY(float offsetY) { return WMError::WM_OK; } 1122 /** 1123 * @brief Set blur property. 1124 * 1125 * @param radius Blur value. 1126 * @return WM_OK means set success, others means set failed. 1127 */ SetBlur(float radius)1128 virtual WMError SetBlur(float radius) { return WMError::WM_OK; } 1129 /** 1130 * @brief Set Backdrop blur property. 1131 * 1132 * @param radius Backdrop blur value. 1133 * @return WM_OK means set success, others means set failed. 1134 */ SetBackdropBlur(float radius)1135 virtual WMError SetBackdropBlur(float radius) { return WMError::WM_OK; } 1136 /** 1137 * @brief Set Backdrop blur style. 1138 * 1139 * @param blurStyle Backdrop blur value. 1140 * @return WM_OK means set success, others means set failed. 1141 */ SetBackdropBlurStyle(WindowBlurStyle blurStyle)1142 virtual WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) { return WMError::WM_OK; } 1143 1144 /** 1145 * @brief Request to get focus. 1146 * 1147 * @return WM_OK means request success, others means request failed. 1148 */ RequestFocus()1149 virtual WMError RequestFocus() const { return WMError::WM_OK; } 1150 /** 1151 * @brief Request to get focus or lose focus. 1152 * 1153 * @return WM_OK means request success, others means request failed. 1154 */ RequestFocusByClient(bool isFocused)1155 virtual WMError RequestFocusByClient(bool isFocused) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1156 /** 1157 * @brief Check current focus status. 1158 * 1159 * @return True means window is focused, false means window is unfocused. 1160 */ IsFocused()1161 virtual bool IsFocused() const { return false; } 1162 /** 1163 * @brief Update surfaceNode after customAnimation. 1164 * 1165 * @param isAdd True means add custom animation, false means the opposite. 1166 * @return WM_OK means update success, others means update failed. 1167 */ UpdateSurfaceNodeAfterCustomAnimation(bool isAdd)1168 virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) { return WMError::WM_OK; } 1169 /** 1170 * @brief Set InputEvent Consumer. 1171 * 1172 * @param inputEventConsumer Consume input event object. 1173 * @return WM_OK means set success, others means set failed. 1174 */ SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer> & inputEventConsumer)1175 virtual void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) {} 1176 /** 1177 * @brief Consume KeyEvent from MMI. 1178 * 1179 * @param inputEvent Keyboard input event. 1180 */ ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent> & inputEvent)1181 virtual void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent>& inputEvent) {} 1182 /** 1183 * @brief Notify KeyEvent to arkui. 1184 * 1185 * @param inputEvent Keyboard input event 1186 */ PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)1187 virtual bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) {return false;} 1188 /** 1189 * @brief Consume PointerEvent from MMI. 1190 * 1191 * @param inputEvent Pointer input event 1192 */ ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent> & inputEvent)1193 virtual void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 1194 /** 1195 * @brief Request Vsync. 1196 * 1197 * @param vsyncCallback Callback of vsync. 1198 */ RequestVsync(const std::shared_ptr<VsyncCallback> & vsyncCallback)1199 virtual void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) {} 1200 /** 1201 * @brief get vsync period. 1202 * 1203 * @return vsync period. 1204 */ GetVSyncPeriod()1205 virtual int64_t GetVSyncPeriod() { return 0; } 1206 /** 1207 * @brief flush frame rate of linker. 1208 * 1209 * @param rate frame rate. 1210 * @param animatorExpectedFrameRate animator expected frame rate. 1211 * @param rateType frame rate type. 1212 */ FlushFrameRate(uint32_t rate,int32_t animatorExpectedFrameRate,uint32_t rateType)1213 virtual void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType) {} 1214 /** 1215 * @brief Update Configuration. 1216 * 1217 * @param configuration Window configuration. 1218 */ UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration> & configuration)1219 virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {} 1220 1221 /** 1222 * @brief Update configuration synchronously. 1223 * 1224 * @param configuration Window configuration. 1225 */ UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration> & configuration)1226 virtual void UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {} 1227 1228 /** 1229 * @brief Register window lifecycle listener. 1230 * 1231 * @param listener WindowLifeCycle listener. 1232 * @return WM_OK means register success, others means register failed. 1233 */ RegisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)1234 virtual WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 1235 /** 1236 * @brief Unregister window lifecycle listener. 1237 * 1238 * @param listener WindowLifeCycle listener. 1239 * @return WM_OK means unregister success, others means unregister failed. 1240 */ UnregisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)1241 virtual WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 1242 /** 1243 * @brief Register window change listener. 1244 * 1245 * @param listener IWindowChangeListener. 1246 * @return WM_OK means register success, others means register failed. 1247 */ RegisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)1248 virtual WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 1249 { 1250 return WMError::WM_OK; 1251 } 1252 /** 1253 * @brief Unregister window change listener. 1254 * 1255 * @param listener IWindowChangeListener. 1256 * @return WM_OK means unregister success, others means unregister failed. 1257 */ UnregisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)1258 virtual WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 1259 { 1260 return WMError::WM_OK; 1261 } 1262 /** 1263 * @brief Register avoid area change listener. 1264 * 1265 * @param listener IAvoidAreaChangedListener. 1266 * @return WM_OK means register success, others means register failed. 1267 */ RegisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener> & listener)1268 virtual WMError RegisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) 1269 { 1270 return WMError::WM_OK; 1271 } 1272 /** 1273 * @brief Unregister avoid area change listener. 1274 * 1275 * @param listener IAvoidAreaChangedListener. 1276 * @return WM_OK means unregister success, others means unregister failed. 1277 */ UnregisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener> & listener)1278 virtual WMError UnregisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) 1279 { 1280 return WMError::WM_OK; 1281 } 1282 /** 1283 * @brief Register window drag listener. 1284 * 1285 * @param listener IWindowDragListener. 1286 * @return WM_OK means register success, others means register failed. 1287 */ RegisterDragListener(const sptr<IWindowDragListener> & listener)1288 virtual WMError RegisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 1289 /** 1290 * @brief Unregister window drag listener. 1291 * 1292 * @param listener IWindowDragListener. 1293 * @return WM_OK means unregister success, others means unregister failed. 1294 */ UnregisterDragListener(const sptr<IWindowDragListener> & listener)1295 virtual WMError UnregisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 1296 /** 1297 * @brief Register display move listener. 1298 * 1299 * @param listener IDisplayMoveListener. 1300 * @return WM_OK means register success, others means register failed. 1301 */ RegisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)1302 virtual WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 1303 /** 1304 * @brief Unregister display move listener. 1305 * 1306 * @param listener IDisplayMoveListener. 1307 * @return WM_OK means unregister success, others means unregister failed. 1308 */ UnregisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)1309 virtual WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 1310 /** 1311 * @brief Register window destroyed listener. 1312 * 1313 * @param func Function to notify window destroyed. 1314 */ RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc & func)1315 virtual void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) {} 1316 /** 1317 * @brief Unregister window destroyed listener. 1318 * 1319 */ UnregisterWindowDestroyedListener()1320 virtual void UnregisterWindowDestroyedListener() {} 1321 /** 1322 * @brief Register Occupied Area Change listener. 1323 * 1324 * @param listener IOccupiedAreaChangeListener. 1325 * @return WM_OK means register success, others means register failed. 1326 */ RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)1327 virtual WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 1328 { 1329 return WMError::WM_OK; 1330 } 1331 /** 1332 * @brief Unregister occupied area change listener. 1333 * 1334 * @param listener IOccupiedAreaChangeListener. 1335 * @return WM_OK means unregister success, others means unregister failed. 1336 */ UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)1337 virtual WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 1338 { 1339 return WMError::WM_OK; 1340 } 1341 /** 1342 * @brief Register touch outside listener. 1343 * 1344 * @param listener ITouchOutsideListener. 1345 * @return WM_OK means register success, others means register failed. 1346 */ RegisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)1347 virtual WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) { return WMError::WM_OK; } 1348 /** 1349 * @brief Unregister touch outside listener. 1350 * 1351 * @param listener ITouchOutsideListener. 1352 * @return WM_OK means unregister success, others means unregister failed. 1353 */ UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)1354 virtual WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) 1355 { 1356 return WMError::WM_OK; 1357 } 1358 /** 1359 * @brief Register Animation Transition Controller listener. 1360 * 1361 * @param listener IAnimationTransitionController. 1362 * @return WM_OK means register success, others means register failed. 1363 */ RegisterAnimationTransitionController(const sptr<IAnimationTransitionController> & listener)1364 virtual WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener) 1365 { 1366 return WMError::WM_OK; 1367 } 1368 /** 1369 * @brief Register screen shot listener. 1370 * 1371 * @param listener IScreenshotListener. 1372 * @return WM_OK means register success, others means register failed. 1373 */ RegisterScreenshotListener(const sptr<IScreenshotListener> & listener)1374 virtual WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 1375 /** 1376 * @brief Unregister screen shot listener. 1377 * 1378 * @param listener IScreenshotListener. 1379 * @return WM_OK means unregister success, others means unregister failed. 1380 */ UnregisterScreenshotListener(const sptr<IScreenshotListener> & listener)1381 virtual WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 1382 /** 1383 * @brief Register dialog target touch listener. 1384 * 1385 * @param listener IDialogTargetTouchListener. 1386 * @return WM_OK means register success, others means register failed. 1387 */ RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)1388 virtual WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 1389 { 1390 return WMError::WM_OK; 1391 } 1392 /** 1393 * @brief Unregister dialog target touch listener. 1394 * 1395 * @param listener IDialogTargetTouchListener. 1396 * @return WM_OK means unregister success, others means unregister failed. 1397 */ UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)1398 virtual WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 1399 { 1400 return WMError::WM_OK; 1401 } 1402 /** 1403 * @brief Register dialog death Recipient listener. 1404 * 1405 * @param listener IDialogDeathRecipientListener. 1406 */ RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)1407 virtual void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 1408 /** 1409 * @brief Unregister window death recipient listener. 1410 * 1411 * @param listener IDialogDeathRecipientListener. 1412 */ UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)1413 virtual void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 1414 /** 1415 * @brief Notify touch dialog target. 1416 */ 1417 virtual void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) {} 1418 /** 1419 * @brief Set ace ability handler. 1420 * 1421 * @param handler Ace ability handler. 1422 */ SetAceAbilityHandler(const sptr<IAceAbilityHandler> & handler)1423 virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) {} 1424 /** 1425 * @brief set window ui content 1426 * 1427 * @param contentInfo content info path 1428 * @param env 1429 * @param storage 1430 * @param isDistributed 1431 * @param ability 1432 * @return WMError 1433 */ 1434 virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage, 1435 BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr, 1436 AppExecFwk::Ability* ability = nullptr) 1437 { 1438 return WMError::WM_OK; 1439 } 1440 /** 1441 * @brief set window ui content 1442 * 1443 * @param contentInfo content info path 1444 * @param engine 1445 * @param storage 1446 * @param isDistributed 1447 * @param ability 1448 * @return WMError 1449 */ 1450 virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage, 1451 AppExecFwk::Ability* ability = nullptr) 1452 { 1453 return WMError::WM_OK; 1454 } 1455 /** 1456 * @brief set window ui content by abc 1457 * 1458 * @param abcPath abc path 1459 * @param env 1460 * @param storage 1461 * @param ability 1462 * @return WMError 1463 */ 1464 virtual WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage, 1465 AppExecFwk::Ability* ability = nullptr) 1466 { 1467 return WMError::WM_OK; 1468 } 1469 /** 1470 * @brief Get ui content info. 1471 * 1472 * @return UI content info. 1473 */ 1474 virtual std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION) 1475 { 1476 return {}; 1477 } 1478 /** 1479 * @brief Set uiability restored router stack. 1480 * 1481 * @return WMError. 1482 */ SetRestoredRouterStack(const std::string & routerStack)1483 virtual WMError SetRestoredRouterStack(const std::string& routerStack) 1484 { 1485 return WMError::WM_OK; 1486 } 1487 /** 1488 * @brief Get ui content object. 1489 * 1490 * @return UIContent object of ACE. 1491 */ GetUIContent()1492 virtual Ace::UIContent* GetUIContent() const { return nullptr; } 1493 /** 1494 * @brief Get ui content object. 1495 * 1496 * @param winId window id. 1497 * @return UIContent object of ACE. 1498 */ GetUIContentWithId(uint32_t winId)1499 virtual Ace::UIContent* GetUIContentWithId(uint32_t winId) const { return nullptr; } 1500 /** 1501 * @brief Window handle new want. 1502 * 1503 * @param want Want object of AAFwk. 1504 */ OnNewWant(const AAFwk::Want & want)1505 virtual void OnNewWant(const AAFwk::Want& want) {} 1506 /** 1507 * @brief Set requested orientation. 1508 * 1509 * @param Orientation Screen orientation. 1510 */ SetRequestedOrientation(Orientation)1511 virtual void SetRequestedOrientation(Orientation) {} 1512 /** 1513 * @brief Get requested orientation. 1514 * 1515 * @return Orientation screen orientation. 1516 */ GetRequestedOrientation()1517 virtual Orientation GetRequestedOrientation() { return Orientation::UNSPECIFIED; } 1518 /** 1519 * @brief Set requested mode support info. 1520 * 1521 * @param windowModeSupportType Mode of window supported. 1522 */ SetRequestWindowModeSupportType(uint32_t windowModeSupportType)1523 virtual void SetRequestWindowModeSupportType(uint32_t windowModeSupportType) {} 1524 /** 1525 * @brief Get requested mode support info. 1526 * 1527 * @return Enumeration values under WindowModeSupport. 1528 */ GetRequestWindowModeSupportType()1529 virtual uint32_t GetRequestWindowModeSupportType() const { return 0; } 1530 /** 1531 * @brief Set touch hot areas. 1532 * 1533 * @param rects Hot areas of touching. 1534 * @return WM_OK means set success, others means set failed. 1535 */ SetTouchHotAreas(const std::vector<Rect> & rects)1536 virtual WMError SetTouchHotAreas(const std::vector<Rect>& rects) { return WMError::WM_OK; } 1537 /** 1538 * @brief Get requested touch hot areas. 1539 * 1540 * @param rects Hot areas of touching. 1541 */ GetRequestedTouchHotAreas(std::vector<Rect> & rects)1542 virtual void GetRequestedTouchHotAreas(std::vector<Rect>& rects) const {} 1543 /** 1544 * @brief Main handler available or not. 1545 * 1546 * @return True means main handler is available, false means the opposite. 1547 */ IsMainHandlerAvailable()1548 virtual bool IsMainHandlerAvailable() const { return false; } 1549 /** 1550 * @brief Set window label name. 1551 * 1552 * @param label Window label name. 1553 * @return WM_OK means set success, others means set failed. 1554 */ SetAPPWindowLabel(const std::string & label)1555 virtual WMError SetAPPWindowLabel(const std::string& label) { return WMError::WM_OK; } 1556 /** 1557 * @brief Set window icon. 1558 * 1559 * @param icon Window icon. 1560 * @return WM_OK means set success, others means set failed. 1561 */ SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap> & icon)1562 virtual WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) { return WMError::WM_OK; } 1563 1564 /** 1565 * @brief disable main window decoration. It must be callled before loadContent. 1566 * 1567 */ DisableAppWindowDecor()1568 virtual WMError DisableAppWindowDecor() { return WMError::WM_OK; } 1569 /** 1570 * @brief return window decoration is enabled. It is called by ACE 1571 * 1572 * @return true means window decoration is enabled. Otherwise disabled 1573 */ IsDecorEnable()1574 virtual bool IsDecorEnable() const { return false; } 1575 /** 1576 * @brief maximize the main window. It is called by ACE when maximize button is clicked. 1577 * 1578 * @return WMError 1579 */ Maximize()1580 virtual WMError Maximize() { return WMError::WM_OK; } 1581 1582 /** 1583 * @brief maximize window with presentation enum. 1584 * 1585 * @param presentation the value means use presentation enum to layout when maximize window 1586 * @return WM_OK means maximize window ok, others means failed. 1587 */ Maximize(MaximizePresentation presentation)1588 virtual WMError Maximize(MaximizePresentation presentation) 1589 { 1590 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1591 } 1592 1593 /** 1594 * @brief maximize the main window according to MaximizeMode. called by ACE when maximize button is clicked. 1595 * 1596 * @return WMError 1597 */ MaximizeFloating()1598 virtual WMError MaximizeFloating() {return WMError::WM_OK;} 1599 /** 1600 * @brief minimize the main window. It is called by ACE when minimize button is clicked. 1601 * 1602 * @return WMError 1603 */ Minimize()1604 virtual WMError Minimize() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1605 /** 1606 * @brief recovery the main window. It is called by ACE when recovery button is clicked. 1607 * 1608 * @return WMError 1609 */ Recover()1610 virtual WMError Recover() { return WMError::WM_OK; } 1611 1612 /** 1613 * @brief After the app main window is minimized, if the Ability is not in the backgroud state, 1614 * you can restore app main window. 1615 * 1616 * @return WMError 1617 */ Restore()1618 virtual WMError Restore() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1619 1620 /** 1621 * @brief close the main window. It is called by ACE when close button is clicked. 1622 * 1623 * @return WMError 1624 */ Close()1625 virtual WMError Close() { return WMError::WM_OK; } 1626 /** 1627 * @brief start move main window. It is called by ACE when title is moved. 1628 * 1629 */ StartMove()1630 virtual void StartMove() {} 1631 /** 1632 * @brief get main window move flag. 1633 * 1634 * @return true means main window is moving. Otherwise is not moving. 1635 */ IsStartMoving()1636 virtual bool IsStartMoving() { return false; } 1637 1638 /** 1639 * @brief Start move window. It is called by application. 1640 * 1641 * @return Errorcode of window. 1642 */ StartMoveWindow()1643 virtual WmErrorCode StartMoveWindow() { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 1644 1645 /** 1646 * @brief Set flag that need remove window input channel. 1647 * 1648 * @param needRemoveWindowInputChannel True means remove input channel, false means not remove. 1649 */ SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel)1650 virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) {} 1651 /** 1652 * @brief set global window maximize mode. It is called by ACE when maximize mode changed. 1653 * 1654 * @param mode MODE_AVOID_SYSTEM_BAR - avoid statusbar and dockbar; MODE_FULL_FILL - fullfill the screen 1655 * 1656 * @return WMError 1657 */ SetGlobalMaximizeMode(MaximizeMode mode)1658 virtual WMError SetGlobalMaximizeMode(MaximizeMode mode) {return WMError::WM_OK;} 1659 /** 1660 * @brief get global window maximize mode. 1661 * 1662 * @return MaximizeMode 1663 */ GetGlobalMaximizeMode()1664 virtual MaximizeMode GetGlobalMaximizeMode() const {return MaximizeMode::MODE_FULL_FILL;} 1665 1666 // colorspace, gamut 1667 /** 1668 * @brief Is support wide gamut or not. 1669 * 1670 * @return True means support wide gamut, false means not support. 1671 */ IsSupportWideGamut()1672 virtual bool IsSupportWideGamut() { return false; } 1673 /** 1674 * @brief Set color space. 1675 * 1676 * @param colorSpace ColorSpace object. 1677 */ SetColorSpace(ColorSpace colorSpace)1678 virtual void SetColorSpace(ColorSpace colorSpace) {} 1679 /** 1680 * @brief Get color space object. 1681 * 1682 * @return ColorSpace object. 1683 */ GetColorSpace()1684 virtual ColorSpace GetColorSpace() { return ColorSpace::COLOR_SPACE_DEFAULT; } 1685 DumpInfo(const std::vector<std::string> & params,std::vector<std::string> & info)1686 virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) {} 1687 /** 1688 * @brief window snapshot 1689 * 1690 * @return std::shared_ptr<Media::PixelMap> snapshot pixel 1691 */ Snapshot()1692 virtual std::shared_ptr<Media::PixelMap> Snapshot() { return nullptr; } 1693 1694 /** 1695 * @brief Handle and notify memory level. 1696 * 1697 * @param level memory level 1698 * @return the error code of window 1699 */ NotifyMemoryLevel(int32_t level)1700 virtual WMError NotifyMemoryLevel(int32_t level) { return WMError::WM_OK; } 1701 1702 /** 1703 * @brief Update configuration for all windows 1704 * 1705 * @param configuration configuration for app 1706 */ IsAllowHaveSystemSubWindow()1707 virtual bool IsAllowHaveSystemSubWindow() { return false; } 1708 1709 /** 1710 * @brief Set aspect ratio of this window 1711 * 1712 * @param ratio the aspect ratio of window except decoration 1713 * @return WMError 1714 */ SetAspectRatio(float ratio)1715 virtual WMError SetAspectRatio(float ratio) { return WMError::WM_OK; } 1716 /** 1717 * @brief Unset aspect ratio 1718 * @return WMError 1719 */ ResetAspectRatio()1720 virtual WMError ResetAspectRatio() { return WMError::WM_OK; } 1721 /** 1722 * @brief Get keyboard animation config 1723 * @return KeyboardAnimationConfig 1724 */ GetKeyboardAnimationConfig()1725 virtual KeyboardAnimationConfig GetKeyboardAnimationConfig() { return {}; } 1726 /** 1727 * @brief Set need default animation for window show and hide. 1728 * 1729 * @param needDefaultAnimation True means need default animation, false means not need. 1730 */ SetNeedDefaultAnimation(bool needDefaultAnimation)1731 virtual void SetNeedDefaultAnimation(bool needDefaultAnimation) {} 1732 /** 1733 * @brief Transfer Ability Result. 1734 * @return WMError 1735 */ TransferAbilityResult(uint32_t resultCode,const AAFwk::Want & want)1736 virtual WMError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) { return WMError::WM_OK; } 1737 /** 1738 * @brief Transfer UIExtension data to Extension Component. 1739 * @return WMError 1740 */ TransferExtensionData(const AAFwk::WantParams & wantParams)1741 virtual WMError TransferExtensionData(const AAFwk::WantParams& wantParams) { return WMError::WM_OK; } 1742 /** 1743 * @brief Register transfer component data callback. 1744 * 1745 * @param func Function to notify transfer component data. 1746 */ RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc & func)1747 virtual void RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) {} 1748 /** 1749 * @brief Trigger BindUIExtensionModal callback. 1750 * It needs to be called when the UIExtension frame node is set to asynchronously bind to the modal window. 1751 */ TriggerBindModalUIExtension()1752 virtual void TriggerBindModalUIExtension() {} 1753 /** 1754 * @brief Perform back event. 1755 * 1756 */ PerformBack()1757 virtual void PerformBack() {} 1758 /** 1759 * @brief Set the drag enabled flag of a window. 1760 * 1761 * @param dragEnabled true means the window can be resized by dragging, otherwise means the opposite. 1762 * @return Errorcode of window. 1763 */ SetResizeByDragEnabled(bool dragEnabled)1764 virtual WMError SetResizeByDragEnabled(bool dragEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1765 /** 1766 * @brief Set the raise enabled flag of a window. 1767 * 1768 * @param raiseEnabled true means the window can be raised by click, otherwise means the opposite. 1769 * @return Errorcode of window. 1770 */ SetRaiseByClickEnabled(bool raiseEnabled)1771 virtual WMError SetRaiseByClickEnabled(bool raiseEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1772 /** 1773 * @brief Raise one app sub window above another. 1774 * 1775 * @return WM_OK means raise success, others means raise failed. 1776 */ RaiseAboveTarget(int32_t subWindowId)1777 virtual WMError RaiseAboveTarget(int32_t subWindowId) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1778 1779 /** 1780 * @brief Hide non-system floating windows. 1781 * 1782 * @param shouldHide true means the non-system windows should be hidden, otherwise means the opposite. 1783 * @return Errorcode of window. 1784 */ HideNonSystemFloatingWindows(bool shouldHide)1785 virtual WMError HideNonSystemFloatingWindows(bool shouldHide) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1786 1787 /** 1788 * @brief Is floating window of app type or not. 1789 * 1790 * @return True means floating window of app type, false means the opposite. 1791 */ IsFloatingWindowAppType()1792 virtual bool IsFloatingWindowAppType() const { return false; } 1793 1794 /** 1795 * @brief Is pc window or not. 1796 * 1797 * @return True means pc window, false means the opposite. 1798 */ IsPcWindow()1799 virtual bool IsPcWindow() const { return false; } 1800 1801 /** 1802 * @brief Is pc window of app type or not. 1803 * 1804 * @return True means pc window of app type, false means the opposite. 1805 */ IsPcOrPadCapabilityEnabled()1806 virtual bool IsPcOrPadCapabilityEnabled() const { return false; } 1807 1808 /** 1809 * @brief Is pc window or pad free multi-window. 1810 * 1811 * @return True means pc window or pad free multi-window, false means the opposite. 1812 */ IsPcOrPadFreeMultiWindowMode()1813 virtual bool IsPcOrPadFreeMultiWindowMode() const { return false; } 1814 1815 /** 1816 * @brief Register transfer component data callback. 1817 * 1818 * @param func Function to notify transfer component data. 1819 */ RegisterTransferComponentDataForResultListener(const NotifyTransferComponentDataForResultFunc & func)1820 virtual void RegisterTransferComponentDataForResultListener(const NotifyTransferComponentDataForResultFunc& func) {} 1821 1822 /** 1823 * @brief Set Text Field Avoid Info. 1824 * 1825 * @return Errorcode of window. 1826 */ SetTextFieldAvoidInfo(double textFieldPositionY,double textFieldHeight)1827 virtual WMError SetTextFieldAvoidInfo(double textFieldPositionY, double textFieldHeight) { return WMError::WM_OK; } 1828 1829 /** 1830 * @brief Transfer accessibility event data 1831 * 1832 * @param func Function to notify transfer component data. 1833 */ TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo & info,int64_t uiExtensionIdLevel)1834 virtual WMError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, 1835 int64_t uiExtensionIdLevel) { return WMError::WM_OK; }; 1836 1837 /** 1838 * @brief Notify prepare to close window 1839 * 1840 * @return Errorcode of window. 1841 */ NotifyPrepareClosePiPWindow()1842 virtual WMError NotifyPrepareClosePiPWindow() { return WMError::WM_OK; } 1843 1844 /** 1845 * @brief update the pip window instance (w,h,r). 1846 * 1847 * @param width width of pip window. 1848 * @param height width of pip window. 1849 * @param reason reason of update. 1850 */ UpdatePiPRect(const Rect & rect,WindowSizeChangeReason reason)1851 virtual void UpdatePiPRect(const Rect& rect, WindowSizeChangeReason reason) {} 1852 1853 /** 1854 * @brief update the pip control status. 1855 * 1856 * @param controlType pip control type. 1857 * @param status pip control status. 1858 */ UpdatePiPControlStatus(PiPControlType controlType,PiPControlStatus status)1859 virtual void UpdatePiPControlStatus(PiPControlType controlType, PiPControlStatus status) {} 1860 1861 /** 1862 * @brief set auto start status for window. 1863 * 1864 * @param isAutoStart true means auto start pip window when background, otherwise means the opposite. 1865 * @param priority 1 means height priority, 0 means low priority. 1866 */ SetAutoStartPiP(bool isAutoStart,uint32_t priority)1867 virtual void SetAutoStartPiP(bool isAutoStart, uint32_t priority) {} 1868 1869 /** 1870 * @brief When get focused, keep the keyboard created by other windows, support system window and app subwindow. 1871 * 1872 * @param keepKeyboardFlag true means the keyboard should be preserved, otherwise means the opposite. 1873 * @return WM_OK means set keep keyboard flag success, others means failed. 1874 */ KeepKeyboardOnFocus(bool keepKeyboardFlag)1875 virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) 1876 { 1877 return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; 1878 } 1879 1880 /** 1881 * @brief Register window visibility change listener. 1882 * 1883 * @param listener IWindowVisibilityChangedListener. 1884 * @return WM_OK means register success, others means register failed. 1885 */ RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr & listener)1886 virtual WMError RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) 1887 { 1888 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1889 } 1890 1891 /** 1892 * @brief Unregister window visibility change listener. 1893 * 1894 * @param listener IWindowVisibilityChangedListener. 1895 * @return WM_OK means unregister success, others means unregister failed. 1896 */ UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr & listener)1897 virtual WMError UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) 1898 { 1899 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1900 } 1901 1902 /** 1903 * @brief Register window displayId change listener. 1904 * 1905 * @param listener IDisplayIdChangedListener. 1906 * @return WM_OK means register success, others means register failed. 1907 */ RegisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr & listener)1908 virtual WMError RegisterDisplayIdChangeListener( 1909 const IDisplayIdChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1910 1911 /** 1912 * @brief Unregister window displayId change listener. 1913 * 1914 * @param listener IDisplayIdChangedListener. 1915 * @return WM_OK means unregister success, others means unregister failed. 1916 */ UnregisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr & listener)1917 virtual WMError UnregisterDisplayIdChangeListener( 1918 const IDisplayIdChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1919 1920 /** 1921 * @brief Get the window limits of current window. 1922 * 1923 * @param windowLimits. 1924 * @return WMError. 1925 */ GetWindowLimits(WindowLimits & windowLimits)1926 virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1927 1928 /** 1929 * @brief Set the window limits of current window. 1930 * 1931 * @param windowLimits. 1932 * @return WMError. 1933 */ SetWindowLimits(WindowLimits & windowLimits)1934 virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1935 1936 /** 1937 * @brief Register listener, if timeout(seconds) pass with no interaction, the listener will be executed. 1938 * 1939 * @param listener IWindowNoInteractionListenerSptr. 1940 * @return WM_OK means unregister success, others means unregister failed. 1941 */ RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)1942 virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 1943 { 1944 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1945 } 1946 1947 /** 1948 * @brief Unregister window no interaction listener. 1949 * 1950 * @param listener IWindowNoInteractionListenerSptr. 1951 * @return WM_OK means unregister success, others means unregister failed. 1952 */ UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)1953 virtual WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 1954 { 1955 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1956 } 1957 1958 /** 1959 * @brief Register window status change listener. 1960 * 1961 * @param listener IWindowStatusChangeListener. 1962 * @return WM_OK means register success, others means register failed. 1963 */ RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener> & listener)1964 virtual WMError RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) 1965 { 1966 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1967 } 1968 /** 1969 * @brief Unregister window status change listener. 1970 * 1971 * @param listener IWindowStatusChangeListener. 1972 * @return WM_OK means unregister success, others means unregister failed. 1973 */ UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener> & listener)1974 virtual WMError UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) 1975 { 1976 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1977 } 1978 1979 /** 1980 * @brief Set Specific System Bar(include status bar and nav bar) Property 1981 * 1982 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 1983 * @param property system bar prop,include content color, background color 1984 * @return WMError 1985 */ SetSpecificBarProperty(WindowType type,const SystemBarProperty & property)1986 virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) 1987 { 1988 return WMError::WM_OK; 1989 } 1990 1991 /** 1992 * @brief Set System Bar(include status bar and nav bar) Properties 1993 * 1994 * @param properties system bar properties 1995 * @param propertyFlags flags of system bar property 1996 * @return WMError 1997 */ SetSystemBarProperties(const std::map<WindowType,SystemBarProperty> & properties,const std::map<WindowType,SystemBarPropertyFlag> & propertyFlags)1998 virtual WMError SetSystemBarProperties(const std::map<WindowType, SystemBarProperty>& properties, 1999 const std::map<WindowType, SystemBarPropertyFlag>& propertyFlags) 2000 { 2001 return WMError::WM_OK; 2002 } 2003 2004 /** 2005 * @brief Get System Bar(include status bar and nav bar) Properties 2006 * 2007 * @param properties system bar properties got 2008 * @return WMError 2009 */ GetSystemBarProperties(std::map<WindowType,SystemBarProperty> & properties)2010 virtual WMError GetSystemBarProperties(std::map<WindowType, SystemBarProperty>& properties) 2011 { 2012 return WMError::WM_OK; 2013 } 2014 2015 /** 2016 * @brief Set the single frame composer enabled flag of a window. 2017 * 2018 * @param enable true means the single frame composer is enabled, otherwise means the opposite. 2019 * @return Errorcode of window. 2020 */ SetSingleFrameComposerEnabled(bool enable)2021 virtual WMError SetSingleFrameComposerEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2022 2023 /** 2024 * @brief Set the visibility of window decor. 2025 * 2026 * @param isVisible whether the window decor is visible. 2027 * @return Errorcode of window. 2028 */ SetDecorVisible(bool isVisible)2029 virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2030 2031 /** 2032 * @brief Enable or disable move window by title bar. 2033 * 2034 * @param enable The value true means to enable window moving, and false means the opposite. 2035 * @return Errorcode of window. 2036 */ SetWindowTitleMoveEnabled(bool enable)2037 virtual WMError SetWindowTitleMoveEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2038 2039 /** 2040 * @brief Enable drag window. 2041 * 2042 * @param enableDrag The value true means to enable window dragging, and false means the opposite. 2043 * @return Errorcode of window. 2044 */ EnableDrag(bool enableDrag)2045 virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2046 2047 /** 2048 * @brief Set whether to display the maximize, minimize, split buttons of main window. 2049 * 2050 * @param isMaximizeVisible Display maximize button if true, or hide maximize button if false. 2051 * @param isMinimizeVisible Display minimize button if true, or hide minimize button if false. 2052 * @param isSplitVisible Display split button if true, or hide split button if false. 2053 * @param isCloseVisible Display close button if true, or hide close button if false. 2054 * @return Errorcode of window. 2055 */ SetTitleButtonVisible(bool isMaximizeVisible,bool isMinimizeVisible,bool isSplitVisible,bool isCloseVisible)2056 virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible, 2057 bool isCloseVisible) 2058 { 2059 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2060 } 2061 2062 /** 2063 * @brief Set decor height of window. 2064 * 2065 * @param decorHeight Decor height of window 2066 * @return WM_OK means set success, others means set failed. 2067 */ SetDecorHeight(int32_t decorHeight)2068 virtual WMError SetDecorHeight(int32_t decorHeight) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2069 2070 /** 2071 * @brief Get decor height of window. 2072 * 2073 * @return Decor height of window. 2074 */ GetDecorHeight(int32_t & height)2075 virtual WMError GetDecorHeight(int32_t& height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2076 2077 /** 2078 * @brief Get the title buttons area of window. 2079 * 2080 * @param titleButtonRect. 2081 * @return WMError. 2082 */ GetTitleButtonArea(TitleButtonRect & titleButtonRect)2083 virtual WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect) 2084 { 2085 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2086 } 2087 2088 /** 2089 * @brief Register window title buttons change listener. 2090 * 2091 * @param listener IWindowTitleButtonRectChangedListener. 2092 * @return WM_OK means register success, others means register failed. 2093 */ RegisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)2094 virtual WMError RegisterWindowTitleButtonRectChangeListener( 2095 const sptr<IWindowTitleButtonRectChangedListener>& listener) 2096 { 2097 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2098 } 2099 2100 /** 2101 * @brief Unregister window title buttons change listener. 2102 * 2103 * @param listener IWindowTitleButtonRectChangedListener. 2104 * @return WM_OK means unregister success, others means unregister failed. 2105 */ UnregisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)2106 virtual WMError UnregisterWindowTitleButtonRectChangeListener( 2107 const sptr<IWindowTitleButtonRectChangedListener>& listener) 2108 { 2109 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2110 } 2111 2112 /** 2113 * @brief Set whether to use default density. 2114 * 2115 * @param enabled bool. 2116 * @return WM_OK means set success, others means failed. 2117 */ SetDefaultDensityEnabled(bool enabled)2118 virtual WMError SetDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2119 2120 /** 2121 * @brief Get whether to use default density. 2122 * 2123 * @return True means use default density, window's layout not follow to system change, false means the opposite. 2124 */ GetDefaultDensityEnabled()2125 virtual bool GetDefaultDensityEnabled() { return false; } 2126 2127 /** 2128 * @brief Get virtual pixel ratio. 2129 * 2130 * @return Value of PixelRatio obtained from displayInfo. 2131 */ GetVirtualPixelRatio()2132 virtual float GetVirtualPixelRatio() { return 1.0f; } 2133 2134 /** 2135 * @brief Hide None Secure Windows. 2136 * 2137 * @param shouldHide bool. 2138 * @return WMError 2139 */ HideNonSecureWindows(bool shouldHide)2140 virtual WMError HideNonSecureWindows(bool shouldHide) 2141 { 2142 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2143 } 2144 2145 /** 2146 * @brief Set water mark flag. 2147 * 2148 * @param isEnable bool. 2149 * @return WMError 2150 */ SetWaterMarkFlag(bool isEnable)2151 virtual WMError SetWaterMarkFlag(bool isEnable) 2152 { 2153 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2154 } 2155 2156 /** 2157 * @brief Hide the display content when snapshot. 2158 * 2159 * @param needHide bool. 2160 * @return WMError 2161 */ HidePrivacyContentForHost(bool needHide)2162 virtual WMError HidePrivacyContentForHost(bool needHide) 2163 { 2164 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2165 } 2166 2167 /** 2168 * @brief Set the application modality of main window. 2169 * 2170 * @param isModal bool. 2171 * @return WMError 2172 */ SetWindowModal(bool isModal)2173 virtual WMError SetWindowModal(bool isModal) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2174 2175 /** 2176 * @brief Set the modality of window. 2177 * 2178 * @param isModal bool. 2179 * @param modalityType ModalityType. 2180 * @return WMError 2181 */ 2182 virtual WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY) 2183 { 2184 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2185 } 2186 2187 /** 2188 * @brief recovery the main window by function overloading. It is called by JsWindow. 2189 * 2190 * @param reason reason of update. 2191 * @return WMError 2192 */ Recover(uint32_t reason)2193 virtual WMError Recover(uint32_t reason) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2194 2195 /** 2196 * @brief Set to automatically save the window rect. 2197 * 2198 * @param enabled Enable the window rect auto-save if true, otherwise means the opposite. 2199 * @return WM_OK means set success, others means failed. 2200 */ SetWindowRectAutoSave(bool enabled)2201 virtual WMError SetWindowRectAutoSave(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2202 2203 /** 2204 * @brief Get whether the auto-save the window rect is enabled or not. 2205 * 2206 * @param enabled True means the window rect auto-save is enabled, otherwise means the opposite. 2207 * @return WM_OK means set success, others means failed. 2208 */ IsWindowRectAutoSave(bool & enabled)2209 virtual WMError IsWindowRectAutoSave(bool& enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2210 2211 /** 2212 * @brief Get the rect of host window. 2213 * 2214 * @param hostWindowId window Id of the host window. 2215 * @return Rect of window. 2216 */ GetHostWindowRect(int32_t hostWindowId)2217 virtual Rect GetHostWindowRect(int32_t hostWindowId) { return {}; } 2218 2219 /** 2220 * @brief Make multi-window become landscape or not. 2221 * 2222 * @param isLandscapeMultiWindow means whether multi-window's scale is landscape. 2223 * @return WMError WM_OK means set success, others means failed. 2224 */ SetLandscapeMultiWindow(bool isLandscapeMultiWindow)2225 virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) { return WMError::WM_OK; } 2226 2227 /** 2228 * @brief Register subwindow close listener. 2229 * 2230 * @param listener ISubWindowCloseListener. 2231 * @return WM_OK means register success, others means register failed. 2232 */ RegisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener> & listener)2233 virtual WMError RegisterSubWindowCloseListeners( 2234 const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2235 2236 /** 2237 * @brief Unregister subwindow close listener. 2238 * 2239 * @param listener ISubWindowCloseListeners. 2240 * @return WM_OK means unregister success, others means unregister failed. 2241 */ UnregisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener> & listener)2242 virtual WMError UnregisterSubWindowCloseListeners( 2243 const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2244 2245 /** 2246 * @brief Register main window close listener. 2247 * 2248 * @param listener IMainWindowCloseListener. 2249 * @return WM_OK means register success, others means register failed. 2250 */ RegisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener> & listener)2251 virtual WMError RegisterMainWindowCloseListeners( 2252 const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2253 2254 /** 2255 * @brief Unregister main window close listener. 2256 * 2257 * @param listener IMainWindowCloseListener. 2258 * @return WM_OK means unregister success, others means unregister failed. 2259 */ UnregisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener> & listener)2260 virtual WMError UnregisterMainWindowCloseListeners( 2261 const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2262 2263 /** 2264 * @brief Register switch free multi-window listener. 2265 * 2266 * @param listener ISwitchFreeMultiWindowListener. 2267 * @return WM_OK means register success, others means register failed. 2268 */ RegisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener> & listener)2269 virtual WMError RegisterSwitchFreeMultiWindowListener( 2270 const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2271 2272 /** 2273 * @brief Unregister switch free multi-window listener. 2274 * 2275 * @param listener ISwitchFreeMultiWindowListener. 2276 * @return WM_OK means unregister success, others means unregister failed. 2277 */ UnregisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener> & listener)2278 virtual WMError UnregisterSwitchFreeMultiWindowListener( 2279 const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2280 2281 /** 2282 * @brief Set Shaped Window Mask. 2283 * 2284 * @param windowMask Mask of the shaped window. 2285 * @return WM_OK means set success, others means failed. 2286 */ SetWindowMask(const std::vector<std::vector<uint32_t>> & windowMask)2287 virtual WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask) 2288 { 2289 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2290 } 2291 2292 /** 2293 * @brief Register keyboard panel info change listener. 2294 * 2295 * @param listener IKeyboardPanelInfoChangeListener. 2296 * @return WM_OK means register success, others means register failed. 2297 */ RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener> & listener)2298 virtual WMError RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) 2299 { 2300 return WMError::WM_OK; 2301 } 2302 2303 /** 2304 * @brief Unregister keyboard panel info change listener. 2305 * 2306 * @param listener IKeyboardPanelInfoChangeListener. 2307 * @return WM_OK means unregister success, others means unregister failed. 2308 */ UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener> & listener)2309 virtual WMError UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) 2310 { 2311 return WMError::WM_OK; 2312 } 2313 2314 /** 2315 * @brief Get window by id 2316 * 2317 * @param windId window id 2318 * @return sptr<Window> 2319 */ 2320 static sptr<Window> GetWindowWithId(uint32_t windId); 2321 2322 /** 2323 * @brief register keyEvent filter. 2324 * 2325 * @param KeyEventFilterFunc callback func when window recieve keyEvent 2326 * @return WMError 2327 */ SetKeyEventFilter(KeyEventFilterFunc KeyEventFilterFunc)2328 virtual WMError SetKeyEventFilter(KeyEventFilterFunc KeyEventFilterFunc) 2329 { 2330 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2331 } 2332 2333 /** 2334 * @brief clear keyEvent filter. 2335 * 2336 * @return WMError 2337 */ ClearKeyEventFilter()2338 virtual WMError ClearKeyEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;} 2339 2340 /** 2341 * @brief Register window rect change listener. 2342 * 2343 * @param listener IWindowRectChangeListener. 2344 * @return WM_OK means register success, others means register failed. 2345 */ RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)2346 virtual WMError RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 2347 { 2348 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2349 } 2350 2351 /** 2352 * @brief Unregister window rect change listener. 2353 * 2354 * @param listener IWindowRectChangeListener. 2355 * @return WM_OK means unregister success, others means unregister failed. 2356 */ UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)2357 virtual WMError UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 2358 { 2359 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2360 } 2361 2362 /** 2363 * @brief Flush layout size. 2364 * 2365 * @param width The width after layout 2366 * @param height The height after layout 2367 */ FlushLayoutSize(int32_t width,int32_t height)2368 virtual void FlushLayoutSize(int32_t width, int32_t height) {} 2369 2370 /** 2371 * @brief get callingWindow windowStatus. 2372 * @param windowStatus 2373 * @return WM_OK means set success, others means set Failed. 2374 */ GetCallingWindowWindowStatus(WindowStatus & windowStatus)2375 virtual WMError GetCallingWindowWindowStatus(WindowStatus& windowStatus) const 2376 { 2377 return WMError::WM_OK; 2378 } 2379 2380 /** 2381 * @brief get callingWindow windowStatus 2382 * @param rect. 2383 * @return WM_OK means set success, others means set failed 2384 */ GetCallingWindowRect(Rect & rect)2385 virtual WMError GetCallingWindowRect(Rect& rect) const 2386 { 2387 return WMError::WM_OK; 2388 } 2389 2390 /** 2391 * @brief Set gray scale of window 2392 * @param grayScale gray scale of window. 2393 * @return WM_OK means set success, others means set failed. 2394 */ SetGrayScale(float grayScale)2395 virtual WMError SetGrayScale(float grayScale) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2396 2397 /** 2398 * @brief adjust keyboard layout 2399 * @param params 2400 * @return WM_OK means set success, others means set failed 2401 */ AdjustKeyboardLayout(const KeyboardLayoutParams & params)2402 virtual WMError AdjustKeyboardLayout(const KeyboardLayoutParams& params) { return WMError::WM_OK; } 2403 2404 /* 2405 * @brief Set the Dvsync Switch 2406 * 2407 * @param dvsyncSwitch bool. 2408 * @return * void 2409 */ SetUiDvsyncSwitch(bool dvsyncSwitch)2410 virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) {} 2411 2412 /** 2413 * @brief Set whether to enable immersive mode. 2414 * @param enable the value true means to enable immersive mode, and false means the opposite. 2415 * @return WM_OK means set success, others means set failed. 2416 */ SetImmersiveModeEnabledState(bool enable)2417 virtual WMError SetImmersiveModeEnabledState(bool enable) { return WMError::WM_OK; } 2418 2419 /** 2420 * @brief Get whether the immersive mode is enabled or not. 2421 * 2422 * @return true means the immersive mode is enabled, and false means the opposite. 2423 */ GetImmersiveModeEnabledState()2424 virtual bool GetImmersiveModeEnabledState() const { return true; } 2425 2426 /** 2427 * @brief Set the ContinueState of window. 2428 * 2429 * @param continueState of the window. 2430 * @return Errorcode of window. 2431 */ SetContinueState(int32_t continueState)2432 virtual WMError SetContinueState(int32_t continueState) { return WMError::WM_DO_NOTHING; } 2433 2434 /** 2435 * @brief Get whether the free multi-window mode is enabled or not. 2436 * 2437 * @return true means the free multi-window mode is enabled, and false means the opposite. 2438 */ GetFreeMultiWindowModeEnabledState()2439 virtual bool GetFreeMultiWindowModeEnabledState() { return false; } 2440 2441 /** 2442 * @brief Get the window status of current window. 2443 * 2444 * @param windowStatus 2445 * @return WMError. 2446 */ GetWindowStatus(WindowStatus & windowStatus)2447 virtual WMError GetWindowStatus(WindowStatus& windowStatus) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2448 2449 /* 2450 * @brief Get the real parent id of UIExtension 2451 * 2452 * @return Real parent id of UIExtension 2453 */ GetRealParentId()2454 virtual int32_t GetRealParentId() const { return static_cast<int32_t>(INVALID_WINDOW_ID); } 2455 2456 /* 2457 * @brief Get the parent window type of UIExtension 2458 * 2459 * @return Parent window type of UIExtension 2460 */ GetParentWindowType()2461 virtual WindowType GetParentWindowType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 2462 2463 /** 2464 * @brief Notify modal UIExtension it may be covered 2465 * 2466 * @param byLoadContent True when called by loading content, false when called by creating non topmost subwindow 2467 */ NotifyModalUIExtensionMayBeCovered(bool byLoadContent)2468 virtual void NotifyModalUIExtensionMayBeCovered(bool byLoadContent) {} 2469 2470 /** 2471 * @brief Notify extension asynchronously 2472 * 2473 * @param notifyEvent event type 2474 * @return void 2475 */ NotifyExtensionEventAsync(uint32_t notifyEvent)2476 virtual void NotifyExtensionEventAsync(uint32_t notifyEvent) {} 2477 2478 /** 2479 * @brief Get IsUIExtensionFlag of window. 2480 * 2481 * @return true - is UIExtension window, flase - is not UIEXtension window. 2482 */ GetIsUIExtensionFlag()2483 virtual bool GetIsUIExtensionFlag() const { return false; } 2484 2485 /** 2486 * @brief Get IsUIExtensionSubWindowFlag of window. 2487 * 2488 * @return true - is UIExtension sub window, false - is not UIExtension sub window. 2489 */ GetIsUIExtensionSubWindowFlag()2490 virtual bool GetIsUIExtensionSubWindowFlag() const { return false; } 2491 2492 /** 2493 * @brief Set whether to enable gesture back. 2494 * @param enable the value true means to enable gesture back, and false means the opposite. 2495 * @return WM_OK means set success, others means set failed. 2496 */ SetGestureBackEnabled(bool enable)2497 virtual WMError SetGestureBackEnabled(bool enable) { return WMError::WM_OK; } 2498 2499 /** 2500 * @brief Get whether to enable gesture back. 2501 * @param enable the value true means to enable gesture back, and false means the opposite. 2502 * @return WM_OK means get success, others means get failed. 2503 */ GetGestureBackEnabled(bool & enable)2504 virtual WMError GetGestureBackEnabled(bool& enable) { return WMError::WM_OK; } 2505 2506 /** 2507 * @brief Get the type of Window. 2508 * 2509 * @return The string corresponding to the Window. 2510 */ GetClassType()2511 virtual std::string GetClassType() const { return "Window"; } 2512 }; 2513 } 2514 } 2515 #endif // OHOS_ROSEN_WINDOW_H 2516