Source: stbWindowMgr.js

/**
 * STB object declaration and documentation.
 * JSDoc specification ({@link http://usejsdoc.org/}).
 * An introduction to JSDoc ({@link http://www.2ality.com/2011/08/jsdoc-intro.html}).
 *
 * @fileOverview Provides API to the window manager functionality.
 */

'use strict';

/* jshint unused:false */

//noinspection JSUnusedGlobalSymbols

/**
 * Main object stbWindowMgr methods declaration.
 *
 * Some methods require windowId field which can be achieved either from {@link stbWindowMgr.windowInit} or from {@link stbWebWindow.windowId}.
 *
 * @namespace
 */
var stbWindowMgr = {

	/**
	 * Represents window attributes in **JSON** format.
	 *
	 * See {@link stbWindowMgr.openWebCfgPortal}, {@link stbWindowMgr.windowInit}, {@link stbWindowMgr.windowAttr}, {@link stbWindowMgr.windowInfo}, {@link stbWindowMgr.setWebFaceInitAttr}.
	 *
	 * @typedef {string} stbWindowMgr.windowAttributes
	 *
	 * @property {string} url web document (application) address to load
	 * @property {number} x X-coordinate of the window (relative to screen)
	 * @property {number} y Y-coordinate of the window (relative to screen)
	 * @property {number} width width of the window
	 * @property {number} height height of the window
	 * @property {boolean} visible visibility
	 * @property {string} backgroundColor background color
	 *
	 * @example
	 * // parsed JSON data
	 * {
	 *     url: "http://google.com", x: 100, y: 100, visible: true, backgroundColor: "#00ff00"
	 * }
	 */


	/**
	 * Represents window list in **JSON** format.
	 *
	 * See {@link stbWindowMgr.windowList}.
	 *
	 * @typedef {string} stbWindowMgr.windowList
	 *
	 * @property {number} errCode 0 in case of success or -1 in case of general error
	 * @property {string} errMsg error message. Non empty string indicate error
	 * @property {Array.<number>} result Array (list of windows) of window unique identifiers
	 *
	 * @example
	 * // parsed JSON data
	 * {
	 *     errCode: 0, errMsg: "", result: Array[2]
	 * }
	 */


	/**
	 * Represents window list in **JSON** format.
	 *
	 * See {@link stbWindowMgr.GetFocusedInputInfo}.
	 *
	 * @typedef {string} stbWindowMgr.uiElementInfo
	 *
	 * @property {string} x
	 * @property {string} y
	 * @property {string} w
	 * @property {string} h
	 * @property {string} isTextInput
	 * @property {string} text
	 * @property {string} positionHint
	 *
	 * @example
	 * // parsed JSON data
	 * {
	 *     h: "100",
	 *     isTextInput: "0",
	 *     positionHint: "top",
	 *     text: "some text",
	 *     w: "100",
	 *     x: "100",
	 *     y: "100"
	 * }
	 */


	/**
	 * @private
	 */
	doActiveWindowDebug:
		function () {},


	/**
	 * Make specified window invisible.
	 *
	 * If there other windows exist on window stack then most upper window will became active (be visible and has input focus).
	 *
	 * @param {number} windowId window ID to hide
	 *
	 * @since 0.2.18
	 */
	hideWindow:
		function ( windowId ) {},


	/**
	 * Get status for "screen saver" window.
	 *
	 * @return {boolean} possible values:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | window exist
	 *  false | window not found
	 *
	 * @since 0.2.18
	 */
	IsScreenSaverWindowExist:
		function () {},


	/**
	 * Open "Configuration Portal" window and run specified web application.
	 *
	 * @param {stbWindowMgr.windowAttributes} windowAttributes parameters of created window
	 *
	 * @since 0.2.18
	 */
	openWebCfgPortal:
		function ( windowAttributes ) {},


	/**
	 * @private
	 */
	openWindow:
		function ( string ) {},


	/**
	 * @private
	 */
	sendBroadcastEvent:
		function ( string ) {},


	/**
	 * Set text "`text`" for currently focused HTML element.
	 *
	 * @param {string} text string to set
	 *
	 * @since 0.2.18
	 */
	SetFocusedInputText:
		function ( text ) {},


	/**
	 * Set virtual mouse mode.
	 *
	 * @param {boolean} mode possible values:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | turn virtual mouse on
	 *  false | turn virtual mouse off
	 *
	 * @since 0.2.16
	 */
	setVirtualMouseMode:
		function ( mode ) {},


	/**
	 * Create new window with specified attributes.
	 *
	 * @param {stbWindowMgr.windowAttributes} windowAttributes parameters of created window
	 *
	 * @return {number} window ID for created window (-1 if window was not created)
	 *
	 * @since 0.2.18
	 */
	windowInit:
		function ( windowAttributes ) { return 0; },


	/**
	 * Set window attributes.
	 *
	 * @param {number} windowId ID of target window
	 * @param {stbWindowMgr.windowAttributes} windowAttributes parameters to set
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | executed correctly
	 *  false | failed to execute
	 *
	 * @since 0.2.18
	 */
	windowAttr:
		function ( windowId, windowAttributes ) { return true; },


	/**
	 * Get attributes for given window.
	 *
	 * @param {number} windowId ID of target window
	 *
	 * @return {stbWindowMgr.windowAttributes} parameters of the window
	 *
	 * @since 0.2.18
	 */
	windowInfo:
		function ( windowId ) { return ''; },


	/**
	 * Make given window visible.
	 *
	 * Operation have the same effect as `stbWindowMgr.windowAttr(id, '{"visible":true}')`.
	 *
	 * @param {number} windowId ID of target window
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | executed correctly
	 *  false | failed to execute
	 *
	 * @since 0.2.18
	 */
	windowShow:
		function ( windowId ) { return true; },


	/**
	 * Make given window invisible.
	 *
	 * Operation have the same effect as `stbWindowMgr.windowAttr(id, '{"visible":false}')`.
	 *
	 * @param {number} windowId ID of target window
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | executed correctly
	 *  false | failed to execute
	 *
	 * @since 0.2.18
	 */
	windowHide:
		function ( windowId ) { return true; },


	/**
	 * Close given window.
	 *
	 * @param {number} windowId ID of target window
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | executed correctly
	 *  false | failed to execute
	 *
	 * @since 0.2.18
	 */
	windowClose:
		function ( windowId ) { return true; },


	/**
	 * Load new web document into given window "`windowId`" using URL "`url`".
	 *
	 * @param {number} windowId ID of target window
	 * @param {string} url address to load
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | executed correctly
	 *  false | failed to execute
	 *
	 * @since 0.2.16
	 */
	windowLoad:
		function ( windowId, url ) { return true; },


	/**
	 * Get ID of currently active window.
	 *
	 * @return {number} ID of the window. May return -1 if there is no proper candidates
	 *
	 * @since 0.2.18
	 */
	windowActive:
		function () { return 0; },


	/**
	 * Get list of ID of currently existing windows.
	 *
	 * @return {stbWindowMgr.windowList} list of ID
	 *
	 * @since 0.2.18
	 */
	windowList:
		function () { return ''; },


	/**
	 * Set URL "`url`" for "web favorites" web application.
	 *
	 * @param {string} url URL to set
	 *
	 * @deprecated since 0.2.18
	 */
	setBookmarkImplUrl:
		function ( url ) {},


	/**
	 * Open "download manager" dedicated web window using "`url`".
	 *
	 * @param {string} url URL to open
	 *
	 * @deprecated since 0.2.18
	 */
	openDownloadManager:
		function ( url ) {},


	/**
	 * Get information for currently focused user interface element (HTML inputs etc...).
	 *
	 * @return {stbWindowMgr.uiElementInfo} attributes of element
	 *
	 * @since 0.2.18
	 */
	GetFocusedInputInfo:
		function () { return ''; },


	/**
	 * Open "bookmark manager" web application and pass currently opened URL of "wild web browser" to application as parameter.
	 *
	 * @deprecated since 0.2.18
	 * @since 0.2.16
	 */
	addBrowserBookmark:
		function () {},


	/**
	 * Close "Wild Web" window.
	 *
	 * @deprecated since 0.2.18
	 */
	closeWebWindow:
		function () {},


	/**
	 * Close window "`windowId`".
	 *
	 * @param {number} windowId ID of window to close
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | executed correctly
	 *  false | failed to execute
	 *
	 * @since 0.2.18
	 */
	closeWindow:
		function ( windowId ) { return true; },


	/**
	 * Get currently loaded URL of "Wild Web" window.
	 *
	 * If there is no "Wild Web" window opened then returns empty string.
	 *
	 * @return {string} URL
	 *
	 * @since 0.2.18
	 */
	getCurrWebUrl:
		function () { return ''; },


	/**
	 * Get title of currently opened "Wild Web" window.
	 *
	 * If there is no "Wild Web" window opened then return empty string.
	 *
	 * @return {string} title
	 *
	 * @since 0.2.16
	 */
	getCurrentTitle:
		function () { return ''; },


	/**
	 * @deprecated since 0.2.18
	 */
	InitWebWindow:
		function ( urlTop, urlBottom ) {},


	/**
	 * Set init window attributes for "Web Face" window.
	 *
	 * @param {stbWindowMgr.windowAttributes} windowAttributes attributes to set
	 *
	 * @since 0.2.18
	 */
	setWebFaceInitAttr:
		function ( windowAttributes ) {},


	/**
	 * Create and initialize the "Wild Web" window using URL "`url`".
	 * Created window will be invisible by default.
	 *
	 * @param {string} url URL to load into newly created window
	 *
	 * @since 0.2.18
	 */
	initWebWindow:
		function ( url ) {},


	/**
	 * Check if "Virtual Keyboard" dedicated window exists.
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | window existed
	 *  false | window not found
	 *
	 * @since 0.2.18
	 */
	IsWebVkWindowExist:
		function () {},


	/**
	 * Check if "Wild Web" dedicated window exists.
	 *
	 * @return {boolean} operations status:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | window existed
	 *  false | window not found
	 *
	 * @since 0.2.16
	 */
	IsWebWindowExist:
		function () { return true; },


	/**
	 * Load URL "`url`" to "Wild Web" dedicated window.
	 *
	 * @param {string} url URL to load (if string is empty then load `file:///home/pages/blank/index.html`)
	 *
	 * @since 0.2.16
	 */
	LoadUrl:
		function ( url ) {},


	/**
	 * @deprecated since 0.2.18
	 * @since 0.2.16
	 */
	openMediaPlayer:
		function ( strVal1, strVal2 ) {},


	/**
	 * @deprecated since 0.2.18
	 * @since 0.2.16
	 */
	openWebFavorites:
		function ( strVal, mode ) {},


	/**
	 * @deprecated since 0.2.18
	 * @since 0.2.16
	 */
	openWebWindow:
		function ( strVal ) {},


	/**
	 * Create "Web Face" dedicated window and load address "`url`".
	 *
	 * @param {string} url address to load
	 *
	 * @return {number} ID of the created window
	 *
	 * @since 0.2.18
	 */
	openWebFace:
		function ( url ) {},


	/**
	 * Make "Wild Web" window active.
	 * Do nothing if window does not exist.
	 *
	 * @since 0.2.18
	 */
	raiseWebWindow:
		function () {},


	/**
	 * Make "Web Face" window active.
	 * Do nothing if window does not exist.
	 *
	 * @since 0.2.18
	 */
	raiseWebFaceWindow:
		function () {},


	/**
	 * Resize "Wild Web" window using given coordinates.
	 * "`x`","`y`" - top left corner, "`w`","`h`" - width and height of the new window.
	 *
	 * @param {number} x X
	 * @param {number} y Y
	 * @param {number} w width
	 * @param {number} h height
	 *
	 * @since 0.2.18
	 */
	resizeWebWindow:
		function ( x, y, w, h ) {},


	/**
	 * Set manual position for "Virtual keyboard" window. This effectively override default behavior of {@link stbWindowMgr.GetFocusedInputInfo}.
	 *
	 * @param {string} hint defines the hint for positioning hint value depends on "`Virtual keyboard`" implementation
	 *
	 * (value is defined for web application level) recommended values:
	 *
	 *  Value         | Description
	 * ---------------|-------------
	 *  "none"        | position hind is undefined
	 *  "topleft"     | window should be positioned close to top-left corner
	 *  "topright"    | window should be positioned close to top-right corner
	 *  "top"         | window should be positioned close to top edge
	 *  "bottomright" | window should be positioned close to bottom-right corner
	 *  "bottomleft"  | window should be positioned close to bottom-left corner
	 *  "bottom"      | window should be positioned close to bottom edge
	 *
	 * @param {number} xPos set manual "X" coordinate of top-left corner for "Virtual keyboard" window
	 *
	 * -1 value cancel manual coordinates ({@link stbWindowMgr.GetFocusedInputInfo} will return coordinates of the active element)
	 *
	 * @param {number} yPos set manual "Y" coordinate of top-left corner for "Virtual keyboard" window
	 *
	 * -1 value cancel manual coordinates ({@link stbWindowMgr.GetFocusedInputInfo} will return coordinates of the active element)
	 *
	 * @since 0.2.18
	 */
	SetVirtualKeyboardCoord:
		function ( hint, xPos, yPos ) {},


	/**
	 * Open "Web Favorites" window.
	 *
	 * @deprecated since 0.2.18
	 * @since 0.2.16
	 */
	showBrowserBookmarks:
		function () {},


	/**
	 * Make the "Internal Portal" window active.
	 *
	 * @since 0.2.16
	 */
	showPortalWindow:
		function () {},


	/**
	 * Set focus mode for "Virtual keyboard" window.
	 *
	 * @param {boolean} mode possible values:
	 *
	 *  Value | Description
	 * -------|-------------
	 *  true  | focus VK window
	 *  false | focus previously focused window
	 *
	 * @deprecated since 0.2.18
	 * @since 0.2.18
	 */
	VkSetFocus:
		function ( mode ) {},


	/**
	 * Set window init attributes for "Virtual keyboard" window.
	 *
	 * @param {stbWindowMgr.windowAttributes} windowAttributes attributes to set
	 *
	 * @since 0.2.18
	 */
	setVirtualKeyboardInitAttr:
		function ( windowAttributes ) {}
};