diff --git a/interfaces/innerkits/wm/window.h b/interfaces/innerkits/wm/window.h index e3f9e942..a22335fd 100644 --- a/interfaces/innerkits/wm/window.h +++ b/interfaces/innerkits/wm/window.h @@ -160,13 +160,41 @@ public: * @return sptr Return the window instance founded */ static sptr Find(const std::string& windowName); + /** + * @brief Get the final show window by context. Its implemented in api8 + * + * @param context Indicates the context on which the window depends + * @return sptr + */ static sptr GetTopWindowWithContext(const std::shared_ptr& context = nullptr); + /** + * @brief Get the final show window by id. Its implemented in api8 + * + * @param mainWinId main window id? + * @return sptr + */ static sptr GetTopWindowWithId(uint32_t mainWinId); + /** + * @brief Get the all sub windows by parent + * + * @param parentId parent window id + * @return std::vector> + */ static std::vector> GetSubWindow(uint32_t parentId); virtual std::shared_ptr GetSurfaceNode() const = 0; virtual const std::shared_ptr GetContext() const = 0; + /** + * @brief Get the window show rect + * + * @return Rect window rect + */ virtual Rect GetRect() const = 0; virtual Rect GetRequestRect() const = 0; + /** + * @brief Get the window type + * + * @return WindowType window type + */ virtual WindowType GetType() const = 0; virtual WindowMode GetMode() const = 0; virtual WindowBlurLevel GetWindowBackgroundBlur() const = 0; @@ -180,9 +208,33 @@ public: virtual WMError SetTouchable(bool isTouchable) = 0; virtual bool GetTouchable() const = 0; virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const = 0; + /** + * @brief judge this window is full screen. + * + * @return true If SetFullScreen(true) is called , return true. + * @return false default return false + */ virtual bool IsFullScreen() const = 0; + /** + * @brief judge window layout is full screen + * + * @return true this window layout is full screen + * @return false this window layout is not full screen + */ virtual bool IsLayoutFullScreen() const = 0; + /** + * @brief Set the Window Type + * + * @param type window type + * @return WMError + */ virtual WMError SetWindowType(WindowType type) = 0; + /** + * @brief Set the Window Mode + * + * @param mode window mode + * @return WMError + */ virtual WMError SetWindowMode(WindowMode mode) = 0; virtual WMError SetWindowBackgroundBlur(WindowBlurLevel level) = 0; virtual void SetAlpha(float alpha) = 0; @@ -191,16 +243,66 @@ public: virtual WMError AddWindowFlag(WindowFlag flag) = 0; virtual WMError RemoveWindowFlag(WindowFlag flag) = 0; virtual WMError SetWindowFlags(uint32_t flags) = 0; + /** + * @brief Set the System Bar(include status bar and nav bar) Property + * + * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR + * @param property system bar prop,include content color, background color + * @return WMError + */ virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) = 0; + /** + * @brief Get the Avoid Area By Type object + * + * @param type avoid area type.@see reference + * @param avoidArea + * @return WMError + */ virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) = 0; + /** + * @brief Set this window layout full screen, with hide status bar and nav bar above on this window + * + * @param status + * @return WMError + */ virtual WMError SetLayoutFullScreen(bool status) = 0; + /** + * @brief Set this window full screen, with hide status bar and nav bar + * + * @param status if true, hide status bar and nav bar; Otherwise, show status bar and nav bar + * @return WMError + */ virtual WMError SetFullScreen(bool status) = 0; + /** + * @brief destroy window + * + * @return WMError + */ virtual WMError Destroy() = 0; virtual WMError Show(uint32_t reason = 0, bool withAnimation = false) = 0; virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false) = 0; - + /** + * @brief move the window to (x, y) + * + * @param x + * @param y + * @return WMError + */ virtual WMError MoveTo(int32_t x, int32_t y) = 0; + /** + * @brief resize the window instance (w,h) + * + * @param width + * @param height + * @return WMError + */ virtual WMError Resize(uint32_t width, uint32_t height) = 0; + /** + * @brief Set the screen always on + * + * @param keepScreenOn + * @return WMError + */ virtual WMError SetKeepScreenOn(bool keepScreenOn) = 0; virtual bool IsKeepScreenOn() const = 0; virtual WMError SetTurnScreenOn(bool turnScreenOn) = 0; @@ -213,7 +315,6 @@ public: virtual WMError SetCallingWindow(uint32_t windowId) = 0; virtual void SetPrivacyMode(bool isPrivacyMode) = 0; virtual bool IsPrivacyMode() const = 0; - virtual void DisableAppWindowDecor() = 0; virtual WMError RequestFocus() const = 0; virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) = 0; @@ -222,7 +323,11 @@ public: virtual void ConsumePointerEvent(std::shared_ptr& inputEvent) = 0; virtual void RequestFrame() = 0; virtual void UpdateConfiguration(const std::shared_ptr& configuration) = 0; - + /** + * @brief register window lifecycle listener. + * + * @param listener + */ virtual void RegisterLifeCycleListener(const sptr& listener) = 0; virtual void RegisterWindowChangeListener(sptr& listener) = 0; virtual void UnregisterLifeCycleListener(const sptr& listener) = 0; @@ -242,6 +347,16 @@ public: virtual void RegisterScreenshotListener(const sptr& listener) = 0; virtual void UnregisterScreenshotListener(const sptr& listener) = 0; virtual void SetAceAbilityHandler(const sptr& handler) = 0; + /** + * @brief set window ui content + * + * @param contentInfo content info path + * @param engine + * @param storage + * @param isDistributed + * @param ability + * @return WMError + */ virtual WMError SetUIContent(const std::string& contentInfo, NativeEngine* engine, NativeValue* storage, bool isDistributed = false, AppExecFwk::Ability* ability = nullptr) = 0; virtual std::string GetContentInfo() = 0; @@ -254,11 +369,45 @@ public: virtual WMError SetTouchHotAreas(const std::vector& rects) = 0; virtual void GetRequestedTouchHotAreas(std::vector& rects) const = 0; + /** + * @brief disable main window decoration. It must be callled before loadContent. + * + */ + virtual void DisableAppWindowDecor() = 0; + /** + * @brief return window decoration is enabled. It is called by ACE + * + * @return true means window decoration is enabled. Otherwise disabled + */ virtual bool IsDecorEnable() const = 0; + /** + * @brief maximize the main window. It is called by ACE when maximize button is clicked. + * + * @return WMError + */ virtual WMError Maximize() = 0; + /** + * @brief minimize the main window. It is called by ACE when minimize button is clicked. + * + * @return WMError + */ virtual WMError Minimize() = 0; + /** + * @brief recovery the main window. It is called by ACE when recovery button is clicked. + * + * @return WMError + */ virtual WMError Recover() = 0; + /** + * @brief close the main window. It is called by ACE when close button is clicked. + * + * @return WMError + */ virtual WMError Close() = 0; + /** + * @brief start move main window. It is called by ACE when title is moved. + * + */ virtual void StartMove() = 0; virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) = 0; @@ -268,6 +417,11 @@ public: virtual ColorSpace GetColorSpace() = 0; virtual void DumpInfo(const std::vector& params, std::vector& info) = 0; + /** + * @brief window snapshot + * + * @return std::shared_ptr snapshot pixel + */ virtual std::shared_ptr Snapshot() = 0; }; }