diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index d3fffd2bfdf4f893ed5642514928fd3f6958885b..7046b75f8f0061eb16e38bfc902cbed906f83032 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -3341,11 +3341,27 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ export function getLastWindow(ctx: BaseContext, callback: AsyncCallback): void; + /** + * Obtains the top window of the current application. This API uses an asynchronous callback to return the result. + * If no child window is available, the main window of the application is returned. + * + * @param { BaseContext } ctx - Current application context. + * @param { AsyncCallback } callback - Callback used to return the top window obtained. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 1300002 - This window state is abnormal. Top window or main window is null or destroyed. + * @throws { BusinessError } 1300006 - This window context is abnormal. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + export function getLastWindowWithCallback(ctx: BaseContext, callback: AsyncCallback): void; + /** * Get the final show window. * @@ -3384,11 +3400,33 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ export function getLastWindow(ctx: BaseContext): Promise; + /** + * Obtains the top window of the current application. This API uses a promise to return the result. + * If no child window is available, the main window of the application is returned. + * + * @param { BaseContext } ctx - Current application context. + * @returns { Promise } Promise used to return the top window obtained. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 1300002 - This window state is abnormal. Top window or main window is null or destroyed. + * @throws { BusinessError } 1300006 - This window context is abnormal. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + export function getLastWindowReturnPromise(ctx: BaseContext): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + export overload getLastWindow { getLastWindowWithCallback, getLastWindowReturnPromise }; + /** * Minimize all app windows. * @@ -8348,11 +8386,26 @@ declare namespace window { * @throws { BusinessError } 1300003 - This window manager service works abnormally. * @syscap SystemCapability.WindowManager.WindowManager.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ setWindowFocusable(isFocusable: boolean): Promise; + /** + * Sets whether focusable or not. + * + * @param { boolean } isFocusable can be focus if true, or can not be focus if false. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + setWindowFocusableReturnPromise(isFocusable: boolean): Promise; + /** * Sets whether focusable or not. * @@ -8376,11 +8429,32 @@ declare namespace window { * @throws { BusinessError } 1300003 - This window manager service works abnormally. * @syscap SystemCapability.WindowManager.WindowManager.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ setWindowFocusable(isFocusable: boolean, callback: AsyncCallback): void; + /** + * Sets whether focusable or not. + * + * @param { boolean } isFocusable can be focus if true, or can not be focus if false. + * @param { AsyncCallback } callback Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + setWindowFocusableWithCallback(isFocusable: boolean, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload setWindowFocusable { setWindowFocusableWithCallback, setWindowFocusableReturnPromise }; + /** * Window requests to get focus or lose focus. *