From b96972cc4a26a23e47068d74064a93da60e39bb7 Mon Sep 17 00:00:00 2001 From: MaXFeeD Date: Tue, 5 Nov 2024 20:36:48 +0300 Subject: [PATCH 01/29] Moving class UIAdaptiveWindow to UI.AdaptiveWindow --- core-engine/UI.AdaptiveWindow.d.ts | 26 ++++++++++++++++ .../api/mod/ui/window/UIAdaptiveWindow.d.ts | 31 ------------------- 2 files changed, 26 insertions(+), 31 deletions(-) create mode 100644 core-engine/UI.AdaptiveWindow.d.ts delete mode 100644 core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIAdaptiveWindow.d.ts diff --git a/core-engine/UI.AdaptiveWindow.d.ts b/core-engine/UI.AdaptiveWindow.d.ts new file mode 100644 index 000000000..276ac4b72 --- /dev/null +++ b/core-engine/UI.AdaptiveWindow.d.ts @@ -0,0 +1,26 @@ +declare namespace UI { + class UIAdaptiveWindow extends WindowGroup { + /** + * Constructs new {@link UI.AdaptiveWindow} with specified content. + * @param content object containing window description + */ + constructor(content: WindowContent); + /** + * Constructs a new empty {@link UI.AdaptiveWindow}. + */ + constructor(); + setContent(content: WindowContent): void; + /** + * Sets style profile for the current {@link UI.AdaptiveWindow}. + * @param profile 0 for classic profile, 1 for default profile + */ + setProfile(profile: 0 | 1): void; + /** + * Forces {@link UI.AdaptiveWindow} to be displayed using some profile. + * @param profile 0 for classic profile, 1 for default profile or -1 not + * to force any profile. By default forced profile is -1 + */ + setForcedProfile(profile: 0 | 1): void; + open(): void; + } +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIAdaptiveWindow.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIAdaptiveWindow.d.ts deleted file mode 100644 index c8e1d6a29..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIAdaptiveWindow.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class UIAdaptiveWindow extends UIWindowGroup { - static class: java.lang.Class; - constructor(content: WindowContent); - setContent(content: WindowContent): void; - /** - * Sets style profile for the current {@link UI.AdaptiveWindow}. - * @param profile 0 for classic profile, 1 for default profile - */ - setProfile(profile: 0 | 1): void; - /** - * Forces {@link UI.AdaptiveWindow} to be displayed using some profile. - * @param profile 0 for classic profile, 1 for default profile or -1 not - * to force any profile. By default forced profile is -1 - */ - setForcedProfile(profile: 0 | 1): void; - open(): void; - } - } - } - } - } - } - } -} \ No newline at end of file From efe8bfed0dba467c8ba1c373bca769f2bed64cd3 Mon Sep 17 00:00:00 2001 From: MaXFeeD Date: Tue, 5 Nov 2024 20:37:09 +0300 Subject: [PATCH 02/29] Moving class UIWindowGroup to UI.WindowGroup --- core-engine/UI.WindowGroup.d.ts | 161 +++++++++++++++++ .../api/mod/ui/window/UIWindowGroup.d.ts | 166 ------------------ 2 files changed, 161 insertions(+), 166 deletions(-) create mode 100644 core-engine/UI.WindowGroup.d.ts delete mode 100644 core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowGroup.d.ts diff --git a/core-engine/UI.WindowGroup.d.ts b/core-engine/UI.WindowGroup.d.ts new file mode 100644 index 000000000..29f24cb60 --- /dev/null +++ b/core-engine/UI.WindowGroup.d.ts @@ -0,0 +1,161 @@ +declare namespace UI { + /** + * Class representing several windows opened at the same. For example, + * {@link UI.StandardWindow} is a window group that consists of several separate + * windows. + */ + class WindowGroup implements IWindow { + closeOnBackPressed: boolean; + /** + * Constructs new {@link UI.WindowGroup} instance. + */ + constructor(); + /** + * Removes window from group by it's name. + * @param name window name + */ + removeWindow(name: string): void; + /** + * Adds window instance with specified name to the group. + * @param name window name + * @param window window to be added to the group + */ + addWindowInstance(name: string, window: IWindow): void; + /** + * Creates a new window using provided description and adds it to the + * group. + * @param name window name + * @param content window description object + * @returns Created {@link UI.Window} object. + */ + addWindow(name: string, content: WindowContent): Window; + /** + * @param name window name + * @returns Window from the group by it's name or null if no window with + * such a name was added. + */ + getWindow(name: string): Window; + /** + * @param name window name + * @returns Window's description object if a window with specified name + * exists or null otherwise. + */ + getWindowContent(name: string): Nullable; + /** + * Sets content for the window by it's name. + * @param name window name + * @param content content object + */ + setWindowContent(name: string, content: WindowContent): void; + /** + * @returns Collection object containing all the + * {@link UI.Window}s in the group. + */ + getAllWindows(): java.util.Collection; + /** + * @returns Collection object containing string names of the + * windows in the group. + */ + getWindowNames(): java.util.Collection; + /** + * Forces window refresh by it's name. + * @param name name of the window to refresh + */ + refreshWindow(name: string): void; + /** + * Forces refresh for all windows. + */ + refreshAll(): void; + /** + * Moves window with specified name to the top of the group. + * @param name window name + */ + moveOnTop(name: string): void; + /** + * Opens window without container. + */ + open(): void; + /** + * Closes window without container. Use only if the window was opened + * without container. + */ + close(): void; + /** + * Called up to 66 times a second to update window's content. + * @param time current time in milliseconds + */ + frame(time: number): void; + /** + * @returns `true` if the window is opened, `false` otherwise. + */ + isOpened(): boolean; + /** + * @returns `true` if the window has an inventory that should be updated. + */ + isInventoryNeeded(): boolean; + /** + * @returns `true` if the window can change it's contents position. + */ + isDynamic(): boolean; + /** + * Gets all the elements in the window. + * @returns Hashes containing string element name + * as keys and element instances as values. + */ + getElements(): java.util.HashMap; + /** + * @returns `null` for {@link WindowGroup}. + * */ + getContent(): Nullable; + /** + * @returns Currently {@link UI.Container} + * that was used to open this window or null, if the window wasn't opened in container. + */ + getContainer(): Nullable; + /** + * Sets container for the current window. Be careful when calling it + * manually. You should prefer opening the window via {@link UI.Container.openAs} call. + * @param container {@link UI.Container} to be associated with current window + * or `null` to associate no container with current window. + */ + setContainer(container: Nullable): void; + /** + * Turns debug mode for the window on and off. + * @param enabled if `true`, additional debug information will be drawn on + * the window canvas + */ + setDebugEnabled(enabled: boolean): void; + invalidateAllContent(): void; + setStyle(style: Style): void; + setStyle(style: BindingSet): void; + /** + * @returns Object containing current style of the window. + */ + getStyle(): Style; + setBlockingBackground(bb: boolean): void; + /** + * Forces ui elements of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateElements(onCurrentThread: boolean): void; + /** + * Forces ui drawables of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateDrawing(onCurrentThread: boolean): void; + /** + * Gives the property to be closed on pressing back navigation button to the given window group. + */ + setCloseOnBackPressed(val: boolean): void; + /** + * @returns Whether the window group can be closed on pressing back navigation button. + */ + onBackPressed(): boolean; + } +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowGroup.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowGroup.d.ts deleted file mode 100644 index bd7848ec1..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowGroup.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class UIWindowGroup extends java.lang.Object implements IWindow { - static class: java.lang.Class; - closeOnBackPressed: boolean; - /** - * Removes window from group by it's name. - * @param name window name - */ - removeWindow(name: string): void; - /** - * Adds window instance with specified name to the group. - * @param name window name - * @param window window to be added to the group - */ - addWindowInstance(name: string, window: IWindow): void; - /** - * Creates a new window using provided description and adds it to the - * group. - * @param name window name - * @param content window description object - * @returns Created {@link UI.Window} object. - */ - addWindow(name: string, content: WindowContent): UIWindow; - /** - * @param name window name - * @returns Window from the group by it's name or null if no window with - * such a name was added. - */ - getWindow(name: string): UIWindow; - /** - * @param name window name - * @returns Window's description object if a window with specified name - * exists or null otherwise. - */ - getWindowContent(name: string): Nullable; - /** - * Sets content for the window by it's name. - * @param name window name - * @param content content object - */ - setWindowContent(name: string, content: WindowContent): void; - /** - * @returns Collection object containing all the - * {@link UI.Window}s in the group. - */ - getAllWindows(): java.util.Collection; - /** - * @returns Collection object containing string names of the - * windows in the group. - */ - getWindowNames(): java.util.Collection; - /** - * Forces window refresh by it's name. - * @param name name of the window to refresh - */ - refreshWindow(name: string): void; - /** - * Forces refresh for all windows. - */ - refreshAll(): void; - /** - * Moves window with specified name to the top of the group. - * @param name window name - */ - moveOnTop(name: string): void; - /** - * Opens window without container. - */ - open(): void; - /** - * Closes window without container. Use only if the window was opened - * without container. - */ - close(): void; - /** - * Called up to 66 times a second to update window's content. - * @param time current time in milliseconds - */ - frame(time: number): void; - /** - * @returns `true` if the window is opened, `false` otherwise. - */ - isOpened(): boolean; - /** - * @returns `true` if the window has an inventory that should be updated. - */ - isInventoryNeeded(): boolean; - /** - * @returns `true` if the window can change it's contents position. - */ - isDynamic(): boolean; - /** - * Gets all the elements in the window. - * @returns Hashes containing string element name - * as keys and element instances as values. - */ - getElements(): java.util.HashMap; - /** - * @returns `null` for {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowGroup UIWindowGroup}. - * */ - getContent(): Nullable; - /** - * @returns Currently {@link UI.Container} - * that was used to open this window or null, if the window wasn't opened in container. - */ - getContainer(): Nullable; - /** - * Sets container for the current window. Be careful when calling it - * manually. You should prefer opening the window via - * {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.openAs Container.openAs} call. - * @param container {@link UI.Container} - * to be associated with current window or null to associate no container with current window - */ - setContainer(container: Nullable): void; - /** - * Turns debug mode for the window on and off. - * @param enabled if `true`, additional debug information will be drawn on - * the window canvas - */ - setDebugEnabled(enabled: boolean): void; - invalidateAllContent(): void; - setStyle(style: types.UIStyle): void; - setStyle(style: types.BindingSet): void; - /** - * @returns Object containing current style of the window. - */ - getStyle(): types.UIStyle; - setBlockingBackground(bb: boolean): void; - /** - * Forces ui elements of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateElements(onCurrentThread: boolean): void; - /** - * Forces ui drawables of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateDrawing(onCurrentThread: boolean): void; - /** - * Gives the property to be closed on pressing back navigation button to the given window group. - */ - setCloseOnBackPressed(val: boolean): void; - /** - * @returns Whether the window group can be closed on pressing back navigation button. - */ - onBackPressed(): boolean; - } - } - } - } - } - } - } -} \ No newline at end of file From 10fefbad356b2bcac8001199b1d733cb84a072bf Mon Sep 17 00:00:00 2001 From: MaXFeeD Date: Tue, 5 Nov 2024 20:37:33 +0300 Subject: [PATCH 03/29] Moving class UITabbedWindow to UI.TabbedWindow --- core-engine/UI.TabbedWindow.d.ts | 158 ++++++++++++++++++ .../api/mod/ui/window/UITabbedWindow.d.ts | 156 ----------------- 2 files changed, 158 insertions(+), 156 deletions(-) create mode 100644 core-engine/UI.TabbedWindow.d.ts delete mode 100644 core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UITabbedWindow.d.ts diff --git a/core-engine/UI.TabbedWindow.d.ts b/core-engine/UI.TabbedWindow.d.ts new file mode 100644 index 000000000..7b295f3e5 --- /dev/null +++ b/core-engine/UI.TabbedWindow.d.ts @@ -0,0 +1,158 @@ +declare namespace UI { + interface TabbedWindowContent extends WindowContent { + isButtonHidden?: boolean, + } + + /** + * Class used to create windows with multiple tabs. + */ + class TabbedWindow implements IWindow { + closeOnBackPressed: boolean; + currentTab: number; + /** + * Sets window location (bounds) to draw window within. + * @param location location to be used for the tabbed window + */ + setLocation(location: WindowLocation): void; + /** + * @returns Tab content window width in units. + */ + getInnerWindowWidth(): number; + /** + * @returns Tab content window height in units. + */ + getInnerWindowHeight(): number; + /** + * @returns Tab selector window width in units. + */ + getWindowTabSize(): number; + /** + * @returns Tab selector window width in global units. + */ + getGlobalTabSize(): number; + /** + * Constructs new {@link UI.TabbedWindow} with specified location. + * @param loc location to be used for the tabbed window + */ + constructor(loc: WindowLocation); + /** + * Constructs new {@link UI.TabbedWindow} with specified content. + * @param content object containing window description + */ + constructor(content: WindowContent); + /** + * Constructs new empty {@link UI.TabbedWindow} object. + */ + constructor(); + /** + * Sets content of the tab. + * @param index index of the tab; there are 12 tabs available, from 0 to + * 11 + * @param tabOverlay content of the tab selector + * @param tabContent content of the window to be created for the tab + * @param isAlwaysSelected if `true`, tab is always displayed as selected; + * default value is `false` + * @remarks + * The location of the tabs is as follows: + * ```text + * 0 6 + * 1 7 + * 2 8 + * 3 9 + * 4 10 + * 5 11 + * ``` + */ + setTab(index: number, tabOverlay: UI.ElementSet, tabContent: WindowContent, isAlwaysSelected: boolean): void; + /** + * Sets content of the tab. + * @param index index of the tab; there are 12 tabs available, from 0 to + * 11 + * @param tabOverlay content of the tab selector + * @param tabContent content of the window to be created for the tab + * @remarks + * The location of the tabs is as follows: + * ```text + * 0 6 + * 1 7 + * 2 8 + * 3 9 + * 4 10 + * 5 11 + * ``` + */ + setTab(index: number, tabOverlay: UI.ElementSet, tabContent: WindowContent): void; + /** + * Creates fake tab with no content. + * @param index index of the tab, see {@link com.zhekasmirnov.innercore.api.mod.ui.window.UITabbedWindow.setTab UI.TabbedWindow.setTab} for + * details + * @param tabOverlay content of the tab selector + */ + setFakeTab(index: number, tabOverlay: UI.ElementSet): void; + /** + * @param index index of the tab + * @returns New {@link UI.Window} instance + * created for the specified tab or null if + * no window was created for specified window. + */ + getWindowForTab(index: number): Nullable; + open(): void; + close(): void; + frame(time: number): void; + invalidateElements(onCurrentThread: boolean): void; + invalidateDrawing(onCurrentThread: boolean): void; + isOpened(): boolean; + isInventoryNeeded(): boolean; + isDynamic(): boolean; + getElements(): java.util.HashMap; + getContent(): Nullable; + getContainer(): Nullable; + setContainer(container: UiAbstractContainer): void; + setDebugEnabled(debug: boolean): void; + /** + * Sets listener to be notified about window opening/closing events. + */ + setEventListener(listener: WindowEventListener): void; + /** + * Sets listener to be notified about tab with specified index opening/closing events. + * @param tab tab index + * @param listener object to be notified about the events + */ + setTabEventListener(index: number, listener: WindowEventListener): void; + onTabSelected(index: number): void; + /** + * Specifies whether the window should darken and block background. + * @param enabled pass `true` if you want the window to block + * background + * @default false + */ + setBlockingBackground(enabled: boolean): void; + /** + * @returns Current default tab index. If no default tab was specified + * via {@link UI.TabbedWindow.setDefaultTab}, the first tab added becomes default. + */ + getDefaultTab(): number; + /** + * Sets default tab index. + * @param tab index of the tab to be opened by default + */ + setDefaultTab(tab: number): void; + /** + * Sets new style object as current window's style. If the new style is + * a different object then an old one, forces window invalidation. + * @param style {@link UI.Style} object to be used as style for the window + */ + setStyle(style: Style): void; + /** + * Overrides style properties of the current style by the values + * specified in the style parameter. + * @param style js object where keys represent binding names and values + * represent texture gui names + */ + setStyle(style: BindingSet): void; + getStyle(): Nullable