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 "wm_common.h" 24 #include "window_option.h" 25 #include "occupied_area_change_info.h" 26 27 class NativeValue; 28 class NativeEngine; 29 namespace OHOS::MMI { 30 class PointerEvent; 31 class KeyEvent; 32 class AxisEvent; 33 } 34 namespace OHOS::AppExecFwk { 35 class Configuration; 36 class Ability; 37 } 38 39 namespace OHOS::AbilityRuntime { 40 class AbilityContext; 41 class Context; 42 } 43 44 namespace OHOS::AAFwk { 45 class Want; 46 class WantParams; 47 } 48 49 namespace OHOS::Ace { 50 class UIContent; 51 } 52 53 namespace OHOS::Media { 54 class PixelMap; 55 } 56 57 namespace OHOS { 58 namespace Rosen { 59 using NotifyNativeWinDestroyFunc = std::function<void(std::string windowName)>; 60 using NotifyTransferComponentDataFunc = std::function<void(const AAFwk::WantParams& wantParams)>; 61 class RSSurfaceNode; 62 class RSTransaction; 63 class ISession; 64 65 /** 66 * @class IWindowLifeCycle 67 * 68 * @brief IWindowLifeCycle is a listener used to notify caller that lifecycle of window. 69 */ 70 class IWindowLifeCycle : virtual public RefBase { 71 public: 72 /** 73 * @brief Notify caller that window is on the forground. 74 */ AfterForeground()75 virtual void AfterForeground() {} 76 /** 77 * @brief Notify caller that window is on the background. 78 */ AfterBackground()79 virtual void AfterBackground() {} 80 /** 81 * @brief Notify caller that window is focused. 82 */ AfterFocused()83 virtual void AfterFocused() {} 84 /** 85 * @brief Notify caller that window is unfocused. 86 */ AfterUnfocused()87 virtual void AfterUnfocused() {} 88 /** 89 * @brief Notify caller the error code when window go forground failed. 90 * 91 * @param ret Error code when window go forground failed. 92 */ ForegroundFailed(int32_t ret)93 virtual void ForegroundFailed(int32_t ret) {} 94 /** 95 * @brief Notify caller the error code when window go background failed. 96 * 97 * @param ret Error code when window go background failed. 98 */ BackgroundFailed(int32_t ret)99 virtual void BackgroundFailed(int32_t ret) {} 100 /** 101 * @brief Notify caller that window is active. 102 */ AfterActive()103 virtual void AfterActive() {} 104 /** 105 * @brief Notify caller that window is inactive. 106 */ AfterInactive()107 virtual void AfterInactive() {} 108 }; 109 110 /** 111 * @class IWindowChangeListener 112 * 113 * @brief IWindowChangeListener is used to observe the window size or window mode when window changed. 114 */ 115 class IWindowChangeListener : virtual public RefBase { 116 public: 117 /** 118 * @brief Notify caller when window size changed. 119 * 120 * @param Rect Rect of the current window. 121 * @param reason Reason for window change. 122 * @param rsTransaction Synchronization transaction for animation 123 */ 124 virtual void OnSizeChange(Rect rect, WindowSizeChangeReason reason, 125 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 126 /** 127 * @brief Notify caller when window mode changed. 128 * 129 * @param mode Mode of the current window. 130 * @param hasDeco Window has decoration or not. 131 */ 132 virtual void OnModeChange(WindowMode mode, bool hasDeco = true) {} 133 }; 134 135 /** 136 * @class IAvoidAreaChangedListener 137 * 138 * @brief IAvoidAreaChangedListener is used to observe the avoid area when avoid area size changed. 139 */ 140 class IAvoidAreaChangedListener : virtual public RefBase { 141 public: 142 /** 143 * @brief Notify caller when avoid area size changed. 144 * 145 * @param avoidArea Area needed to be avoided. 146 * @param type Type of avoid area. 147 */ OnAvoidAreaChanged(const AvoidArea avoidArea,AvoidAreaType type)148 virtual void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) {} 149 }; 150 151 /** 152 * @class IWindowDragListener 153 * 154 * @brief IWindowDragListener is used to observe the drag status when drag window. 155 */ 156 class IWindowDragListener : virtual public RefBase { 157 public: 158 /** 159 * @brief Notify caller when drag window. 160 * 161 * @param x X-axis when drag window. 162 * @param y Y-axis when drag window. 163 * @param event Drag type. 164 */ OnDrag(int32_t x,int32_t y,DragEvent event)165 virtual void OnDrag(int32_t x, int32_t y, DragEvent event) {} 166 }; 167 168 /** 169 * @class IDisplayMoveListener 170 * 171 * @brief IDisplayMoveListener is used to observe display move status when display move. 172 */ 173 class IDisplayMoveListener : virtual public RefBase { 174 public: 175 /** 176 * @brief Notify caller when display move. 177 * 178 * @param from Display id before display start move. 179 * @param to Display id after display move end. 180 */ OnDisplayMove(DisplayId from,DisplayId to)181 virtual void OnDisplayMove(DisplayId from, DisplayId to) {} 182 }; 183 184 /** 185 * @class IDispatchInputEventListener 186 * 187 * @brief IDispatchInputEventListener is used to dispatch input event. 188 */ 189 class IDispatchInputEventListener : virtual public RefBase { 190 public: 191 /** 192 * @brief Dispatch PointerEvent. 193 * 194 * @param inputEvent Means PointerEvent. 195 */ OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent> & inputEvent)196 virtual void OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 197 /** 198 * @brief Dispatch KeyEvent. 199 * 200 * @param inputEvent Means KeyEvent. 201 */ OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent> & keyEvent)202 virtual void OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent) {} 203 }; 204 205 /** 206 * @class IOccupiedAreaChangeListener 207 * 208 * @brief IOccupiedAreaChangeListener is used to observe OccupiedArea change. 209 */ 210 class IOccupiedAreaChangeListener : virtual public RefBase { 211 public: 212 /** 213 * @brief Notify caller when OccupiedArea size change. 214 * 215 * @param info Occupied area info when occupied changed. 216 * @param rsTransaction Animation transaction. 217 */ 218 virtual void OnSizeChange(const sptr<OccupiedAreaChangeInfo>& info, 219 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 220 }; 221 222 /** 223 * @class IAceAbilityHandler 224 * 225 * @brief IAceAbilityHandler is used to control Ace Ability. 226 */ 227 class IAceAbilityHandler : virtual public RefBase { 228 public: 229 /** 230 * @brief Set BackgroundColor 231 * 232 * @param color Color of Background. 233 */ SetBackgroundColor(uint32_t color)234 virtual void SetBackgroundColor(uint32_t color) {} 235 /** 236 * @brief Get BackgroundColor. 237 * 238 * @return Value of BackgroundColor and default color is white. 239 */ GetBackgroundColor()240 virtual uint32_t GetBackgroundColor() { return 0xffffffff; } 241 }; 242 243 /** 244 * @class IInputEventConsumer 245 * 246 * @brief IInputEventConsumer is a Listener to observe InputEvent consumed or not. 247 */ 248 class IInputEventConsumer { 249 public: 250 /** 251 * @brief Default construct func of IInputEventConsumer. 252 */ 253 IInputEventConsumer() = default; 254 /** 255 * @brief Default Destructor func of IInputEventConsumer. 256 */ 257 virtual ~IInputEventConsumer() = default; 258 /** 259 * @brief Observe KeyEvent of Multi-Model Input. 260 * 261 * @param keyEvent KeyEvent of Multi-Model Input. 262 */ OnInputEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)263 virtual bool OnInputEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) const { return false; } 264 /** 265 * @brief Observe PointerEvent of Multi-Model Input. 266 * 267 * @param pointerEvent PointerEvent of Multi-Model Input. 268 */ OnInputEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)269 virtual bool OnInputEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) const { return false; } 270 /** 271 * @brief Observe axisEvent of Multi-Model Input. 272 * 273 * @param axisEvent AxisEvent of Multi-Model Input. 274 */ OnInputEvent(const std::shared_ptr<MMI::AxisEvent> & axisEvent)275 virtual bool OnInputEvent(const std::shared_ptr<MMI::AxisEvent>& axisEvent) const { return false; } 276 }; 277 278 /** 279 * @class ITouchOutsideListener 280 * 281 * @brief ITouchOutsideListener is a Listener to observe event when touch outside the window. 282 */ 283 class ITouchOutsideListener : virtual public RefBase { 284 public: 285 /** 286 * @brief Observe the event when touch outside the window. 287 */ OnTouchOutside()288 virtual void OnTouchOutside() const {} 289 }; 290 291 /** 292 * @class IAnimationTransitionController 293 * 294 * @brief IAnimationTransitionController is a Listener to observe event about animation. 295 */ 296 class IAnimationTransitionController : virtual public RefBase { 297 public: 298 /** 299 * @brief Observe the event when animation show. 300 */ AnimationForShown()301 virtual void AnimationForShown() {} 302 /** 303 * @brief Observe the event when animation hide. 304 */ AnimationForHidden()305 virtual void AnimationForHidden() {} 306 }; 307 308 /** 309 * @class IScreenshotListener 310 * 311 * @brief IScreenshotListener is a Listener to observe event when screenshot happened. 312 */ 313 class IScreenshotListener : virtual public RefBase { 314 public: 315 /** 316 * @brief Observe event when screenshot happened. 317 */ OnScreenshot()318 virtual void OnScreenshot() {} 319 }; 320 321 /** 322 * @class IDialogTargetTouchListener 323 * 324 * @brief IDialogTargetTouchListener is a Listener to observe event when touch dialog window. 325 */ 326 class IDialogTargetTouchListener : virtual public RefBase { 327 public: 328 /** 329 * @brief Observe event when touch dialog window. 330 */ OnDialogTargetTouch()331 virtual void OnDialogTargetTouch() const {} 332 }; 333 334 /** 335 * @class IDialogDeathRecipientListener 336 * 337 * @brief IDialogDeathRecipientListener is a Listener to observe event when mainwindow(bind to dialog) destroyed. 338 */ 339 class IDialogDeathRecipientListener : virtual public RefBase { 340 public: 341 /** 342 * @brief Observe event when mainwindow(bind to dialog) destroyed. 343 */ OnDialogDeathRecipient()344 virtual void OnDialogDeathRecipient() const {} 345 }; 346 347 static WMError DefaultCreateErrCode = WMError::WM_OK; 348 class Window : virtual public RefBase { 349 public: 350 /** 351 * @brief create window, include main_window/sub_window/system_window 352 * 353 * @param windowName window name, identify window instance 354 * @param option window propertion 355 * @param context ability context 356 * @return sptr<Window> If create window success,return window instance;Otherwise, return nullptr 357 */ 358 static sptr<Window> Create(const std::string& windowName, 359 sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context = nullptr, 360 WMError& errCode = DefaultCreateErrCode); 361 362 /** 363 * @brief create main/uiextension window with session 364 * 365 * @param option window propertion 366 * @param context ability context 367 * @param iSession session token of window session 368 * @param errCode error code of create window 369 * @return sptr<Window> If create window success, return window instance; Otherwise, return nullptr 370 */ 371 static sptr<Window> Create(sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context, 372 const sptr<IRemoteObject>& iSession, WMError& errCode = DefaultCreateErrCode); 373 374 /** 375 * @brief find window by windowName 376 * 377 * @param windowName 378 * @return sptr<Window> Return the window instance founded 379 */ 380 static sptr<Window> Find(const std::string& windowName); 381 /** 382 * @brief Get the final show window by context. Its implemented in api8 383 * 384 * @param context Indicates the context on which the window depends 385 * @return sptr<Window> 386 */ 387 static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 388 /** 389 * @brief Get the final show window by id. Its implemented in api8 390 * 391 * @param mainWinId main window id? 392 * @return sptr<Window> 393 */ 394 static sptr<Window> GetTopWindowWithId(uint32_t mainWinId); 395 /** 396 * @brief Get the all sub windows by parent 397 * 398 * @param parentId parent window id 399 * @return std::vector<sptr<Window>> 400 */ 401 static std::vector<sptr<Window>> GetSubWindow(uint32_t parentId); 402 403 /** 404 * @brief Update configuration for all windows 405 * 406 * @param configuration configuration for app 407 */ 408 static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 409 /** 410 * @brief Get surface node from RS 411 * 412 * @return Surface node from RS 413 */ GetSurfaceNode()414 virtual std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const { return nullptr; } 415 /** 416 * @brief Get ability context 417 * 418 * @return Ability context from AbilityRuntime 419 */ GetContext()420 virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const { return nullptr; } 421 /** 422 * @brief Get the window show rect 423 * 424 * @return Rect of window 425 */ GetRect()426 virtual Rect GetRect() const { return {}; } 427 /** 428 * @brief Get window default rect from window property. 429 * 430 * @return Rect of window. 431 */ GetRequestRect()432 virtual Rect GetRequestRect() const { return {}; } 433 /** 434 * @brief Get the window type 435 * 436 * @return Type of window 437 */ GetType()438 virtual WindowType GetType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 439 /** 440 * @brief Get the window mode. 441 * 442 * @return Mode of window. 443 */ GetMode()444 virtual WindowMode GetMode() const { return WindowMode::WINDOW_MODE_UNDEFINED; } 445 /** 446 * @brief Get alpha of window. 447 * 448 * @return Alpha of window. 449 */ GetAlpha()450 virtual float GetAlpha() const { return 0.0f; } 451 /** 452 * @brief Get the name of window. 453 * 454 * @return Name of window. 455 */ GetWindowName()456 virtual const std::string& GetWindowName() const 457 { 458 static const std::string name; 459 return name; 460 } 461 /** 462 * @brief Get id of window. 463 * 464 * @return ID of window. 465 */ GetWindowId()466 virtual uint32_t GetWindowId() const { return INVALID_WINDOW_ID; } 467 /** 468 * @brief Get flag of window. 469 * 470 * @return Flag of window. 471 */ GetWindowFlags()472 virtual uint32_t GetWindowFlags() const { return 0; } 473 /** 474 * @brief Get state of window. 475 * 476 * @return Current state of window. 477 */ GetWindowState()478 virtual WindowState GetWindowState() const { return WindowState::STATE_INITIAL; } 479 /** 480 * @brief Set focusable property of window. 481 * 482 * @param isFocusable Window can be focused or not. 483 * @return Errorcode of window. 484 */ SetFocusable(bool isFocusable)485 virtual WMError SetFocusable(bool isFocusable) { return WMError::WM_OK; } 486 /** 487 * @brief Get focusable property of window. 488 * 489 * @return True means window can be focused, false means window cannot be focused. 490 */ GetFocusable()491 virtual bool GetFocusable() const { return false; } 492 /** 493 * @brief Set touchable property of window. 494 * 495 * @param isTouchable Window can be touched or not. 496 * @return Errorcode of window. 497 */ SetTouchable(bool isTouchable)498 virtual WMError SetTouchable(bool isTouchable) { return WMError::WM_OK; } 499 /** 500 * @brief Get touchable property of window. 501 * 502 * @return True means window can be touched, false means window cannot be touched. 503 */ GetTouchable()504 virtual bool GetTouchable() const { return false; } 505 /** 506 * @brief Get SystemBarProperty By WindowType. 507 * 508 * @param type Type of window. 509 * @return Property of system bar. 510 */ GetSystemBarPropertyByType(WindowType type)511 virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const { return {}; } 512 /** 513 * @brief judge this window is full screen. 514 * 515 * @return true If SetFullScreen(true) is called , return true. 516 * @return false default return false 517 */ IsFullScreen()518 virtual bool IsFullScreen() const { return false; } 519 /** 520 * @brief judge window layout is full screen 521 * 522 * @return true this window layout is full screen 523 * @return false this window layout is not full screen 524 */ IsLayoutFullScreen()525 virtual bool IsLayoutFullScreen() const { return false; } 526 /** 527 * @brief Set the Window Type 528 * 529 * @param type window type 530 * @return WMError 531 */ SetWindowType(WindowType type)532 virtual WMError SetWindowType(WindowType type) { return WMError::WM_OK; } 533 /** 534 * @brief Set the Window Mode 535 * 536 * @param mode window mode 537 * @return WMError 538 */ SetWindowMode(WindowMode mode)539 virtual WMError SetWindowMode(WindowMode mode) { return WMError::WM_OK; } 540 /** 541 * @brief Set alpha of window. 542 * 543 * @param alpha Alpha of window. 544 * @return WM_OK means success, others means set failed. 545 */ SetAlpha(float alpha)546 virtual WMError SetAlpha(float alpha) { return WMError::WM_OK; } 547 /** 548 * @brief Set transform of window property. 549 * 550 * @param trans Window Transform. 551 * @return WMError 552 */ SetTransform(const Transform & trans)553 virtual WMError SetTransform(const Transform& trans) { return WMError::WM_OK; } 554 /** 555 * @brief Get transform of window property. 556 * 557 * @return Property of transform. 558 */ GetTransform()559 virtual const Transform& GetTransform() const 560 { 561 static const Transform trans; 562 return trans; 563 } 564 /** 565 * @brief Add window flag. 566 * 567 * @param flag Flag of window. 568 * @return WM_OK means add success, others means failed. 569 */ AddWindowFlag(WindowFlag flag)570 virtual WMError AddWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 571 /** 572 * @brief Remove window flag. 573 * 574 * @param flag Flag of window 575 * @return WM_OK means remove success, others means failed. 576 */ RemoveWindowFlag(WindowFlag flag)577 virtual WMError RemoveWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 578 /** 579 * @brief Set window flag. 580 * 581 * @param flags Flag of window 582 * @return WM_OK means set success, others means failed. 583 */ SetWindowFlags(uint32_t flags)584 virtual WMError SetWindowFlags(uint32_t flags) { return WMError::WM_OK; } 585 /** 586 * @brief Set the System Bar(include status bar and nav bar) Property 587 * 588 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 589 * @param property system bar prop,include content color, background color 590 * @return WMError 591 */ SetSystemBarProperty(WindowType type,const SystemBarProperty & property)592 virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) { return WMError::WM_OK; } 593 /** 594 * @brief Get the Avoid Area By Type object 595 * 596 * @param type avoid area type.@see reference 597 * @param avoidArea 598 * @return WMError 599 */ GetAvoidAreaByType(AvoidAreaType type,AvoidArea & avoidArea)600 virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) { return WMError::WM_OK; } 601 /** 602 * @brief Set this window layout full screen, with hide status bar and nav bar above on this window 603 * 604 * @param status 605 * @return WMError 606 */ SetLayoutFullScreen(bool status)607 virtual WMError SetLayoutFullScreen(bool status) { return WMError::WM_OK; } 608 /** 609 * @brief Set this window full screen, with hide status bar and nav bar 610 * 611 * @param status if true, hide status bar and nav bar; Otherwise, show status bar and nav bar 612 * @return WMError 613 */ SetFullScreen(bool status)614 virtual WMError SetFullScreen(bool status) { return WMError::WM_OK; } 615 /** 616 * @brief destroy window 617 * 618 * @return WMError 619 */ Destroy()620 virtual WMError Destroy() { return WMError::WM_OK; } 621 /** 622 * @brief Show window 623 * 624 * @param reason Reason for window state change. 625 * @param withAnimation True means window show with animation, false means window show without animation. 626 * @return WM_OK means window show success, others means failed. 627 */ 628 virtual WMError Show(uint32_t reason = 0, bool withAnimation = false) { return WMError::WM_OK; } 629 /** 630 * @brief Hide window 631 * 632 * @param reason Reason for window state change. 633 * @param withAnimation True means window show with animation, false means window show without animation. 634 * @param isFromInnerkits True means remove command is from inner kits. 635 * @return WM_OK means window hide success, others means failed. 636 */ 637 virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) 638 { 639 return WMError::WM_OK; 640 } 641 /** 642 * @brief move the window to (x, y) 643 * 644 * @param x 645 * @param y 646 * @return WMError 647 */ MoveTo(int32_t x,int32_t y)648 virtual WMError MoveTo(int32_t x, int32_t y) { return WMError::WM_OK; } 649 /** 650 * @brief resize the window instance (w,h) 651 * 652 * @param width 653 * @param height 654 * @return WMError 655 */ Resize(uint32_t width,uint32_t height)656 virtual WMError Resize(uint32_t width, uint32_t height) { return WMError::WM_OK; } 657 /** 658 * @brief set the window gravity 659 * 660 * @param gravity 661 * @param percent 662 * @return WMError 663 */ SetWindowGravity(WindowGravity gravity,uint32_t percent)664 virtual WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) { return WMError::WM_OK; } 665 /** 666 * @brief Set the screen always on 667 * 668 * @param keepScreenOn 669 * @return WMError 670 */ SetKeepScreenOn(bool keepScreenOn)671 virtual WMError SetKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; } 672 /** 673 * @brief Get the screen is always on or not. 674 * 675 * @return True means screen is always on, false means the opposite. 676 */ IsKeepScreenOn()677 virtual bool IsKeepScreenOn() const { return false; } 678 /** 679 * @brief Set the screen on 680 * 681 * @param turnScreenOn True means turn screen on, false means the opposite. 682 * @return WM_OK means set success, others means set failed. 683 */ SetTurnScreenOn(bool turnScreenOn)684 virtual WMError SetTurnScreenOn(bool turnScreenOn) { return WMError::WM_OK; } 685 /** 686 * @brief Get the screen is on or not. 687 * 688 * @return True means screen is on, false means screen is off. 689 */ IsTurnScreenOn()690 virtual bool IsTurnScreenOn() const { return false; } 691 /** 692 * @brief Set Background color. 693 * 694 * @param color Background color. 695 * @return WM_OK means set success, others means set failed. 696 */ SetBackgroundColor(const std::string & color)697 virtual WMError SetBackgroundColor(const std::string& color) { return WMError::WM_OK; } 698 /** 699 * @brief Set transparent status. 700 * 701 * @param isTransparent True means set window transparent, false means the opposite. 702 * @return WM_OK means set success, others means set failed. 703 */ SetTransparent(bool isTransparent)704 virtual WMError SetTransparent(bool isTransparent) { return WMError::WM_OK; } 705 /** 706 * @brief Get transparent status. 707 * 708 * @return True means window is transparent, false means the opposite. 709 */ IsTransparent()710 virtual bool IsTransparent() const { return false; } 711 /** 712 * @brief Set brightness value of window. 713 * 714 * @param brightness Brightness of window. 715 * @return WM_OK means set success, others means set failed. 716 */ SetBrightness(float brightness)717 virtual WMError SetBrightness(float brightness) { return WMError::WM_OK; } 718 /** 719 * @brief Get brightness value of window. 720 * 721 * @return Brightness value of window. 722 */ GetBrightness()723 virtual float GetBrightness() const { return 0.0f; } 724 /** 725 * @brief Set calling window. 726 * 727 * @param windowId Window id. 728 * @return WM_OK means set success, others means set failed. 729 */ SetCallingWindow(uint32_t windowId)730 virtual WMError SetCallingWindow(uint32_t windowId) { return WMError::WM_OK; } 731 /** 732 * @brief Set privacy mode of window. 733 * 734 * @param isPrivacyMode True means set window private, false means not set window private. 735 * @return WM_OK means set success, others means set failed. 736 */ SetPrivacyMode(bool isPrivacyMode)737 virtual WMError SetPrivacyMode(bool isPrivacyMode) { return WMError::WM_OK; } 738 /** 739 * @brief Get privacy property of window. 740 * 741 * @return True means window is private and cannot be screenshot or recorded. 742 */ IsPrivacyMode()743 virtual bool IsPrivacyMode() const { return false; } 744 /** 745 * @brief Set privacy mode by system. 746 * 747 * @param isSystemPrivacyMode True means set window private, false means not set window private. 748 */ SetSystemPrivacyMode(bool isSystemPrivacyMode)749 virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) {} 750 /** 751 * @brief Bind Dialog window to target token. 752 * 753 * @param targetToken Window token of target. 754 * @return WM_OK means set success, others means set failed. 755 */ BindDialogTarget(sptr<IRemoteObject> targetToken)756 virtual WMError BindDialogTarget(sptr<IRemoteObject> targetToken) { return WMError::WM_OK; } 757 /** 758 * @brief Raise zorder of window to the top of APP Mainwindow. 759 * 760 * @return WM_OK means raise success, others means raise failed. 761 */ RaiseToAppTop()762 virtual WmErrorCode RaiseToAppTop() { return WmErrorCode::WM_OK; } 763 /** 764 * @brief Set skip flag of snapshot. 765 * 766 * @param isSkip True means skip the snapshot, false means the opposite. 767 * @return WM_OK means set success, others means set failed. 768 */ SetSnapshotSkip(bool isSkip)769 virtual WMError SetSnapshotSkip(bool isSkip) { return WMError::WM_OK; } 770 771 // window effect 772 /** 773 * @brief Set corner radius of window. 774 * 775 * @param cornerRadius Corner radius of window 776 * @return WM_OK means set success, others means set failed. 777 */ SetCornerRadius(float cornerRadius)778 virtual WMError SetCornerRadius(float cornerRadius) { return WMError::WM_OK; } 779 /** 780 * @brief Set shadow radius of window. 781 * 782 * @param radius Shadow radius of window 783 * @return WM_OK means set success, others means set failed. 784 */ SetShadowRadius(float radius)785 virtual WMError SetShadowRadius(float radius) { return WMError::WM_OK; } 786 /** 787 * @brief Set shadow color of window. 788 * 789 * @param color Shadow color of window. 790 * @return WM_OK means set success, others means set failed. 791 */ SetShadowColor(std::string color)792 virtual WMError SetShadowColor(std::string color) { return WMError::WM_OK; } 793 /** 794 * @brief Set shadow X offset. 795 * 796 * @param offsetX Shadow x-axis offset. 797 * @return WM_OK means set success, others means set failed. 798 */ SetShadowOffsetX(float offsetX)799 virtual WMError SetShadowOffsetX(float offsetX) { return WMError::WM_OK; } 800 /** 801 * @brief Set shadow Y offset. 802 * 803 * @param offsetY Shadow y-axis offset. 804 * @return WM_OK means set success, others means set failed. 805 */ SetShadowOffsetY(float offsetY)806 virtual WMError SetShadowOffsetY(float offsetY) { return WMError::WM_OK; } 807 /** 808 * @brief Set blur property. 809 * 810 * @param radius Blur value. 811 * @return WM_OK means set success, others means set failed. 812 */ SetBlur(float radius)813 virtual WMError SetBlur(float radius) { return WMError::WM_OK; } 814 /** 815 * @brief Set Backdrop blur property. 816 * 817 * @param radius Backdrop blur value. 818 * @return WM_OK means set success, others means set failed. 819 */ SetBackdropBlur(float radius)820 virtual WMError SetBackdropBlur(float radius) { return WMError::WM_OK; } 821 /** 822 * @brief Set Backdrop blur style. 823 * 824 * @param blurStyle Backdrop blur value. 825 * @return WM_OK means set success, others means set failed. 826 */ SetBackdropBlurStyle(WindowBlurStyle blurStyle)827 virtual WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) { return WMError::WM_OK; } 828 829 /** 830 * @brief Request to get focus. 831 * 832 * @return WM_OK means request success, others means request failed. 833 */ RequestFocus()834 virtual WMError RequestFocus() const { return WMError::WM_OK; } 835 /** 836 * @brief Check current focus status. 837 * 838 * @return True means window is focused, false means window is unfocused. 839 */ IsFocused()840 virtual bool IsFocused() const { return false; } 841 /** 842 * @brief Update surfaceNode after customAnimation. 843 * 844 * @param isAdd True means add custom animation, false means the opposite. 845 * @return WM_OK means update success, others means update failed. 846 */ UpdateSurfaceNodeAfterCustomAnimation(bool isAdd)847 virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) { return WMError::WM_OK; } 848 /** 849 * @brief Set InputEvent Consumer. 850 * 851 * @param inputEventConsumer Consume input event object. 852 * @return WM_OK means set success, others means set failed. 853 */ SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer> & inputEventConsumer)854 virtual void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) {} 855 /** 856 * @brief Consume KeyEvent from MMI. 857 * 858 * @param inputEvent Keyboard input event. 859 */ ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent> & inputEvent)860 virtual void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent>& inputEvent) {} 861 /** 862 * @brief Consume PointerEvent from MMI. 863 * 864 * @param inputEvent Pointer input event 865 */ ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent> & inputEvent)866 virtual void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 867 /** 868 * @brief Request Vsync. 869 * 870 * @param vsyncCallback Callback of vsync. 871 */ RequestVsync(const std::shared_ptr<VsyncCallback> & vsyncCallback)872 virtual void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) {} 873 /** 874 * @brief get vsync period. 875 * 876 * @return vsync period. 877 */ GetVSyncPeriod()878 virtual int64_t GetVSyncPeriod() { return 0; } 879 /** 880 * @brief Update Configuration. 881 * 882 * @param configuration Window configuration. 883 */ UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration> & configuration)884 virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {} 885 /** 886 * @brief Register window lifecycle listener. 887 * 888 * @param listener WindowLifeCycle listener. 889 * @return WM_OK means register success, others means register failed. 890 */ RegisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)891 virtual WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 892 /** 893 * @brief Unregister window lifecycle listener. 894 * 895 * @param listener WindowLifeCycle listener. 896 * @return WM_OK means unregister success, others means unregister failed. 897 */ UnregisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)898 virtual WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 899 /** 900 * @brief Register window change listener. 901 * 902 * @param listener IWindowChangeListener. 903 * @return WM_OK means register success, others means register failed. 904 */ RegisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)905 virtual WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 906 { 907 return WMError::WM_OK; 908 } 909 /** 910 * @brief Unregister window change listener. 911 * 912 * @param listener IWindowChangeListener. 913 * @return WM_OK means unregister success, others means unregister failed. 914 */ UnregisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)915 virtual WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 916 { 917 return WMError::WM_OK; 918 } 919 /** 920 * @brief Register avoid area change listener. 921 * 922 * @param listener IAvoidAreaChangedListener. 923 * @return WM_OK means register success, others means register failed. 924 */ RegisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener> & listener)925 virtual WMError RegisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) 926 { 927 return WMError::WM_OK; 928 } 929 /** 930 * @brief Unregister avoid area change listener. 931 * 932 * @param listener IAvoidAreaChangedListener. 933 * @return WM_OK means unregister success, others means unregister failed. 934 */ UnregisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener> & listener)935 virtual WMError UnregisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) 936 { 937 return WMError::WM_OK; 938 } 939 /** 940 * @brief Register window drag listener. 941 * 942 * @param listener IWindowDragListener. 943 * @return WM_OK means register success, others means register failed. 944 */ RegisterDragListener(const sptr<IWindowDragListener> & listener)945 virtual WMError RegisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 946 /** 947 * @brief Unregister window drag listener. 948 * 949 * @param listener IWindowDragListener. 950 * @return WM_OK means unregister success, others means unregister failed. 951 */ UnregisterDragListener(const sptr<IWindowDragListener> & listener)952 virtual WMError UnregisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 953 /** 954 * @brief Register display move listener. 955 * 956 * @param listener IDisplayMoveListener. 957 * @return WM_OK means register success, others means register failed. 958 */ RegisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)959 virtual WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 960 /** 961 * @brief Unregister display move listener. 962 * 963 * @param listener IDisplayMoveListener. 964 * @return WM_OK means unregister success, others means unregister failed. 965 */ UnregisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)966 virtual WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 967 /** 968 * @brief Register window destroyed listener. 969 * 970 * @param func Function to notify window destroyed. 971 */ RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc & func)972 virtual void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) {} 973 /** 974 * @brief Register Occupied Area Change listener. 975 * 976 * @param listener IOccupiedAreaChangeListener. 977 * @return WM_OK means register success, others means register failed. 978 */ RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)979 virtual WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 980 { 981 return WMError::WM_OK; 982 } 983 /** 984 * @brief Unregister occupied area change listener. 985 * 986 * @param listener IOccupiedAreaChangeListener. 987 * @return WM_OK means unregister success, others means unregister failed. 988 */ UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)989 virtual WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 990 { 991 return WMError::WM_OK; 992 } 993 /** 994 * @brief Register touch outside listener. 995 * 996 * @param listener ITouchOutsideListener. 997 * @return WM_OK means register success, others means register failed. 998 */ RegisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)999 virtual WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) { return WMError::WM_OK; } 1000 /** 1001 * @brief Unregister touch outside listener. 1002 * 1003 * @param listener ITouchOutsideListener. 1004 * @return WM_OK means unregister success, others means unregister failed. 1005 */ UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)1006 virtual WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) 1007 { 1008 return WMError::WM_OK; 1009 } 1010 /** 1011 * @brief Register Animation Transition Controller listener. 1012 * 1013 * @param listener IAnimationTransitionController. 1014 * @return WM_OK means register success, others means register failed. 1015 */ RegisterAnimationTransitionController(const sptr<IAnimationTransitionController> & listener)1016 virtual WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener) 1017 { 1018 return WMError::WM_OK; 1019 } 1020 /** 1021 * @brief Register screen shot listener. 1022 * 1023 * @param listener IScreenshotListener. 1024 * @return WM_OK means register success, others means register failed. 1025 */ RegisterScreenshotListener(const sptr<IScreenshotListener> & listener)1026 virtual WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 1027 /** 1028 * @brief Unregister screen shot listener. 1029 * 1030 * @param listener IScreenshotListener. 1031 * @return WM_OK means unregister success, others means unregister failed. 1032 */ UnregisterScreenshotListener(const sptr<IScreenshotListener> & listener)1033 virtual WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 1034 /** 1035 * @brief Register dialog target touch listener. 1036 * 1037 * @param listener IDialogTargetTouchListener. 1038 * @return WM_OK means register success, others means register failed. 1039 */ RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)1040 virtual WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 1041 { 1042 return WMError::WM_OK; 1043 } 1044 /** 1045 * @brief Unregister dialog target touch listener. 1046 * 1047 * @param listener IDialogTargetTouchListener. 1048 * @return WM_OK means unregister success, others means unregister failed. 1049 */ UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)1050 virtual WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 1051 { 1052 return WMError::WM_OK; 1053 } 1054 /** 1055 * @brief Register dialog death Recipient listener. 1056 * 1057 * @param listener IDialogDeathRecipientListener. 1058 */ RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)1059 virtual void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 1060 /** 1061 * @brief Unregister window death recipient listener. 1062 * 1063 * @param listener IDialogDeathRecipientListener. 1064 */ UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)1065 virtual void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 1066 /** 1067 * @brief Notify touch dialog target. 1068 */ NotifyTouchDialogTarget()1069 virtual void NotifyTouchDialogTarget() {} 1070 /** 1071 * @brief Set ace ability handler. 1072 * 1073 * @param handler Ace ability handler. 1074 */ SetAceAbilityHandler(const sptr<IAceAbilityHandler> & handler)1075 virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) {} 1076 /** 1077 * @brief set window ui content 1078 * 1079 * @param contentInfo content info path 1080 * @param engine 1081 * @param storage 1082 * @param isDistributed 1083 * @param ability 1084 * @return WMError 1085 */ 1086 virtual WMError SetUIContent(const std::string& contentInfo, NativeEngine* engine, 1087 NativeValue* storage, bool isDistributed = false, AppExecFwk::Ability* ability = nullptr) 1088 { 1089 return WMError::WM_OK; 1090 } 1091 /** 1092 * @brief Get ui content info. 1093 * 1094 * @return UI content info. 1095 */ GetContentInfo()1096 virtual std::string GetContentInfo() { return std::string(); } 1097 /** 1098 * @brief Get ui content object. 1099 * 1100 * @return UIContent object of ACE. 1101 */ GetUIContent()1102 virtual Ace::UIContent* GetUIContent() const { return nullptr; } 1103 /** 1104 * @brief Window handle new want. 1105 * 1106 * @param want Want object of AAFwk. 1107 */ OnNewWant(const AAFwk::Want & want)1108 virtual void OnNewWant(const AAFwk::Want& want) {} 1109 /** 1110 * @brief Set requested orientation. 1111 * 1112 * @param Orientation Screen orientation. 1113 */ SetRequestedOrientation(Orientation)1114 virtual void SetRequestedOrientation(Orientation) {} 1115 /** 1116 * @brief Get requested orientation. 1117 * 1118 * @return Orientation screen orientation. 1119 */ GetRequestedOrientation()1120 virtual Orientation GetRequestedOrientation() { return Orientation::UNSPECIFIED; } 1121 /** 1122 * @brief Set requested mode support info. 1123 * 1124 * @param modeSupportInfo Mode of window supported. 1125 */ SetRequestModeSupportInfo(uint32_t modeSupportInfo)1126 virtual void SetRequestModeSupportInfo(uint32_t modeSupportInfo) {} 1127 /** 1128 * @brief Get requested mode support info. 1129 * 1130 * @return Enumeration values under WindowModeSupport. 1131 */ GetRequestModeSupportInfo()1132 virtual uint32_t GetRequestModeSupportInfo() const { return 0; } 1133 /** 1134 * @brief Set touch hot areas. 1135 * 1136 * @param rects Hot areas of touching. 1137 * @return WM_OK means set success, others means set failed. 1138 */ SetTouchHotAreas(const std::vector<Rect> & rects)1139 virtual WMError SetTouchHotAreas(const std::vector<Rect>& rects) { return WMError::WM_OK; } 1140 /** 1141 * @brief Get requested touch hot areas. 1142 * 1143 * @param rects Hot areas of touching. 1144 */ GetRequestedTouchHotAreas(std::vector<Rect> & rects)1145 virtual void GetRequestedTouchHotAreas(std::vector<Rect>& rects) const {} 1146 /** 1147 * @brief Main handler available or not. 1148 * 1149 * @return True means main handler is available, false means the opposite. 1150 */ IsMainHandlerAvailable()1151 virtual bool IsMainHandlerAvailable() const { return false; } 1152 /** 1153 * @brief Set window label name. 1154 * 1155 * @param label Window label name. 1156 * @return WM_OK means set success, others means set failed. 1157 */ SetAPPWindowLabel(const std::string & label)1158 virtual WMError SetAPPWindowLabel(const std::string& label) { return WMError::WM_OK; } 1159 /** 1160 * @brief Set window icon. 1161 * 1162 * @param icon Window icon. 1163 * @return WM_OK means set success, others means set failed. 1164 */ SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap> & icon)1165 virtual WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) { return WMError::WM_OK; } 1166 1167 /** 1168 * @brief disable main window decoration. It must be callled before loadContent. 1169 * 1170 */ DisableAppWindowDecor()1171 virtual WMError DisableAppWindowDecor() { return WMError::WM_OK; } 1172 /** 1173 * @brief return window decoration is enabled. It is called by ACE 1174 * 1175 * @return true means window decoration is enabled. Otherwise disabled 1176 */ IsDecorEnable()1177 virtual bool IsDecorEnable() const { return false; } 1178 /** 1179 * @brief maximize the main window. It is called by ACE when maximize button is clicked. 1180 * 1181 * @return WMError 1182 */ Maximize()1183 virtual WMError Maximize() { return WMError::WM_OK; } 1184 /** 1185 * @brief maximize the main window according to MaximizeMode. called by ACE when maximize button is clicked. 1186 * 1187 * @return WMError 1188 */ MaximizeFloating()1189 virtual WMError MaximizeFloating() {return WMError::WM_OK;} 1190 /** 1191 * @brief minimize the main window. It is called by ACE when minimize button is clicked. 1192 * 1193 * @return WMError 1194 */ Minimize()1195 virtual WMError Minimize() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1196 /** 1197 * @brief recovery the main window. It is called by ACE when recovery button is clicked. 1198 * 1199 * @return WMError 1200 */ Recover()1201 virtual WMError Recover() { return WMError::WM_OK; } 1202 /** 1203 * @brief close the main window. It is called by ACE when close button is clicked. 1204 * 1205 * @return WMError 1206 */ Close()1207 virtual WMError Close() { return WMError::WM_OK; } 1208 /** 1209 * @brief start move main window. It is called by ACE when title is moved. 1210 * 1211 */ StartMove()1212 virtual void StartMove() {} 1213 /** 1214 * @brief Set flag that need remove window input channel. 1215 * 1216 * @param needRemoveWindowInputChannel True means remove input channel, false means not remove. 1217 */ SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel)1218 virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) {} 1219 /** 1220 * @brief set global window maximize mode. It is called by ACE when maximize mode changed. 1221 * 1222 * @param mode MODE_AVOID_SYSTEM_BAR - avoid statusbar and dockbar; MODE_FULL_FILL - fullfill the screen 1223 * 1224 * @return WMError 1225 */ SetGlobalMaximizeMode(MaximizeMode mode)1226 virtual WMError SetGlobalMaximizeMode(MaximizeMode mode) {return WMError::WM_OK;} 1227 /** 1228 * @brief get global window maximize mode. 1229 * 1230 * @return MaximizeMode 1231 */ GetGlobalMaximizeMode()1232 virtual MaximizeMode GetGlobalMaximizeMode() const {return MaximizeMode::MODE_FULL_FILL;} 1233 1234 // colorspace, gamut 1235 /** 1236 * @brief Is support wide gamut or not. 1237 * 1238 * @return True means support wide gamut, false means not support. 1239 */ IsSupportWideGamut()1240 virtual bool IsSupportWideGamut() { return false; } 1241 /** 1242 * @brief Set color space. 1243 * 1244 * @param colorSpace ColorSpace object. 1245 */ SetColorSpace(ColorSpace colorSpace)1246 virtual void SetColorSpace(ColorSpace colorSpace) {} 1247 /** 1248 * @brief Get color space object. 1249 * 1250 * @return ColorSpace object. 1251 */ GetColorSpace()1252 virtual ColorSpace GetColorSpace() { return ColorSpace::COLOR_SPACE_DEFAULT; } 1253 DumpInfo(const std::vector<std::string> & params,std::vector<std::string> & info)1254 virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) {} 1255 /** 1256 * @brief window snapshot 1257 * 1258 * @return std::shared_ptr<Media::PixelMap> snapshot pixel 1259 */ Snapshot()1260 virtual std::shared_ptr<Media::PixelMap> Snapshot() { return nullptr; } 1261 1262 /** 1263 * @brief Handle and notify memory level. 1264 * 1265 * @param level memory level 1266 * @return the error code of window 1267 */ NotifyMemoryLevel(int32_t level)1268 virtual WMError NotifyMemoryLevel(int32_t level) { return WMError::WM_OK; } 1269 1270 /** 1271 * @brief Update configuration for all windows 1272 * 1273 * @param configuration configuration for app 1274 */ IsAllowHaveSystemSubWindow()1275 virtual bool IsAllowHaveSystemSubWindow() { return false; } 1276 1277 /** 1278 * @brief Set aspect ratio of this window 1279 * 1280 * @param ratio the aspect ratio of window except decoration 1281 * @return WMError 1282 */ SetAspectRatio(float ratio)1283 virtual WMError SetAspectRatio(float ratio) { return WMError::WM_OK; } 1284 /** 1285 * @brief Unset aspect ratio 1286 * @return WMError 1287 */ ResetAspectRatio()1288 virtual WMError ResetAspectRatio() { return WMError::WM_OK; } 1289 /** 1290 * @brief Get keyboard animation config 1291 * @return KeyboardAnimationConfig 1292 */ GetKeyboardAnimationConfig()1293 virtual KeyboardAnimationConfig GetKeyboardAnimationConfig() { return {}; } 1294 /** 1295 * @brief Set need default animation for window show and hide. 1296 * 1297 * @param needDefaultAnimation True means need default animation, false means not need. 1298 */ SetNeedDefaultAnimation(bool needDefaultAnimation)1299 virtual void SetNeedDefaultAnimation(bool needDefaultAnimation) {} 1300 /** 1301 * @brief Transfer Ability Result. 1302 * @return WMError 1303 */ TransferAbilityResult(uint32_t resultCode,const AAFwk::Want & want)1304 virtual WMError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) { return WMError::WM_OK; } 1305 /** 1306 * @brief Transfer UIExtension data to Extension Component. 1307 * @return WMError 1308 */ TransferExtensionData(const AAFwk::WantParams & wantParams)1309 virtual WMError TransferExtensionData(const AAFwk::WantParams& wantParams) { return WMError::WM_OK; } 1310 /** 1311 * @brief Register transfer component data callback. 1312 * 1313 * @param func Function to notify transfer component data. 1314 */ RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc & func)1315 virtual void RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) {} 1316 /** 1317 * @brief Perform back event. 1318 * 1319 */ PerformBack()1320 virtual void PerformBack() {} 1321 /** 1322 * @brief Set the drag enabled flag of a window. 1323 * 1324 * @param dragEnabled true means the window can be resized by dragging, otherwise means the opposite. 1325 * @return Errorcode of window. 1326 */ SetResizeByDragEnabled(bool dragEnabled)1327 virtual WMError SetResizeByDragEnabled(bool dragEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1328 /** 1329 * @brief Set the raise enabled flag of a window. 1330 * 1331 * @param raiseEnabled true means the window can be raised by click, otherwise means the opposite. 1332 * @return Errorcode of window. 1333 */ SetRaiseByClickEnabled(bool raiseEnabled)1334 virtual WMError SetRaiseByClickEnabled(bool raiseEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1335 /** 1336 * @brief Raise one app sub window above another. 1337 * 1338 * @return WM_OK means raise success, others means raise failed. 1339 */ RaiseAboveTarget(int32_t subWindowId)1340 virtual WmErrorCode RaiseAboveTarget(int32_t subWindowId) { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 1341 }; 1342 } 1343 } 1344 #endif // OHOS_ROSEN_WINDOW_H 1345