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..c65bb80a932a821b16eae7ba7d1f1ead8a319059 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 @@ -1983,8 +1983,8 @@ export class WindowInternal implements Window { private native getWindowStatus(nativeObj: long): int; private native minimize(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; + private native resizeNative(nativeObj: long, width: int, height: int): void; + private native moveWindowToNative(nativeObj: long, x: int, y: int): void; private native getGlobalRect(nativeObj:long): Rect; private native getWindowDecorHeight(nativeObj:long): int; @@ -2242,10 +2242,10 @@ export class WindowInternal implements Window { }); } - public resize(width: int, height: int): Promise { + public resizeReturnPromise(width: int, height: int): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { - this.resize(this.nativeObj, width, height); + this.resizeNative(this.nativeObj, width, height); }).then((ret: NullishType) :void => { resolve(undefined); }).catch((err: NullishType) :void => { @@ -2254,10 +2254,10 @@ export class WindowInternal implements Window { }); } - public moveWindowTo(x: int, y: int): Promise { + public moveWindowToReturnPromise(x: int, y: int): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { - this.moveWindowTo(this.nativeObj, x, y); + this.moveWindowToNative(this.nativeObj, x, y); }).then((ret: NullishType) :void => { resolve(undefined); }).catch((err: NullishType) :void => { @@ -2266,9 +2266,9 @@ export class WindowInternal implements Window { }); } - public resize(width: int, height: int, callback: AsyncCallback): void { + public resizeWithCallback(width: int, height: int, callback: AsyncCallback): void { taskpool.execute((): void => { - this.resize(this.nativeObj, width, height); + this.resizeNative(this.nativeObj, width, height); }).then((ret: NullishType) => { callback(new BusinessError(), undefined); }).catch((err: NullishType) => { @@ -2276,9 +2276,11 @@ export class WindowInternal implements Window { }); } - public moveWindowTo(x: int, y: int, callback: AsyncCallback): void { + overload resize { resizeReturnPromise, resizeWithCallback }; + + public moveWindowToWithCallback(x: int, y: int, callback: AsyncCallback): void { taskpool.execute((): void => { - this.moveWindowTo(this.nativeObj, x, y); + this.moveWindowToNative(this.nativeObj, x, y); }).then((ret: NullishType) => { callback(new BusinessError(), undefined); }).catch((err: NullishType) => { @@ -2286,6 +2288,8 @@ export class WindowInternal implements Window { }); } + overload moveWindowTo { moveWindowToReturnPromise, moveWindowToWithCallback }; + public getGlobalRect(): Rect { let ret = this.getGlobalRect(this.nativeObj); return ret; @@ -2910,10 +2914,12 @@ export interface Window { minimize(callback: AsyncCallback): void; minimize(): Promise; maximize(presentation?: MaximizePresentation): Promise; - resize(width: int, height: int): Promise; - moveWindowTo(x: int, y: int): Promise; - resize(width: int, height: int, callback: AsyncCallback): void; - moveWindowTo(x: int, y: int, callback: AsyncCallback): void; + resizeReturnPromise(width: int, height: int): Promise; + moveWindowToReturnPromise(x: int, y: int): Promise; + resizeWithCallback(width: int, height: int, callback: AsyncCallback): void; + overload resize { resizeReturnPromise, resizeWithCallback }; + moveWindowToWithCallback(x: int, y: int, callback: AsyncCallback): void; + overload moveWindowTo { moveWindowToReturnPromise, moveWindowToWithCallback }; getGlobalRect(): Rect; getWindowDecorHeight(): int; setWindowBackgroundColor(color: string | ColorMetrics): 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..fcdc257ff1bae33f05d995ad802778b6235c0e6e 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 @@ -2667,9 +2667,9 @@ ani_status OHOS::Rosen::ANI_Window_Constructor(ani_vm *vm, uint32_t *result) reinterpret_cast(Minimize)}, ani_native_function {"maximize", "JI:V", reinterpret_cast(Maximize)}, - ani_native_function {"resize", "JII:V", + ani_native_function {"resizeNative", "JII:V", reinterpret_cast(WindowResize)}, - ani_native_function {"moveWindowTo", "JII:V", + ani_native_function {"moveWindowToNative", "JII:V", reinterpret_cast(WindowMoveWindowTo)}, ani_native_function {"getGlobalRect", "J:L@ohos/window/window/Rect;", reinterpret_cast(WindowGetGlobalRect)},