Class Index | File Index

Classes


Class MochiKit.Widget.Dialog


Extends MochiKit.Widget.
The dialog widget class. Used to provide a resizeable and moveable window within the current page. Internally it uses a number of <div> HTML elements.
Defined in: Widget.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new dialog widget.
Fields borrowed from class MochiKit.Widget:
_id, Classes
Method Summary
Method Attributes Method Name and Description
 
Handles a dialog move drag operation.
 
Initiates a dialog move drag operation.
 
Handles a dialog resize drag operation.
 
Initiates a dialog resize drag operation.
 
_stopDrag(evt)
Stops a dialog resize or move drag operation.
 
addChildNode(child)
Adds a single child DOM node to this widget.
 
Returns an array with all child DOM nodes.
 
hide()
Hides the dialog.
 
moveTo(x, y)
Moves the dialog to the specified position (relative to the parent DOM node).
 
Moves the dialog to the center (relative to the parent DOM node).
 
Emitted when the dialog is hidden.
 
Emitted when the dialog is moved.
 
Emitted when the dialog is resized.
 
Emitted when the dialog is shown.
 
Removes a single child DOM node from this widget.
 
resizeTo(width, height)
Resizes the dialog to the specified size (in pixels).
 
setAttrs(attrs)
Updates the dialog or HTML DOM node attributes.
 
show()
Shows the dialog.
Methods borrowed from class MochiKit.Widget:
_animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, hasClass, isFormField, isHidden, isWidget, removeAll, removeClass, setStyle, toggleClass
Class Detail
MochiKit.Widget.Dialog(attrs)
Creates a new dialog widget.
var dialog = MochiKit.Widget.Dialog({ title: "My Dialog", modal: true },
                                        "...dialog content widgets here...");
parent.addAll(dialog);
dialog.show();
Parameters:
{Object} attrs
the widget and node attributes
{String} attrs.title Optional
the dialog title, defaults to "Dialog"
{Boolean} attrs.modal Optional
the modal dialog flag, defaults to false
{Boolean} attrs.center Optional
the center dialog flag, defaults to true
{Boolean} attrs.resizeable Optional
the resize dialog flag, defaults to true
{Object} ... Optional
the child widgets or DOM nodes
Returns:
{Widget} the widget DOM node
Method Detail
_handleMove(evt)
Handles a dialog move drag operation.
Parameters:
{Event} evt
the MochiKit.Signal.Event object

_handleMoveStart(evt)
Initiates a dialog move drag operation. This will install a mouse event handler on the parent document.
Parameters:
{Event} evt
the MochiKit.Signal.Event object

_handleResize(evt)
Handles a dialog resize drag operation.
Parameters:
{Event} evt
the MochiKit.Signal.Event object

_handleResizeStart(evt)
Initiates a dialog resize drag operation. This will install a mouse event handler on the parent document.
Parameters:
{Event} evt
the MochiKit.Signal.Event object

_stopDrag(evt)
Stops a dialog resize or move drag operation.
Parameters:
{Event} evt
the MochiKit.Signal.Event object

addChildNode(child)
Adds a single child DOM node to this widget.
Parameters:
{Widget/Node} child
the DOM node to add

{Array} getChildNodes()
Returns an array with all child DOM nodes. Note that the array is a real JavaScript array, not a dynamic NodeList.
Returns:
{Array} the array of child DOM nodes

hide()
Hides the dialog.

moveTo(x, y)
Moves the dialog to the specified position (relative to the parent DOM node). The position will be restrained by the parent DOM node size.
Parameters:
{Number} x
the horizontal position (in pixels)
{Number} y
the vertical position (in pixels)

moveToCenter()
Moves the dialog to the center (relative to the parent DOM node).

onhide()
Emitted when the dialog is hidden.

onmove()
Emitted when the dialog is moved. The event will be sent repeatedly when moving with a mouse drag operation.

onresize()
Emitted when the dialog is resized. The event will be sent repeatedly when resizing with a mouse drag operation.

onshow()
Emitted when the dialog is shown.

removeChildNode(child)
Removes a single child DOM node from this widget.
Parameters:
{Widget/Node} child
the DOM node to remove

resizeTo(width, height)
Resizes the dialog to the specified size (in pixels). The size will be restrained by the parent DOM node size.
Parameters:
{Number} width
the width (in pixels)
{Number} height
the height (in pixels)

setAttrs(attrs)
Updates the dialog or HTML DOM node attributes.
Parameters:
{Object} attrs
the widget and node attributes to set
{String} attrs.title Optional
the dialog title
{Boolean} attrs.modal Optional
the modal dialog flag
{Boolean} attrs.center Optional
the center dialog flag
{Boolean} attrs.resizeable Optional
the resize dialog flag

show()
Shows the dialog.

Documentation generated by JsDoc Toolkit 2.0.2 on Sun May 24 2009 13:14:16 GMT+0200 (CEST)