Class: Window

Window

Window class returned by WindowManager.createWindow()

new Window (wm, options)

Name Type Description
wm WindowManager optional
options Window~WindowOptions optional
Fires:
  • event:open
  • event:focus
  • event:blur
  • event:close
  • event:maximize
  • event:maximize-restore
  • event:move
  • event:move-start
  • event:move-end
  • event:resize
  • event:resize-start
  • event:resize-end
  • event:move-x
  • event:move-y
  • event:resize-width
  • event:resize-height
  • event:loaded

Classes

Window

Members

bottom number

bottom coordinate of window

closed boolean readonly

is window closed?

content HTMLElement readonly

This is the content DOM element. Use this to add content to the Window.

height number

height of window
right coordinate of window

title string

change title

width number

width of window

win HTMLElement readonly

This is the top-level DOM element

winBox HTMLElement readonly

This is the container for the titlebar+content

x number

left coordinate

y number

top coordinate

Methods

attachToScreen (direction, location)

attaches window to a side of the screen
Name Type Description
direction 'horizontal' | 'vertical'
location 'left' | 'right' | 'top' | 'bottom'

blur ()

blur the window

center (win)

centers window in middle of other window or document.body
Name Type Description
win Window optional

close ()

closes the window (can be reopened with open)

focus ()

focus the window

isClosed ()boolean

Returns:
Type Description
boolean

isModal (ignoreClosed)boolean

Name Type Description
ignoreClosed boolean optional
Returns:
Type Description
boolean

load (data)

return the state of the window
Name Type Description
data Object from save()

maximize ()

maximize the window

move (x, y)

move window
Name Type Description
x number
y number

open (noFocus)

open the window
Name Type Description
noFocus boolean optional do not focus window when opened

reposition (bounds, keepInside)

Name Type Description
bounds WindowManager~Bounds
keepInside boolean | 'horizontal' | 'vertical'

resize (width, height)

resize the window
Name Type Description
width number
height number

save ()Object

save the state of the window
Returns:
Type Description
Object data

sendToBack ()

sends window to back of window-manager

sendToFront ()

send window to front of window-manager

Type Definitions

WindowOptions Object

Properties:
Name Type Argument Default Description
x number <optional>
0
y number <optional>
0
width number <optional>
height number <optional>
modal boolean <optional>
openOnCreate boolean <optional>
true
id * <optional>
movable boolean <optional>
true
resizable boolean <optional>
true
maximizable boolean <optional>
true
closable boolean <optional>
true
noSnap boolean <optional>
don't snap this window or use this window as a snap target
titlebar boolean <optional>
true
titlebarHeight string <optional>
36px
titleCenter boolean <optional>
minWidth string <optional>
200px
minHeight string <optional>
60px
borderRadius string <optional>
4px
backgroundModal string <optional>
rgba(0,0,0,0.6)
backgroundWindow string <optional>
#fefefe
backgroundTitlebarActive string <optional>
#365d98
backgroundTitlebarInactive string <optional>
#888888
foregroundButton string <optional>
#ffffff
foregroundTitle string <optional>
#ffffff
styles Object <optional>
maximizeButton string <optional>
... used to replace the graphics for the button
closeButton string <optional>
... used to replace the graphics for the button
resize string <optional>
... used to replace the graphics for the button

Events

Fires when window loses focus
Type:

close

Fires when window closes
Type:

focus

Fires when window gains focus
Type:

maximize

Fires when window is maximized
Type:

maximize-restore

Fires when window is restored to normal after being maximized
Type:
Fires during move
Type:

move-end

Fires after move completes
Type:

move-start

Fires when move starts
Type:

move-x

Fires when x position of window is changed
Type:

move-y

Fires when y position of window is changed
Type:
Fires when window opens
Type:

resize

Fires during resizing
Type:

resize-end

Fires after resize completes
Type:

resize-height

Fires when height is changed
Type:

resize-start

Fires when resize starts
Type:

resize-width

Fires when width is changed
Type: