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