window

Functions for working with the current SMP panel and accessing it's properties.

Members

static DlgCode

Indicates which keys should be processed by the panel.
See https://docs.microsoft.com/en-us/windows/desktop/dlgbox/wm-getdlgcode for more info.
Example
window.DlgCode = DLGC_WANTALLKEYS;

static, readonly Height :number

static, readonly ID :number

Window handle casted to uint32_t.

static, readonly InstanceType :number

You need this to determine which GetFontXXX and GetColourXXX methods to use, assuming you want to support both interfaces.

0 - if using Columns UI
1 - if using default UI.

static, readonly IsTransparent :boolean

Only useful within Panel Stack Splitter (Columns UI component)
Depends on setting inside Spider Monkey Panel Configuration window. You generally use it to determine whether or not to draw a background.

static, readonly IsVisible :boolean

static, readonly JsMemoryStats :JsMemoryStats

Get memory statistics for JavaScript engine.

static MaxHeight :number

window.MaxHeight, window.MaxWidth, window.MinHeight and window.MinWidth can be used to lock the panel size.
Do not use if panels are contained within Panel Stack Splitter (Columns UI component).

static MaxWidth :number

static, readonly MemoryLimit :number

Maximum allowed memory usage for the component (in bytes).
If the total memory usage exceeds this value, all panels will fail with OOM error.

Deprecated: use window.JsMemoryStats.total_memory_limit instead.
Deprecated:
  • Yes

static MinHeight :number

static MinWidth :number

static, readonly Name :string

Returns the panel name set in window.ShowConfigureV2.

static, readonly PanelMemoryUsage :number

Memory usage of the current panel (in bytes).

Deprecated: use window.JsMemoryStats.memory_usage instead.
Deprecated:
  • Yes

static, readonly ScriptInfo :ScriptInfo

Information about the panel script.

static, readonly Tooltip :FbTooltip

Get associated tooltip object.

static, readonly TotalMemoryUsage :number

Total memory usage of all panels (in bytes).

Deprecated: use window.JsMemoryStats.total_memory_usage instead.
Deprecated:
  • Yes

static, readonly Width :number

Methods

static ClearInterval(timerID)

Parameters:
Name Type Description
timerID number

static ClearTimeout(timerID)

Parameters:
Name Type Description
timerID number

static CreatePopupMenu() → {MenuObject}

Returns:
MenuObject
Example
// See `samples/basic/MainMenuManager All-In-One.js`, `samples/basic/Menu Sample.js`

static CreateThemeManager(class_id) → {ThemeManager}

Parameters:
Name Type Description
class_id string https://docs.microsoft.com/en-us/windows/win32/controls/parts-and-states
Returns:
ThemeManager
Example
// See `samples/basic/SimpleThemedButton.js`

static CreateTooltip(font_nameopt, font_size_pxopt, font_styleopt) → {FbTooltip}

Note: a single panel can have only a single tooltip object. Creating a new tooltip will replace the previous one.

Deprecated: use fb.Tooltip and FbTooltip.SetFont instead.
Parameters:
Name Type Attributes Default Description
font_name string <optional>
'Segoe UI'
font_size_px number <optional>
12
font_style number <optional>
0 See Flags.js > FontStyle
Returns:
FbTooltip
Deprecated:
  • Yes

static DefinePanel(name, optionsopt)

Setups panel and script information and available features.
Can be called only once, so it's better to define it directly in the panel Configure menu.

Deprecated: use window.DefineScript instead. Panel name can be changed via window.ShowConfigureV2.
Parameters:
Name Type Attributes Default Description
name string Script name and panel name
options object <optional>
{}
Properties
Name Type Attributes Default Description
author string <optional>
'' Script author
version string <optional>
'' Script version
features object <optional>
Additional script features
Properties
Name Type Attributes Default Description
drag_n_drop boolean <optional>
false Indicates if drag_n_drop functionality should be enabled
Deprecated:
  • Yes

static DefineScript(name, optionsopt)

Setup the script information.
Can be called only once for the whole panel.
Parameters:
Name Type Attributes Default Description
name string Script name
options object <optional>
{}
Properties
Name Type Attributes Default Description
author string <optional>
'' Script author
version string <optional>
'' Script version
features object <optional>
Additional script features
Properties
Name Type Attributes Default Description
drag_n_drop boolean <optional>
false Indicates if drag_n_drop functionality should be enabled
grab_focus boolean <optional>
true Indicates if panel should grab mouse focus

