Class: WindowManager

WindowManager

Create the WindowManager

new WindowManager (options, windowOptions)

Name Type Description
options Object optional
Name Type Default Description
parent HTMLElement document.body optional parent to append WindowManager
backgroundModal string rgba(0, 0, 0, 0.6) optional background color for window
quiet boolean optional suppress the simple-window-manager console message
snap boolean | WindowManager~SnapOptions optional initialize snap plugin
noAccelerator boolean optional do not initialize keyboard accelerators (needed for Menu)
keepInside boolean | 'horizontal' | 'vertical' true optional keep windows inside the parent in a certain direction
styles Object optional additional hard-coded styles for main container window (eg, { color: 'green' })
windowOptions Window~WindowOptions optional default options used when createWindow is called

Classes

WindowManager

Members

wallpaper HTMLElement readonly

This is the bottom DOM element. Use this to set a wallpaper or attach elements underneath the windows

win HTMLElement readonly

This is the top-level DOM element

Methods

closeAll ()

close all windows

createWindow (options)Window

Create a window
Name Type Description
options WindowOptions optional
Name Type Description
title string optional
x number optional position
y number optional position
modal boolean optional
id number | * optional if not provide, id will be assigned in order of creation (0, 1, 2...)
Returns:
Type Description
Window the created window

getWindowById (id)Window

Find a window by id
Name Type Description
id *
Returns:
Type Description
Window

load (data)

restores the state of all the windows NOTE: this requires that the windows have the same id as when save() was called
Name Type Description
data Object created by save()

save ()Object

save the state of all the windows
Returns:
Type Description
Object use this object in load() to restore the state of all windows

sendToBack (win)

send window to back
Name Type Description
win Window

sendToFront (win)

send window to front
Name Type Description
win Window

snap (options)

enable edge and/or screen snapping
Name Type Description
options WindowManager~SnapOptions optional

Type Definitions

Bounds Object

Properties:
Name Type Description
left number
right number
top number
bottom number

SnapOptions Object

Properties:
Name Type Argument Default Description
screen boolean <optional>
true snap to screen edges
windows boolean <optional>
true snap to window edges
snap number <optional>
20 distance to edge in pixels before snapping and width/height of snap bars
color string <optional>
#a8f0f4 color for snap bars
spacing number <optional>
0 spacing distance between window and edges
indicator number <optional>
10 size in pixels of snapping indicator (the indicator is actually twice the size of what is shown)