diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets index 2b198a334f664f1988e142d2eaa7a58e026e58b8..54717e5e1ece0fec100c47da4610428f4e9f7226 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets @@ -1872,7 +1872,7 @@ export class WindowStageInternal implements WindowStage { return ret; } - public getMainWindow(): Promise { + public getMainWindowReturnPromise(): Promise { return new Promise((resolve: (value: Window) => void, reject: (error: BusinessError) => void) => { taskpool.execute((): Window => { let window = this.getMainWindowSync(this.nativeObj); @@ -1885,7 +1885,7 @@ export class WindowStageInternal implements WindowStage { }); } - public getMainWindow(callback: AsyncCallback): void { + public getMainWindowWithCallback(callback: AsyncCallback): void { taskpool.execute((): Window => { let res = this.getMainWindowSync(this.nativeObj); return res; @@ -1895,6 +1895,8 @@ export class WindowStageInternal implements WindowStage { }); } + overload getMainWindow { getMainWindowReturnPromise, getMainWindowWithCallback }; + public createSubWindow(name: string): Promise { return new Promise((resolve: (value: Window) => void, reject: (error: BusinessError) => void) => { taskpool.execute((): Window => { @@ -1936,8 +1938,9 @@ export interface WindowStage { loadContent(path: string, storage?: LocalStorage): Promise; loadContent(path: string, callback: AsyncCallback): void; getMainWindowSync(): Window; - getMainWindow(): Promise; - getMainWindow(callback: AsyncCallback): void; + getMainWindowReturnPromise(): Promise; + getMainWindowWithCallback(callback: AsyncCallback): void; + overload getMainWindow { getMainWindowReturnPromise, getMainWindowWithCallback }; createSubWindow(name: string): Promise; createSubWindow(name: string, callback: AsyncCallback): void; disableWindowDecor(): void; @@ -1981,7 +1984,7 @@ export class WindowInternal implements Window { private native setWindowTitleButtonVisible(nativeObj: long, visibleParam: WindowTitleButtonVisibleParam): void; private native setDecorButtonStyle(nativeObj: long, decorStyle: DecorButtonStyle): void; private native getWindowStatus(nativeObj: long): int; - private native minimize(nativeObj: long): void; + private native minimizeNative(nativeObj: long): void; private native maximize(nativeObj: long, presentation: int): void; private native resize(nativeObj: long, width: int, height: int): void; private native moveWindowTo(nativeObj: long, x: int, y: int): void; @@ -2203,10 +2206,10 @@ export class WindowInternal implements Window { return this.getWindowStatus(this.nativeObj) as WindowStatusType; } - public minimize(): Promise { + public minimizeReturnPromise(): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { - this.minimize(this.nativeObj); + this.minimizeNative(this.nativeObj); }).then((ret: NullishType) :void => { resolve(undefined); }).catch((err: NullishType) :void => { @@ -2215,9 +2218,9 @@ export class WindowInternal implements Window { }); } - public minimize(callback: AsyncCallback): void { + public minimizeWithCallback(callback: AsyncCallback): void { taskpool.execute((): void => { - this.minimize(this.nativeObj); + this.minimizeNative(this.nativeObj); }).then((ret: NullishType) => { callback(new BusinessError(), undefined); }).catch((err: NullishType) => { @@ -2225,6 +2228,8 @@ export class WindowInternal implements Window { }); } + overload minimize { minimizeWithCallback, minimizeReturnPromise }; + public maximize(presentation?: MaximizePresentation): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { @@ -2578,7 +2583,7 @@ export class WindowInternal implements Window { }); } - public setUIContent(path: string): Promise { + public setUIContentReturnPromise(path: string): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { try { this.setUIContentSync(this.nativeObj, path); @@ -2589,7 +2594,7 @@ export class WindowInternal implements Window { }); } - public setUIContent(path: string, callback: AsyncCallback): void { + public setUIContentWithCallback(path: string, callback: AsyncCallback): void { try { this.setUIContentSync(this.nativeObj, path); callback(new BusinessError(), undefined); @@ -2598,6 +2603,8 @@ export class WindowInternal implements Window { } } + overload setUIContent { setUIContentWithCallback, setUIContentReturnPromise }; + public loadContent(path: string, storage: LocalStorage): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { try { @@ -2792,7 +2799,7 @@ export class WindowInternal implements Window { this.offSync(this.nativeObj, type, callback); } - public showWindow(callback: AsyncCallback): void { + public showWindowWithCallback(callback: AsyncCallback): void { taskpool.execute((): void => { this.showWindowSync(this.nativeObj); }).then((ret: NullishType) => { @@ -2802,7 +2809,7 @@ export class WindowInternal implements Window { }); } - public showWindow(): Promise { + public showWindowReturnPromise(): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.showWindowSync(this.nativeObj); @@ -2814,7 +2821,9 @@ export class WindowInternal implements Window { }); } - public destroyWindow(callback: AsyncCallback): void { + overload showWindow { showWindowWithCallback, showWindowReturnPromise }; + + public destroyWindowWithCallback(callback: AsyncCallback): void { taskpool.execute((): void => { this.destroyWindowSync(this.nativeObj); }).then((ret: NullishType) => { @@ -2824,7 +2833,7 @@ export class WindowInternal implements Window { }); } - public destroyWindow(): Promise { + public destroyWindowReturnPromise(): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.destroyWindowSync(this.nativeObj); @@ -2836,6 +2845,8 @@ export class WindowInternal implements Window { }); } + overload destroyWindow { destroyWindowWithCallback, destroyWindowReturnPromise }; + public isWindowShowing(): boolean { return this.isWindowShowingSync(this.nativeObj); } @@ -2907,8 +2918,9 @@ export interface Window { isCloseButtonVisible?: boolean): void; setDecorButtonStyle(dectorStyle: DecorButtonStyle): void; getWindowStatus(): WindowStatusType; - minimize(callback: AsyncCallback): void; - minimize(): Promise; + minimizeWithCallback(callback: AsyncCallback): void; + minimizeReturnPromise(): Promise; + overload minimize { minimizeWithCallback, minimizeReturnPromise }; maximize(presentation?: MaximizePresentation): Promise; resize(width: int, height: int): Promise; moveWindowTo(x: int, y: int): Promise; @@ -2943,8 +2955,9 @@ export interface Window { setWindowPrivacyMode(isPrivacyMode: boolean): Promise; setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void; recover(): Promise; - setUIContent(path: string): Promise; - setUIContent(path: string, callback: AsyncCallback): void; + setUIContentReturnPromise(path: string): Promise; + setUIContentWithCallback(path: string, callback: AsyncCallback): void; + overload setUIContent { setUIContentWithCallback, setUIContentReturnPromise }; loadContent(path: string, storage: LocalStorage): Promise; loadContent(path: string, storage: LocalStorage, callback: AsyncCallback): void; loadContent(path: string): Promise; @@ -2957,10 +2970,12 @@ export interface Window { getWindowAvoidArea(type: AvoidAreaType): AvoidArea; setWaterMarkFlag(enable: boolean): Promise; setWaterMarkFlag(enable: boolean, callback: AsyncCallback): void; - showWindow(callback: AsyncCallback): void; - showWindow(): Promise; - destroyWindow(callback: AsyncCallback): void; - destroyWindow(): Promise; + showWindowWithCallback(callback: AsyncCallback): void; + showWindowReturnPromise(): Promise; + overload showWindow { showWindowWithCallback, showWindowReturnPromise }; + destroyWindowWithCallback(callback: AsyncCallback): void; + destroyWindowReturnPromise(): Promise; + overload destroyWindow { destroyWindowWithCallback, destroyWindowReturnPromise } isWindowShowing(): boolean; hideWithAnimation(callback: AsyncCallback): void; hideWithAnimation(): Promise; @@ -3046,7 +3061,7 @@ export function createWindow(config: Configuration, callback: AsyncCallback { +export function minimizeAllReturnPromise(id: long): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { minimizeAllSync(nativeObj, id); @@ -3058,7 +3073,7 @@ export function minimizeAll(id: long): Promise { }); } -export function minimizeAll(id: long, callback: AsyncCallback): void { +export function minimizeAllWithCallback(id: long, callback: AsyncCallback): void { taskpool.execute((): void => { minimizeAllSync(nativeObj, id); }).then((ret: NullishType) => { @@ -3068,6 +3083,8 @@ export function minimizeAll(id: long, callback: AsyncCallback): void { }); } +export overload minimizeAll { minimizeAllWithCallback, minimizeAllReturnPromise }; + export function getWindowsByCoordinate(displayId: number, windowNumber?: number, x?: number, y?: number): Promise> { return new Promise>((resolve: (value: Array) => void, diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp index f25c9bad0d22a7552577c3dccfa7a13d8387037f..59ebbebbc221760a64cb058e2618da581618d2d7 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp @@ -2663,7 +2663,7 @@ ani_status OHOS::Rosen::ANI_Window_Constructor(ani_vm *vm, uint32_t *result) reinterpret_cast(SetDecorButtonStyle)}, ani_native_function {"getWindowStatus", "J:I", reinterpret_cast(GetWindowStatus)}, - ani_native_function {"minimize", "J:V", + ani_native_function {"minimizeNative", "J:V", reinterpret_cast(Minimize)}, ani_native_function {"maximize", "JI:V", reinterpret_cast(Maximize)},