import PublicEventManager from "./events/PublicEventManager"; import { WINDOWSTATE } from "./constants"; import { StandardCallback, StandardErrorCallback, StandardPromise } from "../types"; import { WindowEventName, WrapState, WindowIdentifier } from "../services/window/types"; import { Bounds } from "../services/window/types"; import { WindowDescriptor } from "../services/window/types"; import { WindowOptions } from "../FEA"; declare class FinsembleView { win: FinsembleWindow; id: Number; constructor(params: any); remove(cb?: Function): Promise; setBounds(bounds: any, cb?: Function): Promise; bringToFront(cb?: Function): Promise; } /** *

Finsemble Window

---------- This class provides access to some low level window management operations. This class is intended for internal-use only, so it may change without warning. Do not rely on this class. @constructor */ export declare class FinsembleWindow extends PublicEventManager { Group: any; componentState: any; wrapState: WrapState; name: string; windowOptions: any; bounds: object; WINDOWSTATE: any; parentWindow: any; windowKey: string; componentKey: string; TITLE_CHANGED_CHANNEL: string; TITLE_CHANGED_SUBSCRIPTION: any; windowState: WINDOWSTATE; identifier: WindowIdentifier | undefined; windowName: string | undefined; type: string | null; windowType: string | null | undefined; setWindowType: string | undefined; types: any; removeListeners?: Function; parentSubscribeID: any; guid: string; uuid?: string; outsideOfFinsemble?: boolean; private settingParent; descriptor?: WindowDescriptor; /** * @private * @param params */ constructor(params: any); static WINDOWSTATE: any; /** * Internal use only - changes pre-3.5 event names to standardized, post-3.5 event names * @private * @param {string} event - name of the event */ standardizeEventName(event: any): any; /** * Add an event listener * * @param {WindowEventName} eventName - The event to be listened for * @param {Function} handler - The function that receives the notification * @returns {Function} - an unsubscriber * @example * const unsubscriber = finsembleWindow.addEventListener("maximized", (eventObject) => { * console.log("The window was maximized. Passed event object:", eventObject); * }); * * // To unsubscribe: * unsubscriber(); */ addEventListener(eventName: WindowEventName, handler: Function): import("./events/PublicEventManager").Unsubscriber; /** * Deprecated - please use the unsubscriber returned by the addEventListener * * @param {string} eventName - The event to be listened for * @param {Function} handler - The handler function that was originally registered under addEventListener (must be a named function) * @example * const myFunc = (eventObj) => {console.log(eventObj)}; * finsembleWindow.addEventListener("minimized", myFunc); * finsembleWindow.removeEventListener("minimized", myFunc); */ removeEventListener(eventName: WindowEventName, handler: Function, logWarning?: boolean): void; /** * Internal use only - Returns the name of the window service channel for a given service or topic * @private * @param {string} channelTopic - the topic or service (eg, "close", "maximize", "getParent") * @returns {string} the window service channel name, which can be used for router queries/listening */ windowServiceChannelName(channelTopic: any): string; /** * Internal use only - Returns the event channel name for a given topic * @private * @param {string} channelTopic - name of the event channel topic * @returns {string} the full event channel name */ eventChannelName(channelTopic: string): string; /** * @private * @param params */ doConstruction(params: any): any; /** * Internal Use Only - register BaseWindow extended classes by reference name * * @private * @param name - reference type * @param type - BaseWindow extended class * @example * finsembleWindow.registerType("WebWindow", WebWindow); */ static registerType(name: any, type: any): void; /** * @private * This is used to bind all functions only in FinsembleWindow and not in the child wrappers to the wrappers. Without this binding, the value of "this" in the functions is wrong. * @param {} obj */ static bindFunctions(obj: any): void; /** * Legacy function. Insteady, use the `getInstance` method. */ static wrap: typeof FinsembleWindow.getInstance; /** * Internal use only * If you want to get a FinsembleWindow instance (aka a Wrap, aka a WindowWrap), use `FSBL.FinsembleWindow.getInstance` * @private */ private static createWrapFromUUIDAndName; /** * Creating wraps is expensive, involving a router query to the window service. The static member * `cache` is used to store these handles so that they can be used frequently. */ private static cache; /** * Async wrap. Given a name/windowName, it will query the launcher for information required to wrap the window. Then it will return an object that can be operated on. * Also this creates a cache of all wrapped windows for performance. Our clients wrap the same window often and this was causing excessive messaging to the store and degrading performance. * * @param {*} params Need only name in most cases. For service and other cases where the window is not part of what the launcher considers active windows, name and uuid are required * @param {boolean} [params.waitForReady] If true, will async await for Finsemble to return ready before continuing to build the instance to return * @param {string} [params.name] - Name of the app (must include name or windowName) * @param {string} [params.windowName] - WindowName of the app (must include name or windowName) * @param [cb] * @example * const {wrap} = await FSBL.FinsembleWindow.getInstance({ * windowName: finsembleWindow.windowName * }); * * // Sync alternative * FSBL.FinsembleWindow.getInstance({windowName: finsembleWindow.windowName}, (err, wrap) => { * if(!err){ * // Do something with the wrap, aka the instance * } * }); */ static getInstance(params: any, cb?: Function): Promise<{ wrap: FinsembleWindow; }>; /** * @private * @param windowName */ static _windowReady: (windowName: string) => Promise; /** * Creates a Finsemble WindowWrap * @param {*} params * @param {string} params.name The name of the window * @param {*} [params.retrievedIdentifier] Retrieved window identifier * @param {*} [params.windowIdentifier] The window identifier * @param {boolean} [param.setWindowType] If true, will set the window type * @private */ static _createWrap(params: any): Promise<{ wrap: FinsembleWindow; }>; /** * @private * @param name */ static _getRemoveWrapChannel(name: any): string; /** * this routine handles the close event, but also called without event from FSBL * @private * @param event */ handleWrapRemoveRequest(event?: any): Promise; /** * Called by FSBLDesktop on a window "unload". This removes all of the established wraps * and, importantly, cleans up their router listeners * @private */ static closeAllWraps(): void; /** * @private */ cleanupRouter(): void; /** * Identify what to run when/if the component is ready. * If the component is already in a ready state when `onReady` is invoked, * the callback/promise will immediately resolve * * @param [callback] * @example * await finsembleWindow.onReady(); * // Do stuff now that the component is ready * * // Sync alternative * finsembleWindow.onReady(() => { * // Do stuff now that the component is ready * }); */ onReady(callback?: Function): Promise; /** * @param {string} methodName method name (e.g. "minimize", "maximize") * @param {object} params * @param {function=} callback * @private */ queryWindowService(methodName: string, params: any, callback?: Function): Promise; /** * Minimizes the current window. * Use .restore() to reverse this action * * @param params This parameter is ignored. * @param [callback] * @example * const {err} = await finsembleWindow.minimize() * * // Sync alternative * finsembleWindow.minimize(null, (err) => { * if(!err){ * // Do something * } * }) */ minimize(params?: any | null, cb?: StandardErrorCallback): StandardPromise; /** * Maximizes the current window. * Use .restore() to reverse this action * * @param params This parameter is ignored. * @param [callback] * @example * const {err} = await finsembleWindow.maximize() * * // Sync alternative * finsembleWindow.maximize(null, (err) => { * if(!err){ * // Do something * } * }) */ maximize(params?: any | null, cb?: StandardErrorCallback): StandardPromise; /** * Restores a minimized or maximized component. * Note: restore does not show a hidden component. * * @param params This parameter is ignored. * @param [callback] * @example * const {err} = await finsembleWindow.restore() * * // Sync alternative * finsembleWindow.restore(null, (err) => { * if(!err){ * // Do something * } * }) */ restore(params?: any | null, cb?: StandardErrorCallback): StandardPromise; /** * Blurs the current window * * @param params This parameter is ignored. * @param [callback] * @example * const {err} = await finsembleWindow.blur() * * // Sync alternative * finsembleWindow.blur(null, (err) => { * if(!err){ * // Do something * } * }) */ blur(params?: any | null, cb?: StandardErrorCallback): StandardPromise; /** * Brings focus to the current window * * @param params This parameter is ignored. * @param [callback] * @example * const {err} = await finsembleWindow.focus() * * // Sync alternative * finsembleWindow.focus(null, (err) => { * if(!err){ * // Do something * } * }) */ focus(params?: any | null, cb?: StandardErrorCallback): StandardPromise; /** * Brings the current window to front * * @param params This parameter is ignored. * @param [callback] * @example * const {err} = await finsembleWindow.bringToFront() * * // Sync alternative * finsembleWindow.bringToFront(null, (err) => { * if(!err){ * // Do something * } * }) */ bringToFront(params?: any | null, cb?: StandardErrorCallback): StandardPromise; /** * Sets the alwaysOnTop state for the window. * @param params Object representing the new alwaysOnTop state. * @param [callback] Callback identifying if there was an error * @example * const {err} = finsembleWindow.setAlwaysOnTop({alwaysOnTop: true}); * // err should be null * * // Sync alternative * finsembleWindow.setAlwaysOnTop({alwaysOnTop: true}, (err) => { * console.log(err); // null * }) */ setAlwaysOnTop(params?: { alwaysOnTop: boolean; }, cb?: StandardErrorCallback): StandardPromise; /** * Determine the state of the alwaysOnTop option for the window. * See also: setAlwaysOnTop, updateOptions * * @param params This parameter is ignored. * @param [callback] * @example * finsembleWindow.isAlwaysOnTop({}, (err, data) => { * console.log(err); // null * console.log(data); // true if always, false if minimized or hidden * }) */ isAlwaysOnTop(params: {} | undefined, callback: StandardCallback): void; /** * Determine if the current window is showing. A window is not showing when it is minized or hidden. * See also: updateOptions * * @param params This parameter is ignored. * @param [callback] * @example * finsembleWindow.isShowing({}, (err, data) => { * console.log(err); // null * console.log(data); // true if showing, false if minimized or hidden * }) */ isShowing(params: {} | undefined, callback: StandardCallback): void; /** * Experimental - There is an issue where resizing a window inside a click-through area causes flickering. This issue is present * in the electron base code. This implementation may be removed for an alternative solution. * * Instruct the window to ignore mouse events. * Optionally may allow mouse movement events to be forwarded while ignoring interaction events. * * Returns a promise that resolves to undefined. * * @param ignore Whether or not to have the window receive mouse events. * @param options An optional object with extra configuration parameters. * @param options.forward If true indicates mouse movement events are still triggered in the window. * @param callback Callback accepting two values: a (possible) error object and success message. * @returns {Promise} * @private */ setIgnoreMouseEvents(ignore: boolean, options?: { forward: boolean; }, callback?: Function): void; /** * Use FSBL.Clients.WindowClient.setShape instead * (Doesn't work) * @private */ setShape(params?: Array<{ x: Number; y: Number; width: Number; height: Number; } | null>, callback?: Function): void; /** * @private * @param params * @param callback * @returns */ addBrowserView(params?: { bounds?: { left: Number; top: Number; width: Number; height: Number; }; url?: string; webContentsName?: string; allowAutoResize?: boolean; }, callback?: Function): Promise; /** * @private * @param params * @param callback * @returns */ removeBrowserView(view: FinsembleView, callback?: Function): Promise; /** * @private * @param params * @param callback * @returns */ bringViewToFront(view: FinsembleView, callback?: Function): Promise; /** * @private * @param params * @param callback * @returns */ setViewBounds(params: { view: FinsembleView; bounds: { left: Number; top: Number; width: Number; height: Number; }; }, callback?: Function): Promise; /** * Set the bounding box for the current window. * See also: getBounds * * @param {Bounds} params.bounds - The new bounds for the window. Must provide left/top/height/width * @param [callback] * @example * await finsembleWindow.setBounds({bounds: {left: 0, top: 0, height: 600, width: 400}}) */ setBounds(params?: { bounds: Bounds | {}; }, cb?: StandardErrorCallback): StandardPromise; /** * Get the bounding box for the current window. The structure of the bounding box data looks like: * {top, left, bottom, right, height, width} * * See also: setBounds * * @params [cb] - Callback providing bounding data * @example * const {err, data} = await finsembleWindow.getBounds(); * console.log("The width of the current window:", data.width); * * // Sync alternative * finsembleWindow.getBounds( (err, data) => { * console.log("The width of the current window:", data.width); * }) */ getBounds(cb?: StandardErrorCallback, backwardCompatibilitycb?: StandardErrorCallback): StandardPromise; /** * Update options for the current window. One or more options can be set at a time. * * To confirm that the options were set, see also `getOptions` * * @param {WindowOptions} params - Options to be updated * @param [callback] * * @example * finsembleWindow.updateOptions({opacity: .5, alwaysOnTop: true}, () => { * // do something now that options have been updated * }); */ updateOptions(params: any, callback?: Function): void; /** * Hides the current window. * Use the `.show()` method to bring the current window back. * * @param {object} [params] * @param {boolean} [params.invokedByParent] - internal use only * @param [callback] * @example * const {err} = await finsembleWindow.hide(); * * // Sync alternative * finsembleWindow.hide({}, (err, data) => { * console.log(err); // null * console.log(data); // {status: "success"} * }) */ hide(params?: {}, cb?: StandardErrorCallback): StandardPromise; /** * Reloads the current window. * * @param params - This parameter is ignored. * @param callback - This parameter is ignored. * @example * finsembleWindow.reload() */ reload(params?: {}, callback?: Function): void; /** * Shows the current window. This will undo hide or minimize. * * @param {object} [params] * @param {boolean} [params.invokedByParent] - internal use only * @param {boolean} [params.shouldMaximize] - when the window is shown, it should also be maximized * @param {boolean} [params.shouldRestore] - * @param {boolean} [params.saveState] - * @param [callback] * @example * const {err} = await finsembleWindow.show(); * const {err} = await finsembleWindow.show({shouldMaximize: true}); * * // Sync alternative * finsembleWindow.show({}, (err, data) => { * console.log(err); // null * console.log(data); // {status: "success"} * }) */ show(params?: {}, cb?: StandardErrorCallback): StandardPromise; /** * Shows the current window at a particular coordinate location. * Note: this shows the window, but does not give it focus. * * @param params * @param {number} params.left * @param {number} params.top * @param callback * @example * finsembleWindow.showAt({left: 0, top: 0}, () => { * // Do something * }) */ showAt(params?: {}, callback?: Function): void; /** * Close the current window * * @param params - This property is ignored * @param callback * @example * finsembleWindow.close() */ close(params?: {}, cb?: StandardErrorCallback): StandardPromise; /** * While it *feels* like `animate` should animate something, it doesn't, and it never has. * Use `setBounds` instead. * * @private * @param params * @param callback */ animate(params?: {}, callback?: Function): void; /** * Register a window with docking. Use this if you don't want to use the full initialization function. * Undo this action with `.unRegisterWithDocking()` * * NOTE: The “params” object cannot be removed since assimilationWindowManager.ts invokes initializeWindow * with params which are sent to registerWithDocking * @private * @param {Object} params - can be anything that is passed to docking for window registration. * @param {Function} cb */ registerWithDocking(params: {} | undefined, cb: StandardCallback): void; /** * Open a native file selection dialog on a window * * @param {Object} params - see https://www.electronjs.org/docs/api/dialog * @param {Function} cb * @example * finsembleWindow.showNativeOpenDialog({}, (err, [response]) => { * if(!err && !response.canceled && !response.error){ * console.log("Files selected: ", response.filePaths) * } * }) * * finsembleWindow.showNativeOpenDialog( * { * buttonLabel: "My Custom Label", * properties: ["multiSelections"] * }, * (err, [response]) => { * if(!err && !response.canceled && !response.error){ * console.log("Files selected: ", response.filePaths) * } * } * ) */ showNativeOpenDialog(params: {} | undefined, cb: StandardCallback): void; /** * Unregister a window with docking * @private */ unRegisterWithDocking(): void; /** *This is if we want to handle the full register/ready state inside of the window register with docking send the message to launcher saying that component is ready * @private */ initializeWindow({ manageWindowMovement, identifier }: { manageWindowMovement: any; identifier: any; }, cb?: Function): void; /** * Internal use only - publish the ready command * @private */ wrapReady(): void; /** * Set the opacity of the current window * * @param params - the new opacity for the window, in the form of `{opacity: ##}` * @param callback - callback when done * @example * finsembleWindow.setOpacity({opacity: .5}, (err) => { * if(!err){ * // Do something now that opacity has successfully changed * } * }) */ setOpacity(params: any, callback?: Function): void; /** * Invoked to indicate an operation (e.g. dragging out of tab region) has started. This signals the Docking service to start tracking the mouse location and invoking tiling behavior as needed. Typically inherited (base function only). * @param {object} params for future use * @private * @example * // dragging tab example using tracking and group * FinsembleWindow.startTabTileMonitoring(); * // if dragging tab is in a group, then remove it given tracking results will decide what to do with the window * FinsembleWindow.Group.getGroupID(this.identifier, function (err, tileGroupId) { * if (!err) { // if no error then must be in a tile group * self.Group.removeWindow(this.identifier); * } * }); */ startTabTileMonitoring(params?: {}): void; /** * Invoked by client originating a dragStart that it has has ended. Typically inherited (base function only). * @param {object} params for future use * @param {function=} callback option callback that support overriding default behavior * @private * FinsembleWindow.stopTabTileMonitoring(params, function(err, results, defaultTabTileAction) { * // . . . custom code goes here . . . * defaultTabTileAction(results); // now take default action or call your own function instead * }); * */ stopTabTileMonitoring(params?: {}, callback?: Function): void; /** * Defines default TabTile action for stopTabTileMonitoring. May be overridden by client -- see example in stopTabTileMonitoring. Typically inherited (base function only). * @param {any} stopTabTileResults * @private */ defaultTabTileAction(stopTabTileResults: any): void; /** * Internal use only * @private * @param bounds */ mergeBounds(bounds: { left?: any; right?: any; top?: any; bottom?: any; height?: any; width?: any; }): void; /** * Make necessary visual and logistic changes when a window is about to be moved. * See also: stopMove * * @private * @param params - This is ignored */ startMove(params?: any): void; /** * Make necessary visual and logistic changes when a window is no longer being moved * See also: startMove * * @private * @param params - This is ignored */ stopMove(params?: any): void; /** * Get Monitor for this window * * Example output for monitor data: * { * name: "device1", * availableRect: {width, height, top, bottom, left, right}, * bounds: { * min: {x, y}, * max: {x, y}, * }, * top, * bottom, * left, * right, * } * * @param {function} cb Callback * @example * finsembleWindow.getMonitor((monitorData) => { * console.log(monitorData); * }) */ getMonitor(cb: Function): void; /** * @private * Alternative, use: `FSBL.Clients.WindowClient.getComponentState` */ getComponentState(params: { field?: string; fields?: string[]; }, cb: StandardCallback): void; /** * @private */ getWindowState(params: { field?: string; fields?: { field: string; }[]; }, cb: StandardCallback): void; /** * @private * Internal use only * Alternative, use: `FSBL.Clients.WindowClient.setComponentState` */ setComponentState(params: { field?: string; fields?: { field: string; value: any; }[]; value?: any; }, cb?: StandardCallback): void; /** * @private * Internal use only * Alternative, use: `FSBL.Clients.WindowClient.removeComponentState` */ removeComponentState(params: { field?: string; fields?: { field: string; }[]; windowName?: string; }, cb?: StandardCallback): void; /** * DEPRECATED * @private */ setWindowState(params: { field?: string; fields?: { field: string; }[]; }, cb?: StandardCallback): void; /** * @private * @param params * @param cb */ saveCompleteWindowState(params?: {}, cb?: Function): void; /** *Cancels startTabTileMonitoring. Example use is a user "escapes" out of a drag operation. * @param {object} params for future use * @private */ cancelTabTileMonitoring(params?: {}): void; /** * Return the parent window's wrapper (e.g. StackedWindow). * * @param cb - Callback with the parent (null if there's no parent) * @example * finsembleWindow.getParent((err, parent) => { * if(parent !== null){ * // do something * } * }) */ getParent(cb: StandardCallback): void; /** * Sets the parent window (e.g. stackedWindow) and emits "setParent" event to window listeners. * * @param {object} stackedWindowIdentifier identifier of window to set as parent (e.g. stackedWindowIdentifier). * @private */ setParent(stackedWindowIdentifier: any, cb?: StandardCallback): Promise; /** * Sets the parent window (e.g. stackedWindow) on a window wrap. * This is for the case where a window already has a parent but it's wrap doesn't know about it. * @param {object} stackedWindowIdentifier identifier of window to set as parent (e.g. stackedWindowIdentifier). * @private */ setParentOnWrap(stackedWindowIdentifier: any, cb?: Function): void; /** * Clears the parent reference and emits "clearParent" event to window listeners. Used only internally. * * @private */ clearParent(): void; /** * Change the title of the current window. * * @param title - the new title * @example * finsembleWindow.setTitle("New title"); */ setTitle(title: string): void; /** * Get all options related to the current window * * @param [cb] * @example * const {err, data} = await finsembleWindow.getOptions(); * // data looks like: {acceptFirstMouse: true, addToWorkspace: true, ...} * * // Sync alternative * finsembleWindow.getOptions((err, data) => { * // data looks like: {acceptFirstMouse: true, addToWorkspace: true, ...} * }) */ getOptions(cb?: StandardErrorCallback): StandardPromise; /** * Handles common housekeeping checks and modifications on params at the beginning of each private window-management function * * @param {string} methodName method name (e.g. "minimize", "maximize") * @param {object} params * @private */ _privateManagementPreface(methodName: string, params: any): any; /** * Adds window as a child to a stacked window. Adds to the top of the stack, or if specified to a specific location in the stack; * * @param {object=} params * @param {object} params.stackedWindowIdentifier stacked window to operate on stacked window to operate on * @param {object} params.windowIdentifier window to add * @param {number=} params.position the location in the stack to push the window. Location 0 is the bottom of the stack. Defaults to the top of stack. * @param {boolean=} params.noSave if true then don't save the store after updating it (will be saved by caller) * @param {function=} callback function(err) * @private */ addWindow(params: any, callback?: Function): Promise; /** * Removes a child window from a stacked window. If removed window was visible, then the bottom child window (position 0) in stack will be made visible. * * @param {object} params * @param {object} params.stackedWindowIdentifier stacked window to operate on * @param {object} params.windowIdentifier window to remove * @param {boolean=} params.noDocking if true then do not register removed window with docking (the workspace is unaffected) * @param {function=} callback function(err) * @private */ removeWindow(params: any, callback?: Function): Promise; /** * Removes a window from the stack then closes it. If removed window was visible, then the bottom child window (position 0) in stack will be made visible. * * @param {object} params * @param {object} params.stackedWindowIdentifier stacked window to operate on * @param {object} params.windowIdentifier window to delete * @param {function=} callback function(err) * @private */ deleteWindow(params: any, callback?: Function): Promise; /** * Sets the visible window within the stack. The previously visible window in stack will be automatically hidden. * * @param {object} params * @param {object} params.stackedWindowIdentifier stacked window to operate on * @param {object} params.windowIdentifier * @param {function=} callback function(err) * @private */ setVisibleWindow(params: any, callback?: Function): Promise; /** * Reorders the stack, but does not affect visibility * * @param {object} params * @param {object} params.stackedWindowIdentifier stacked window to operate on * @param {array} params.windowIdentifiers array of windowIdentifiers which provides the new order * @param {function=} callback function(err) * @private */ reorder(params: any, callback?: Function): Promise; /** * Form a docking group with any adjacent windows. * This is the equivalent of clicking the "Attach Windows" icon in the titlebar, if it's available. * * @example * finsembleWindow.formGroup() */ formGroup(): void; /** * Leave a docking group * This is the equivalent of clicking the "Detach Window" icon in the titlebar, if it's available. * * @example * finsembleWindow.ejectFromGroup() */ ejectFromGroup(): void; } export {}; //# sourceMappingURL=FinsembleWindow.d.ts.map