Window

Window

Creates a draggable, collapsible window to be used as a parent for other components.

Constructor

# new Window(parent, x, y, w, h, label)

Constructor
Parameters:
Name Type Description
parent HTMLElement The element to add this window to.
x number The x position of the window. Default 0.
y number The y position of the window. Default 0.
w number The width of the window. Default 400.
h number The height of the window. Default 400.
label number The label to put in the title bar. Default 0.
Source:
Example
const win = new Window(document.body, 20, 20, 200, 200);
new Button(win, 20, 20, "Click");

Extends

Classes

Window

Members

# (static) draggable

Default draggable state for all Windows.
Source:

# (static) minimizable

Default minimizable state for all Windows.
Source:

# draggable

Gets and sets whether the window can be dragged by its title bar.
Source:

# enabled

Sets and gets whether or not this component is enabled. Non-enabled components will be faded out and not respond to events.
Overrides:

# height

Sets and gets the height of this component.
Overrides:

# label

Sets and gets the label shown in the window's title bar.
Source:

# minimizable

Gets and sets whether the window has a minimize button.
Source:

# width

Sets and gets the width of this component.
Overrides:

# x

Sets and gets the x position of this component.
Overrides:

# y

Sets and gets the y position of this component.
Overrides:

Methods

# getDraggable()

Source:
Returns:
Whether or not this window can be moved by dragging its title bar.

# getEnabled()

Gets whether the component is enabled.
Returns:
Whether or not the component is enabled.

# getHeight()

Gets the height of the component.
Overrides:
Returns:
The height of the component.

# getLabel()

Source:
Returns:
This window's label.

# getMinimizable()

Source:
Returns:
Whether this window has a minimize button.

# getWidth()

Gets the width of the component.
Overrides:
Returns:
The width of the component.

# getX()

Gets the x position of the component.
Overrides:
Returns:
The x position of the component.

# getY()

Gets the y position of the component.
Overrides:
Returns:
The y position of the component.

# move(x, y)

Moves the component to a specified position.
Parameters:
Name Type Description
x number The new x position of the component.
y number The new y position of the component.
Overrides:
Returns:
This instance, suitable for chaining.

# rotate(rad)

Rotates the component.
Parameters:
Name Type Description
rad number The number of radians to rotate the component by.
Overrides:
Returns:
This instance, suitable for chaining.

# rotateDeg(deg)

Rotates the component.
Parameters:
Name Type Description
deg number The number of degrees to rotate the component by.
Overrides:
Returns:
This instance, suitable for chaining.

# setDraggable(draggable)

Sets whether or not this window can be dragged by its title bar.
Parameters:
Name Type Description
draggable boolean Whether this window can be dragged.
Source:
Returns:
This instance, suitable for chaining.

# setEnabled(enabled)

Sets the enabled state of this component.
Parameters:
Name Type Description
enabled boolean Whether or not the component will be enabled.
Returns:
This instance, suitable for chaining.

# setHeight(height)

Sets the height of this component.
Parameters:
Name Type Description
height number The height of this component.
Overrides:
Returns:
This instance, suitable for chaining.

# setLabel(label)

Sets the test shown in this window's title bar.
Parameters:
Name Type Description
label string The label in the title bar.
Source:
Returns:
This instance, suitable for chaining.

# setMinimizable(minimizable)

Sets whether or not this window can be minimized.
Parameters:
Name Type Description
minimizable boolean Whether this window can be minimized.
Source:
Returns:
This instance, suitable for chaining.

# setSize(w, h)

Sizes the component.
Parameters:
Name Type Description
w number The new width of the component.
h number The new height of the component.
Overrides:
Returns:
This instance, suitable for chaining.

# setWidth(width)

Sets the width of this component.
Parameters:
Name Type Description
width number The width of this component.
Overrides:
Returns:
This instance, suitable for chaining.

# setX(x)

Sets the x position of this component.
Parameters:
Name Type Description
x number The x position of this component.
Overrides:
Returns:
This instance, suitable for chaining.

# setY(y)

Sets the y position of this component.
Parameters:
Name Type Description
y number The y position of this component.
Overrides:
Returns:
this instance, suitable for chaining.