interface OSGUIWindow { /** * Sets the title, or if `text` isn't passed, returns the current title of the window. * * Uses jQuery getter/setter function idiom. */ title(text: string): OSGUI$Window; title(): string; // title(text?: string): OSGUI$Window | string; // union of overloads isn't helping /** * Returns the current title of the window. Alternative to `title()`. */ getTitle(): string; /** * Closes the window. */ close(force?: boolean): void; /** * Tries to focus something within the window, in this order of priority: * - The last focused control within the window * - A control with `class="default"` * - If it's a tool window, the parent window * - and otherwise the window itself (specifically `$window.$content`) */ focus(): void; /** * Removes focus from the window. If focus is outside the window, it is left unchanged. */ blur(): void; /** * Minimizes the window. If `$window.task.$task` is defined it will use that as a target for minimizing, otherwise the window will minimize to the bottom of the screen. */ minimize(): void; /** * Restores the window from minimized state. */ private unminimize(): void; /** * Maximizes the window. While maximized, the window will use `position: fixed`, so it will not scroll with the page. */ maximize(): void; /** * Restores the window from minimized or maximized state. If the window is not minimized or maximized, this method does nothing. */ restore(): void; /** * Centers the window in the page. * You should call this after the contents of the window is fully rendered, or you've set a fixed size for the window. * If you have images in the window, wait for them to load before showing and centering the window, or define a fixed size for the images. */ center(): void; /** * Fits the window within the page if it's partially offscreen. * (Doesn't resize the window if it's too large; it'll go off the right and bottom of the screen.) */ applyBounds(): void; /** * Repositions the window so that the title bar is within the bounds of the page, so it can be dragged. */ bringTitleBarInBounds(): void; /** * Brings the window to the front by setting its `z-index` to larger than any `z-index` yet used by the windowing system. */ bringToFront(): void; /** * Sets the size of the window. Pass `{ innerWidth, innerHeight }` to specify the size in terms of the window content, or `{ outerWidth, outerHeight }` to specify the size including the window frame. * (This may be expanded in the future to allow setting the position as well...) * (Also, the types could be loosened to allow mixing outer/inner for width/height, although that's a LITTLE bit questionable. Might have a use case, not sure.) */ setDimensions(dimensions: { innerWidth?: number; innerHeight?: number } | { outerWidth?: number; outerHeight?: number }): void; // setDimensions(dimensions: ({ innerWidth?: number } | { outerWidth?: number }) & ({ innerHeight?: number } | { outerHeight?: number })): void; /** * Changes the icon(s) of the window. `icons` is in the same format as `options.icons`. */ setIcons(icons: OSGUIIcons): void; /** * Sets the size of the window's title bar icon, picking the closest size that's available. */ setTitlebarIconSize(size: number): void; /** * Returns the size of the window's title bar icon. */ getTitlebarIconSize(): number; /** * Picks the closest icon size that's available, and returns a unique DOM node (i.e. cloned). * This can be used for representing the window in the taskbar. */ getIconAtSize(size: number): Node | null; /** * Appends the menu bar to the window, and sets the keyboard scope for the menu bar's hotkeys to the window. * Can be called with `null` to remove the menu bar. */ setMenuBar(menuBar: MenuBar | null): void; /** * The minimize target (taskbar button) represents the window when minimized, and is used for animating minimize and restore. * If `minimizeTargetElement` is `null`, the window will minimize to the bottom of the screen (the default). */ setMinimizeTarget(minimizeTargetElement: HTMLElement | null): void; /** * Creates a button in the window's content area. * It automatically closes the window when clicked. There's no (good) way to prevent this, as it's intended only for dialogs. * If you need any other behavior, just create a `