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