static EditScript()

Open the current panel script in the default text editor.
Default text editor can be changed via `Edit` button on the main tab of window.ShowConfigureV2.

static GetColourCUI(type, client_guidopt) → {number}

Parameters:
Name Type Attributes Description
type number See Flags.js > Used in window.GetColourXXX()
client_guid string <optional>
See Flags.js > Used in GetColourCUI() as client_guid.
Returns:
number - returns black colour if the requested one is not available.

static GetColourDUI(type) → {number}

Parameters:
Name Type Description
type number
Returns:
number - returns black colour if the requested one is not available.

static GetFontCUI(type, client_guidopt)nullable {GdiFont}

Note: see the example in window.GetFontDUI.
Parameters:
Name Type Attributes Description
type number See Flags.js > Used in window.GetFontXXX()
client_guid string <optional>
See Flags.js > Used in GetFontCUI() as client_guid.
Returns:
GdiFont - returns null if the requested font was not found.

static GetFontDUI(type)nullable {GdiFont}

Parameters:
Name Type Description
type number See Flags.js > Used in window.GetFontXXX()
Returns:
GdiFont - returns null if the requested font was not found.
Example
// To avoid errors when trying to use the font or access its properties, you
// should use code something like this...
let font = window.GetFontDUI(0);
if (!font) {
   console.log("Unable to determine your default font. Using Segoe UI instead.");
   font = gdi.Font("Segoe UI", 12);
}

static GetProperty(name, default_valopt) → {*}

Get value of property.
If property does not exist and default_val is not undefined and not null, it will be created with the value of default_val.

Note: leading and trailing whitespace are removed from property name.
Parameters:
Name Type Attributes Description
name string
default_val * <optional>
Returns:
*

static NotifyOthers(name, info)

This will trigger on_notify_data(name, info) in other panels.
!!! Beware !!!: data passed via `info` argument must NOT be used or modified in the source panel after invoking this method.
Parameters:
Name Type Description
name string
info *
Example
let data = { 
   // some data
};
window.NotifyOthers('have_some_data', data);

data = null; // stop using the object immediately
// AddSomeAdditionalValues(data); // don't try to modify it, since it will affect the object in the other panel as well

static Reload()

Reload panel.

static Repaint(forceopt)

Performance note: don't force the repaint unless it's really necessary - repaint calls might be grouped up when *not forced* which will turn them into a single repaint call, thus reducing the amount of on_paint calls.
Parameters:
Name Type Attributes Default Description
force boolean <optional>
false If true, will repaint immediately, otherwise a repaint task will be *scheduled*.

static RepaintRect(x, y, w, h, forceopt)

Repaints a part of the screen.
Use this instead of window.Repaint on frequently updated areas such as time, bitrate, seekbar, etc.

Performance note: see Performance note in window.Repaint.
Parameters:
Name Type Attributes Default Description
x number
y number
w number
h number
force boolean <optional>
false If true, will repaint immediately, otherwise a repaint task will be *scheduled*.

static SetCursor(id)

This would usually be used inside the on_mouse_move callback.
Use -1 if you want to hide the cursor.
Parameters:
Name Type Description
id number See Flags.js > Used in window.SetCursor()

static SetInterval(func, delay) → {number}

Parameters:
Name Type Description
func function
delay number
Returns:
number

static SetProperty(name, valopt)

Set property value.
Property will be removed, if val is undefined or null.

Property values are saved per panel instance and are remembered between foobar2000 restarts.

Note: leading and trailing whitespace are removed from property name.
Parameters:
Name Type Attributes Description
name string
val * <optional>

static SetTimeout(func, delay) → {number}

See setTimeout.
Parameters:
Name Type Description
func function
delay number
Returns:
number

static ShowConfigure()

Show configuration window of current panel.
Deprecated: use window.ShowConfigureV2 to configure panel and window.EditScript to edit script.
Deprecated:
  • Yes

static ShowConfigureV2()

Show configuration window of current panel

static ShowProperties()

Show properties window of current panel