new Window(optionsopt)
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options.width |
Number |
<optional> |
500
|
Initial width, can be a CSS length or an integer (pixels). |
options.height |
Number |
<optional> |
200
|
Initial height, can be a CSS length or an integer (pixels). |
options.x |
Number |
<optional> |
0
|
X position of the window. |
options.y |
Number |
<optional> |
0
|
Y position of the window. |
options.min_width |
Number |
<optional> |
64
|
Minimum width of the window. |
options.max_width |
Number |
<optional> |
-1
|
Maximum width of the window, -1 ~ infinite. |
options.min_height |
Number |
<optional> |
64
|
Minimum height of the window. |
options.max_height |
Number |
<optional> |
-1
|
Maximum height of the window, -1 ~ infinite. |
options.anchor |
String |
<optional> |
"top-left"
|
Anchor of the window, can be one out of
|
options.modal |
Boolean |
<optional> |
false
|
If modal window blocks all other elements |
options.dock |
String |
<optional> |
false
|
Docking of the window, can be one out of
|
options.maximize |
Object | Boolean |
<optional> |
false
|
Boolean or object with members |
options.minimize |
Boolean |
<optional> |
false
|
Minimize window (does only make sense with a window manager application to keep track of it) |
options.shrink |
Boolean |
<optional> |
false
|
Shrink rolls the window up into the title bar. |
options.content |
String | HTMLElement | Container |
<optional> |
""
|
The content of the window. Can be either a string, a HTMLElement or a Container to append to the content area. |
options.open |
String |
<optional> |
"center"
|
initial position of the window, can be one out of
|
options.z_index |
Integer |
<optional> |
10000
|
Z index for piling windows. does make more sense when used together with a window manager |
options.header |
String | Array.<String> |
<optional> |
["title", "maximize", "close"]
|
Single element or array of
|
options.footer |
String | Array.<String> |
<optional> |
false
|
Single element or array of
|
options.title |
String |
<optional> |
false
|
Window title. |
options.status |
String |
<optional> |
false
|
Window status. |
options.icon |
String |
<optional> |
false
|
URL to window icon. |
options.fixed |
Boolean |
<optional> |
true
|
Whether the window sticks to the viewport rather than the document |
options.auto_active |
Boolean |
<optional> |
false
|
Auto-toggle the active-class when mouseovered |
options.auto_close |
Boolean |
<optional> |
true
|
Set whether close destroys the window or not |
options.auto_maximize |
Boolean |
<optional> |
true
|
Set whether maximize toggles the window or not |
options.auto_minimize |
Boolean |
<optional> |
true
|
Set whether minimize toggles the window or not |
options.auto_shrink |
Boolean |
<optional> |
true
|
Set whether shrink toggles the window or not |
options.draggable |
Boolean |
<optional> |
true
|
Set whether the window is draggable |
options.resizable |
Boolean |
<optional> |
true
|
Set whether the window is resizable |
options.resizing |
String |
<optional> |
"continuous"
|
Resizing policy, |
options.header_action |
String |
<optional> |
"maximize"
|
Action for double clicking the window header, one out of
|
options.active |
Boolean |
<optional> |
true
|
Active state of the window. |
options.hide_status |
Integer |
<optional> |
0
|
If set to !0 status message hides after [n] milliseconds. |
This widget is a flexible overlay window.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
Object |
<optional> |
{ }
|
An object containing initial options. |
Extends
Members
close :Button
- Source:
The close button.
Type:
content :Container
- Source:
A Container for the window content.
Type:
drag :Drag
- Source:
The Drag module.
Type:
element :HTMLDivElement
- Source:
- Inherited From:
The main DIV element. Has class .aux-container
Type:
- HTMLDivElement
footer :Container
- Source:
The bottom footer bar.
Type:
header :Container
- Source:
The top header bar.
Type:
icon :Icon
- Source:
A Icon widget to display the window icon.
Type:
maximize :Button
- Source:
The maximize button.
Type:
maximizehorizontal :Button
- Source:
The maximizehorizontal button.
Type:
maximizevertical :Button
- Source:
The maximizevertical button.
Type:
minimize :Button
- Source:
The minimize button.
Type:
resize :Resize
- Source:
The Resize module.
Type:
shrink :Button
- Source:
The shrink button.
Type:
size :Icon
- Source:
A Icon acting as handle for window resize.
Type:
status :Label
- Source:
A Label to display the window status.
Type:
title :Label
- Source:
A Label to display the window title.
Type:
Methods
addChild(child)
- Source:
- Inherited From:
- See:
Registers a widget as a child widget. This method is used to build up the widget tree. It does not modify the DOM tree.
Parameters:
Name | Type | Description |
---|---|---|
child |
Widget | The child to add. |
Fires:
- Widget#event:child_added
addChildren(a)
- Source:
- Inherited From:
Registers an array of widgets as children.
Parameters:
Name | Type | Description |
---|---|---|
a |
Array.<Widget> | An array of Widgets. |
allChildren()
- Source:
- Inherited From:
Returns an array of all children.
appendChild(child)
- Source:
- Overrides:
Appends a new child to the window content area.
Parameters:
Name | Type | Description |
---|---|---|
child |
Widget | The child widget to add to the windows content area. |
appendChildren(children)
- Source:
- Inherited From:
Calls Widget#appendChild for an array of widgets.
Parameters:
Name | Type | Description |
---|---|---|
children |
Array.<Widget> | The child widgets to append. |
destroy()
- Source:
- Inherited From:
Dispose of this Widget.
destroyAndRemove()
- Source:
- Inherited From:
Dispose of this Widget and remove it from the DOM.
disableTansitions()
- Source:
- Inherited From:
Disable CSS transitions.
enableDraw()
- Source:
- Inherited From:
Schedules this widget for drawing.
Fires:
enableDrawChildren()
- Source:
- Inherited From:
Enables rendering for all children of this widget.
enableTransitions()
- Source:
- Inherited From:
Enable CSS transitions.
forceHide()
- Source:
- Inherited From:
Hide the widget immediately by applying the class aux-hide
.
Does not call disableDraw().
forceShow()
- Source:
- Inherited From:
Show the widget immediately by applying the class aux-show
.
Does not call enableDraw().
getStyle()
- Source:
- Inherited From:
Returns the computed style of this widget's DOM element.
hidden()
- Source:
- Inherited From:
Returns the current hidden status.
hide()
- Source:
- Inherited From:
Starts the transition of the visible
to false
.
hideChild(child)
- Source:
- Inherited From:
Switches the hidden state of a child to hidden
.
The argument is either the child index or the child itself.
Parameters:
Name | Type | Description |
---|---|---|
child |
Object | integer | Child or its index. |
invalidate(key)
- Source:
- Inherited From:
Invalidates an option and triggers a redraw() call.
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
invalidateAll()
- Source:
- Inherited From:
Invalidates all dependencies which will trigger all renderers to rerun.
isChildHidden(child) → {boolean}
- Source:
- Inherited From:
Returns true if the given child is currently marked as hidden in this container.
Parameters:
Name | Type | Description |
---|---|---|
child |
number | Widget |
Returns:
- Type
- boolean
observeResize(cb)
- Source:
- Inherited From:
Calls a callback whenever the widget resizes. This method will trigger one resize.
Parameters:
Name | Type | Description |
---|---|---|
cb |
function |
removeChild(child)
- Source:
- Inherited From:
Removes a child widget. Note that this method only modifies the widget tree and does not change the DOM.
Parameters:
Name | Type | Description |
---|---|---|
child |
Widget | The child to remove. |
Fires:
- Widget#event:child_removed
removeChildren(a)
- Source:
- Inherited From:
Removes an array of children.
Parameters:
Name | Type | Description |
---|---|---|
a |
Array.<Widget> | An array of Widgets. |
set(key, value)
- Source:
- Overrides:
Sets an option.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The option name. |
value |
The option value. |
setStyle()
- Source:
- Inherited From:
Sets a CSS style property in this widget's DOM element.
show()
- Source:
- Inherited From:
Starts the transition of the visible
to true
.
showChild(child)
- Source:
- Inherited From:
Switches the hidden state of a child to shown
.
The argument is either the child index or the child itself.
Parameters:
Name | Type | Description |
---|---|---|
child |
Object | integer | Child or its index. |
toggleChild(child)
- Source:
- Inherited From:
Toggles the hidden state of a child. The argument is either the child index or the child itself.
Parameters:
Name | Type | Description |
---|---|---|
child |
Object | integer | Child or its index. |
toggleHidden()
- Source:
- Inherited From:
Toggle the hidden status. This is equivalent to calling hide() or show(), depending on the current hidden status of this widget.
toggleMaximize(maximize)
- Source:
Toggles the overall maximize state of the window.
Parameters:
Name | Type | Description |
---|---|---|
maximize |
Boolean | State of maximization. If window is already maximized in one or both directions it is un-maximized, otherwise maximized. |
toggleMaximizeHorizontal(maximize)
- Source:
Toggles the horizontal maximize state of the window.
Parameters:
Name | Type | Description |
---|---|---|
maximize |
Boolean | The new horizontal maximization. |
toggleMaximizeVertical(maximize)
- Source:
Toggles the vertical maximize state of the window.
Parameters:
Name | Type | Description |
---|---|---|
maximize |
Boolean | The new vertical maximization. |
toggleMinimize(minimize)
- Source:
Toggles the minimize state of the window.
Parameters:
Name | Type | Description |
---|---|---|
minimize |
Boolean | The new minimization. |
toggleShrink(shrink)
- Source:
Toggles the shrink state of the window.
Parameters:
Name | Type | Description |
---|---|---|
shrink |
Boolean | The new shrink state. |
transitionsDisabled()
- Source:
- Inherited From:
Returns true if transitions are currently disabled on this widget.
visibleChildren()
- Source:
- Inherited From:
Returns an array of all visible children.
Events
closeclicked
- Source:
The user clicked the close button.
dimensionschanged
- Source:
The dimensions of the window changed.
Parameters:
Name | Type | Description |
---|---|---|
event |
Object | The Window#dimensions dimensions object. |
dragging
- Source:
The user is dragging the window.
Parameters:
Name | Type | Description |
---|---|---|
event |
DOMEvent | The DOM event. |
footerchanged
- Source:
The footer changed.
headeraction
- Source:
The user double-clicked on the header.
Parameters:
Name | Type | Description |
---|---|---|
action |
string | The function which was executed, e.g. |
headerchanged
- Source:
The header changed.
maximizeclicked
- Source:
The user clicked the maximize button.
Parameters:
Name | Type | Description |
---|---|---|
maximize |
Object | The maximize option. |
maximizehorizontalclicked
- Source:
The user clicked the maximize-horizontal button.
Parameters:
Name | Type | Description |
---|---|---|
maximize |
Object | The maximize option. |
maximizeverticalclicked
- Source:
The user clicked the maximize-vertical button.
Parameters:
Name | Type | Description |
---|---|---|
maximize |
Object | The maximize option. |
minimizeclicked
- Source:
The user clicked the minimize button.
Parameters:
Name | Type | Description |
---|---|---|
minimize |
Object | The minimize option. |
positionchanged
- Source:
The position of the window changed.
Parameters:
Name | Type | Description |
---|---|---|
event |
Object | The Window#dimensions dimensions object. |
resizing
- Source:
The user resizes the window.
Parameters:
Name | Type | Description |
---|---|---|
event |
DOMEvent | The DOM event. |
shrinkclicked
- Source:
The user clicked the shrink button.
Parameters:
Name | Type | Description |
---|---|---|
shrink |
Object | The shrink option. |
startdrag
- Source:
The user starts dragging the window.
Parameters:
Name | Type | Description |
---|---|---|
event |
DOMEvent | The DOM event. |
startresize
- Source:
The user starts resizing the window.
Parameters:
Name | Type | Description |
---|---|---|
event |
DOMEvent | The DOM event. |
stopdrag
- Source:
The user stops dragging the window.
Parameters:
Name | Type | Description |
---|---|---|
event |
DOMEvent | The DOM event. |
stopresize
- Source:
The user stops resizing the window.
Parameters:
Name | Type | Description |
---|---|---|
event |
DOMEvent | The DOM event. |
destroy
- Source:
- Inherited From:
Is fired when a widget is destroyed.
doubleclick
- Source:
- Inherited From:
Is fired after a double click appeared. Set dblclick
to 0 to
disable click event handling.
Parameters:
Name | Type | Description |
---|---|---|
event |
string | The browsers |
GenericDOMEvents
- Source:
- Inherited From:
Generic DOM events. Please refer to W3Schools for further details.
hide
- Source:
- Inherited From:
The hide
event is emitted when a widget is hidden and is not rendered anymore.
This happens both with browser visibility changes and also internally when using layout widgets
such as Pager.
initialized
- Source:
- Inherited From:
Is fired when a widget is initialized.
resize
- Source:
- Inherited From:
The resize
event is emitted whenever a widget is being resized. This event can
be used to e.g. measure its new size. Note that some widgets do internal adjustments after
the resize
event. If that is relevant, the Widget#resized event can
be used instead.
resized
- Source:
- Inherited From:
The resized
event is emitted after each rendering frame, which was triggered by
a resize event.
set
- Source:
- Inherited From:
The set
event is emitted when an option was set using the Widget#set
method. The arguments are the option name and its new value.
Note that this happens both for user interaction and programmatical option changes.
show
- Source:
- Inherited From:
The show
event is emitted when a widget is shown and is being rendered. This is the
counterpart to Widget#hide.
visibility
- Source:
- Inherited From:
Is fired when the visibility state changes. The first argument
is the visibility state, which is either true
or false
.