commit extjs-2.2.1
[extjs.git] / source / widgets / MessageBox.js
1 /*\r
2  * Ext JS Library 2.2.1\r
3  * Copyright(c) 2006-2009, Ext JS, LLC.\r
4  * licensing@extjs.com\r
5  * \r
6  * http://extjs.com/license\r
7  */\r
8 \r
9 /**\r
10  * @class Ext.MessageBox\r
11  * <p>Utility class for generating different styles of message boxes.  The alias Ext.Msg can also be used.<p/>\r
12  * <p>Note that the MessageBox is asynchronous.  Unlike a regular JavaScript <code>alert</code> (which will halt\r
13  * browser execution), showing a MessageBox will not cause the code to stop.  For this reason, if you have code\r
14  * that should only run <em>after</em> some user feedback from the MessageBox, you must use a callback function\r
15  * (see the <code>function</code> parameter for {@link #show} for more details).</p>\r
16  * <p>Example usage:</p>\r
17  *<pre><code>\r
18 // Basic alert:\r
19 Ext.Msg.alert('Status', 'Changes saved successfully.');\r
20 \r
21 // Prompt for user data and process the result using a callback:\r
22 Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){\r
23     if (btn == 'ok'){\r
24         // process text value and close...\r
25     }\r
26 });\r
27 \r
28 // Show a dialog using config options:\r
29 Ext.Msg.show({\r
30    title:'Save Changes?',\r
31    msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',\r
32    buttons: Ext.Msg.YESNOCANCEL,\r
33    fn: processResult,\r
34    animEl: 'elId',\r
35    icon: Ext.MessageBox.QUESTION\r
36 });\r
37 </code></pre>\r
38  * @singleton\r
39  */\r
40 Ext.MessageBox = function(){\r
41     var dlg, opt, mask, waitTimer;\r
42     var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl;\r
43     var buttons, activeTextEl, bwidth, iconCls = '';\r
44 \r
45     // private\r
46     var handleButton = function(button){\r
47         if(dlg.isVisible()){\r
48             dlg.hide();\r
49             Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value, opt], 1);\r
50         }\r
51     };\r
52 \r
53     // private\r
54     var handleHide = function(){\r
55         if(opt && opt.cls){\r
56             dlg.el.removeClass(opt.cls);\r
57         }\r
58         progressBar.reset();\r
59     };\r
60 \r
61     // private\r
62     var handleEsc = function(d, k, e){\r
63         if(opt && opt.closable !== false){\r
64             dlg.hide();\r
65         }\r
66         if(e){\r
67             e.stopEvent();\r
68         }\r
69     };\r
70 \r
71     // private\r
72     var updateButtons = function(b){\r
73         var width = 0;\r
74         if(!b){\r
75             buttons["ok"].hide();\r
76             buttons["cancel"].hide();\r
77             buttons["yes"].hide();\r
78             buttons["no"].hide();\r
79             return width;\r
80         }\r
81         dlg.footer.dom.style.display = '';\r
82         for(var k in buttons){\r
83             if(typeof buttons[k] != "function"){\r
84                 if(b[k]){\r
85                     buttons[k].show();\r
86                     buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]);\r
87                     width += buttons[k].el.getWidth()+15;\r
88                 }else{\r
89                     buttons[k].hide();\r
90                 }\r
91             }\r
92         }\r
93         return width;\r
94     };\r
95 \r
96     return {\r
97         /**\r
98          * Returns a reference to the underlying {@link Ext.Window} element\r
99          * @return {Ext.Window} The window\r
100          */\r
101         getDialog : function(titleText){\r
102            if(!dlg){\r
103                 dlg = new Ext.Window({\r
104                     autoCreate : true,\r
105                     title:titleText,\r
106                     resizable:false,\r
107                     constrain:true,\r
108                     constrainHeader:true,\r
109                     minimizable : false,\r
110                     maximizable : false,\r
111                     stateful: false,\r
112                     modal: true,\r
113                     shim:true,\r
114                     buttonAlign:"center",\r
115                     width:400,\r
116                     height:100,\r
117                     minHeight: 80,\r
118                     plain:true,\r
119                     footer:true,\r
120                     closable:true,\r
121                     close : function(){\r
122                         if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){\r
123                             handleButton("no");\r
124                         }else{\r
125                             handleButton("cancel");\r
126                         }\r
127                     }\r
128                 });\r
129                 buttons = {};\r
130                 var bt = this.buttonText;\r
131                 //TODO: refactor this block into a buttons config to pass into the Window constructor\r
132                 buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok"));\r
133                 buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes"));\r
134                 buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no"));\r
135                 buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel"));\r
136                 buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets';\r
137                 dlg.render(document.body);\r
138                 dlg.getEl().addClass('x-window-dlg');\r
139                 mask = dlg.mask;\r
140                 bodyEl = dlg.body.createChild({\r
141                     html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'\r
142                 });\r
143                 iconEl = Ext.get(bodyEl.dom.firstChild);\r
144                 var contentEl = bodyEl.dom.childNodes[1];\r
145                 msgEl = Ext.get(contentEl.firstChild);\r
146                 textboxEl = Ext.get(contentEl.childNodes[2].firstChild);\r
147                 textboxEl.enableDisplayMode();\r
148                 textboxEl.addKeyListener([10,13], function(){\r
149                     if(dlg.isVisible() && opt && opt.buttons){\r
150                         if(opt.buttons.ok){\r
151                             handleButton("ok");\r
152                         }else if(opt.buttons.yes){\r
153                             handleButton("yes");\r
154                         }\r
155                     }\r
156                 });\r
157                 textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);\r
158                 textareaEl.enableDisplayMode();\r
159                 progressBar = new Ext.ProgressBar({\r
160                     renderTo:bodyEl\r
161                 });\r
162                bodyEl.createChild({cls:'x-clear'});\r
163             }\r
164             return dlg;\r
165         },\r
166 \r
167         /**\r
168          * Updates the message box body text\r
169          * @param {String} text (optional) Replaces the message box element's innerHTML with the specified string (defaults to\r
170          * the XHTML-compliant non-breaking space character '&amp;#160;')\r
171          * @return {Ext.MessageBox} this\r
172          */\r
173         updateText : function(text){\r
174             if(!dlg.isVisible() && !opt.width){\r
175                 dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows\r
176             }\r
177             msgEl.update(text || '&#160;');\r
178 \r
179             var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0;\r
180             var mw = msgEl.getWidth() + msgEl.getMargins('lr');\r
181             var fw = dlg.getFrameWidth('lr');\r
182             var bw = dlg.body.getFrameWidth('lr');\r
183             if (Ext.isIE && iw > 0){\r
184                 //3 pixels get subtracted in the icon CSS for an IE margin issue,\r
185                 //so we have to add it back here for the overall width to be consistent\r
186                 iw += 3;\r
187             }\r
188             var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth),\r
189                         Math.max(opt.minWidth || this.minWidth, bwidth || 0));\r
190 \r
191             if(opt.prompt === true){\r
192                 activeTextEl.setWidth(w-iw-fw-bw);\r
193             }\r
194             if(opt.progress === true || opt.wait === true){\r
195                 progressBar.setSize(w-iw-fw-bw);\r
196             }\r
197             if(Ext.isIE && w == bwidth){\r
198                 w += 4; //Add offset when the content width is smaller than the buttons.    \r
199             }\r
200             dlg.setSize(w, 'auto').center();\r
201             return this;\r
202         },\r
203 \r
204         /**\r
205          * Updates a progress-style message box's text and progress bar. Only relevant on message boxes\r
206          * initiated via {@link Ext.MessageBox#progress} or {@link Ext.MessageBox#wait},\r
207          * or by calling {@link Ext.MessageBox#show} with progress: true.\r
208          * @param {Number} value Any number between 0 and 1 (e.g., .5, defaults to 0)\r
209          * @param {String} progressText The progress text to display inside the progress bar (defaults to '')\r
210          * @param {String} msg The message box's body text is replaced with the specified string (defaults to undefined\r
211          * so that any existing body text will not get overwritten by default unless a new value is passed in)\r
212          * @return {Ext.MessageBox} this\r
213          */\r
214         updateProgress : function(value, progressText, msg){\r
215             progressBar.updateProgress(value, progressText);\r
216             if(msg){\r
217                 this.updateText(msg);\r
218             }\r
219             return this;\r
220         },\r
221 \r
222         /**\r
223          * Returns true if the message box is currently displayed\r
224          * @return {Boolean} True if the message box is visible, else false\r
225          */\r
226         isVisible : function(){\r
227             return dlg && dlg.isVisible();\r
228         },\r
229 \r
230         /**\r
231          * Hides the message box if it is displayed\r
232          * @return {Ext.MessageBox} this\r
233          */\r
234         hide : function(){\r
235             var proxy = dlg.activeGhost;\r
236             if(this.isVisible() || proxy) {\r
237                 dlg.hide();\r
238                 handleHide();\r
239                 if (proxy) {\r
240                     proxy.hide();\r
241                 } \r
242             }\r
243             return this;\r
244         },\r
245 \r
246         /**\r
247          * Displays a new message box, or reinitializes an existing message box, based on the config options\r
248          * passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally,\r
249          * although those calls are basic shortcuts and do not support all of the config options allowed here.\r
250          * @param {Object} config The following config options are supported: <ul>\r
251          * <li><b>animEl</b> : String/Element<div class="sub-desc">An id or Element from which the message box should animate as it\r
252          * opens and closes (defaults to undefined)</div></li>\r
253          * <li><b>buttons</b> : Object/Boolean<div class="sub-desc">A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo',\r
254          * cancel:'Bar'}), or false to not show any buttons (defaults to false)</div></li>\r
255          * <li><b>closable</b> : Boolean<div class="sub-desc">False to hide the top-right close button (defaults to true). Note that\r
256          * progress and wait dialogs will ignore this property and always hide the close button as they can only\r
257          * be closed programmatically.</div></li>\r
258          * <li><b>cls</b> : String<div class="sub-desc">A custom CSS class to apply to the message box's container element</div></li>\r
259          * <li><b>defaultTextHeight</b> : Number<div class="sub-desc">The default height in pixels of the message box's multiline textarea\r
260          * if displayed (defaults to 75)</div></li>\r
261          * <li><b>fn</b> : Function<div class="sub-desc">A callback function which is called when the dialog is dismissed either\r
262          * by clicking on the configured buttons, or on the dialog close button, or by pressing\r
263          * the return button to enter input.\r
264          * <p>Progress and wait dialogs will ignore this option since they do not respond to user\r
265          * actions and can only be closed programmatically, so any required function should be called\r
266          * by the same code after it closes the dialog. Parameters passed:<ul>\r
267          * <li><b>buttonId</b> : String<div class="sub-desc">The ID of the button pressed, one of:<div class="sub-desc"><ul>\r
268          * <li><tt>ok</tt></li>\r
269          * <li><tt>yes</tt></li>\r
270          * <li><tt>no</tt></li>\r
271          * <li><tt>cancel</tt></li>\r
272          * </ul></div></div></li>\r
273          * <li><b>text</b> : String<div class="sub-desc">Value of the input field if either <tt><a href="#show-option-prompt" ext:member="show-option-prompt" ext:cls="Ext.MessageBox">prompt</a></tt>\r
274          * or <tt><a href="#show-option-multiline" ext:member="show-option-multiline" ext:cls="Ext.MessageBox">multiline</a></tt> is true</div></li>\r
275          * <li><b>opt</b> : Object<div class="sub-desc">The config object passed to show.</div></li>\r
276          * </ul></p></div></li>\r
277          * <li><b>scope</b> : Object<div class="sub-desc">The scope of the callback function</div></li>\r
278          * <li><b>icon</b> : String<div class="sub-desc">A CSS class that provides a background image to be used as the body icon for the\r
279          * dialog (e.g. Ext.MessageBox.WARNING or 'custom-class') (defaults to '')</div></li>\r
280          * <li><b>iconCls</b> : String<div class="sub-desc">The standard {@link Ext.Window#iconCls} to\r
281          * add an optional header icon (defaults to '')</div></li>\r
282          * <li><b>maxWidth</b> : Number<div class="sub-desc">The maximum width in pixels of the message box (defaults to 600)</div></li>\r
283          * <li><b>minWidth</b> : Number<div class="sub-desc">The minimum width in pixels of the message box (defaults to 100)</div></li>\r
284          * <li><b>modal</b> : Boolean<div class="sub-desc">False to allow user interaction with the page while the message box is\r
285          * displayed (defaults to true)</div></li>\r
286          * <li><b>msg</b> : String<div class="sub-desc">A string that will replace the existing message box body text (defaults to the\r
287          * XHTML-compliant non-breaking space character '&amp;#160;')</div></li>\r
288          * <li><a id="show-option-multiline"></a><b>multiline</b> : Boolean<div class="sub-desc">\r
289          * True to prompt the user to enter multi-line text (defaults to false)</div></li>\r
290          * <li><b>progress</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>\r
291          * <li><b>progressText</b> : String<div class="sub-desc">The text to display inside the progress bar if progress = true (defaults to '')</div></li>\r
292          * <li><a id="show-option-prompt"></a><b>prompt</b> : Boolean<div class="sub-desc">True to prompt the user to enter single-line text (defaults to false)</div></li>\r
293          * <li><b>proxyDrag</b> : Boolean<div class="sub-desc">True to display a lightweight proxy while dragging (defaults to false)</div></li>\r
294          * <li><b>title</b> : String<div class="sub-desc">The title text</div></li>\r
295          * <li><b>value</b> : String<div class="sub-desc">The string value to set into the active textbox element if displayed</div></li>\r
296          * <li><b>wait</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>\r
297          * <li><b>waitConfig</b> : Object<div class="sub-desc">A {@link Ext.ProgressBar#waitConfig} object (applies only if wait = true)</div></li>\r
298          * <li><b>width</b> : Number<div class="sub-desc">The width of the dialog in pixels</div></li>\r
299          * </ul>\r
300          * Example usage:\r
301          * <pre><code>\r
302 Ext.Msg.show({\r
303    title: 'Address',\r
304    msg: 'Please enter your address:',\r
305    width: 300,\r
306    buttons: Ext.MessageBox.OKCANCEL,\r
307    multiline: true,\r
308    fn: saveAddress,\r
309    animEl: 'addAddressBtn',\r
310    icon: Ext.MessageBox.INFO\r
311 });\r
312 </code></pre>\r
313          * @return {Ext.MessageBox} this\r
314          */\r
315         show : function(options){\r
316             if(this.isVisible()){\r
317                 this.hide();\r
318             }\r
319             opt = options;\r
320             var d = this.getDialog(opt.title || "&#160;");\r
321 \r
322             d.setTitle(opt.title || "&#160;");\r
323             var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);\r
324             d.tools.close.setDisplayed(allowClose);\r
325             activeTextEl = textboxEl;\r
326             opt.prompt = opt.prompt || (opt.multiline ? true : false);\r
327             if(opt.prompt){\r
328                 if(opt.multiline){\r
329                     textboxEl.hide();\r
330                     textareaEl.show();\r
331                     textareaEl.setHeight(typeof opt.multiline == "number" ?\r
332                         opt.multiline : this.defaultTextHeight);\r
333                     activeTextEl = textareaEl;\r
334                 }else{\r
335                     textboxEl.show();\r
336                     textareaEl.hide();\r
337                 }\r
338             }else{\r
339                 textboxEl.hide();\r
340                 textareaEl.hide();\r
341             }\r
342             activeTextEl.dom.value = opt.value || "";\r
343             if(opt.prompt){\r
344                 d.focusEl = activeTextEl;\r
345             }else{\r
346                 var bs = opt.buttons;\r
347                 var db = null;\r
348                 if(bs && bs.ok){\r
349                     db = buttons["ok"];\r
350                 }else if(bs && bs.yes){\r
351                     db = buttons["yes"];\r
352                 }\r
353                 if (db){\r
354                     d.focusEl = db;\r
355                 }\r
356             }\r
357             if(opt.iconCls){\r
358               d.setIconClass(opt.iconCls);\r
359             }\r
360             this.setIcon(opt.icon);\r
361             bwidth = updateButtons(opt.buttons);\r
362             progressBar.setVisible(opt.progress === true || opt.wait === true);\r
363             this.updateProgress(0, opt.progressText);\r
364             this.updateText(opt.msg);\r
365             if(opt.cls){\r
366                 d.el.addClass(opt.cls);\r
367             }\r
368             d.proxyDrag = opt.proxyDrag === true;\r
369             d.modal = opt.modal !== false;\r
370             d.mask = opt.modal !== false ? mask : false;\r
371             if(!d.isVisible()){\r
372                 // force it to the end of the z-index stack so it gets a cursor in FF\r
373                 document.body.appendChild(dlg.el.dom);\r
374                 d.setAnimateTarget(opt.animEl);\r
375                 d.show(opt.animEl);\r
376             }\r
377 \r
378             //workaround for window internally enabling keymap in afterShow\r
379             d.on('show', function(){\r
380                 if(allowClose === true){\r
381                     d.keyMap.enable();\r
382                 }else{\r
383                     d.keyMap.disable();\r
384                 }\r
385             }, this, {single:true});\r
386 \r
387             if(opt.wait === true){\r
388                 progressBar.wait(opt.waitConfig);\r
389             }\r
390             return this;\r
391         },\r
392 \r
393         /**\r
394          * Adds the specified icon to the dialog.  By default, the class 'ext-mb-icon' is applied for default\r
395          * styling, and the class passed in is expected to supply the background image url. Pass in empty string ('')\r
396          * to clear any existing icon.  The following built-in icon classes are supported, but you can also pass\r
397          * in a custom class name:\r
398          * <pre>\r
399 Ext.MessageBox.INFO\r
400 Ext.MessageBox.WARNING\r
401 Ext.MessageBox.QUESTION\r
402 Ext.MessageBox.ERROR\r
403          *</pre>\r
404          * @param {String} icon A CSS classname specifying the icon's background image url, or empty string to clear the icon\r
405          * @return {Ext.MessageBox} this\r
406          */\r
407         setIcon : function(icon){\r
408             if(icon && icon != ''){\r
409                 iconEl.removeClass('x-hidden');\r
410                 iconEl.replaceClass(iconCls, icon);\r
411                 iconCls = icon;\r
412             }else{\r
413                 iconEl.replaceClass(iconCls, 'x-hidden');\r
414                 iconCls = '';\r
415             }\r
416             return this;\r
417         },\r
418 \r
419         /**\r
420          * Displays a message box with a progress bar.  This message box has no buttons and is not closeable by\r
421          * the user.  You are responsible for updating the progress bar as needed via {@link Ext.MessageBox#updateProgress}\r
422          * and closing the message box when the process is complete.\r
423          * @param {String} title The title bar text\r
424          * @param {String} msg The message box body text\r
425          * @param {String} progressText (optional) The text to display inside the progress bar (defaults to '')\r
426          * @return {Ext.MessageBox} this\r
427          */\r
428         progress : function(title, msg, progressText){\r
429             this.show({\r
430                 title : title,\r
431                 msg : msg,\r
432                 buttons: false,\r
433                 progress:true,\r
434                 closable:false,\r
435                 minWidth: this.minProgressWidth,\r
436                 progressText: progressText\r
437             });\r
438             return this;\r
439         },\r
440 \r
441         /**\r
442          * Displays a message box with an infinitely auto-updating progress bar.  This can be used to block user\r
443          * interaction while waiting for a long-running process to complete that does not have defined intervals.\r
444          * You are responsible for closing the message box when the process is complete.\r
445          * @param {String} msg The message box body text\r
446          * @param {String} title (optional) The title bar text\r
447          * @param {Object} config (optional) A {@link Ext.ProgressBar#waitConfig} object\r
448          * @return {Ext.MessageBox} this\r
449          */\r
450         wait : function(msg, title, config){\r
451             this.show({\r
452                 title : title,\r
453                 msg : msg,\r
454                 buttons: false,\r
455                 closable:false,\r
456                 wait:true,\r
457                 modal:true,\r
458                 minWidth: this.minProgressWidth,\r
459                 waitConfig: config\r
460             });\r
461             return this;\r
462         },\r
463 \r
464         /**\r
465          * Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).\r
466          * If a callback function is passed it will be called after the user clicks the button, and the\r
467          * id of the button that was clicked will be passed as the only parameter to the callback\r
468          * (could also be the top-right close button).\r
469          * @param {String} title The title bar text\r
470          * @param {String} msg The message box body text\r
471          * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
472          * @param {Object} scope (optional) The scope of the callback function\r
473          * @return {Ext.MessageBox} this\r
474          */\r
475         alert : function(title, msg, fn, scope){\r
476             this.show({\r
477                 title : title,\r
478                 msg : msg,\r
479                 buttons: this.OK,\r
480                 fn: fn,\r
481                 scope : scope\r
482             });\r
483             return this;\r
484         },\r
485 \r
486         /**\r
487          * Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).\r
488          * If a callback function is passed it will be called after the user clicks either button,\r
489          * and the id of the button that was clicked will be passed as the only parameter to the callback\r
490          * (could also be the top-right close button).\r
491          * @param {String} title The title bar text\r
492          * @param {String} msg The message box body text\r
493          * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
494          * @param {Object} scope (optional) The scope of the callback function\r
495          * @return {Ext.MessageBox} this\r
496          */\r
497         confirm : function(title, msg, fn, scope){\r
498             this.show({\r
499                 title : title,\r
500                 msg : msg,\r
501                 buttons: this.YESNO,\r
502                 fn: fn,\r
503                 scope : scope,\r
504                 icon: this.QUESTION\r
505             });\r
506             return this;\r
507         },\r
508 \r
509         /**\r
510          * Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt).\r
511          * The prompt can be a single-line or multi-line textbox.  If a callback function is passed it will be called after the user\r
512          * clicks either button, and the id of the button that was clicked (could also be the top-right\r
513          * close button) and the text that was entered will be passed as the two parameters to the callback.\r
514          * @param {String} title The title bar text\r
515          * @param {String} msg The message box body text\r
516          * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
517          * @param {Object} scope (optional) The scope of the callback function\r
518          * @param {Boolean/Number} multiline (optional) True to create a multiline textbox using the defaultTextHeight\r
519          * property, or the height in pixels to create the textbox (defaults to false / single-line)\r
520          * @param {String} value (optional) Default value of the text input element (defaults to '')\r
521          * @return {Ext.MessageBox} this\r
522          */\r
523         prompt : function(title, msg, fn, scope, multiline, value){\r
524             this.show({\r
525                 title : title,\r
526                 msg : msg,\r
527                 buttons: this.OKCANCEL,\r
528                 fn: fn,\r
529                 minWidth:250,\r
530                 scope : scope,\r
531                 prompt:true,\r
532                 multiline: multiline,\r
533                 value: value\r
534             });\r
535             return this;\r
536         },\r
537 \r
538         /**\r
539          * Button config that displays a single OK button\r
540          * @type Object\r
541          */\r
542         OK : {ok:true},\r
543         /**\r
544          * Button config that displays a single Cancel button\r
545          * @type Object\r
546          */\r
547         CANCEL : {cancel:true},\r
548         /**\r
549          * Button config that displays OK and Cancel buttons\r
550          * @type Object\r
551          */\r
552         OKCANCEL : {ok:true, cancel:true},\r
553         /**\r
554          * Button config that displays Yes and No buttons\r
555          * @type Object\r
556          */\r
557         YESNO : {yes:true, no:true},\r
558         /**\r
559          * Button config that displays Yes, No and Cancel buttons\r
560          * @type Object\r
561          */\r
562         YESNOCANCEL : {yes:true, no:true, cancel:true},\r
563         /**\r
564          * The CSS class that provides the INFO icon image\r
565          * @type String\r
566          */\r
567         INFO : 'ext-mb-info',\r
568         /**\r
569          * The CSS class that provides the WARNING icon image\r
570          * @type String\r
571          */\r
572         WARNING : 'ext-mb-warning',\r
573         /**\r
574          * The CSS class that provides the QUESTION icon image\r
575          * @type String\r
576          */\r
577         QUESTION : 'ext-mb-question',\r
578         /**\r
579          * The CSS class that provides the ERROR icon image\r
580          * @type String\r
581          */\r
582         ERROR : 'ext-mb-error',\r
583 \r
584         /**\r
585          * The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)\r
586          * @type Number\r
587          */\r
588         defaultTextHeight : 75,\r
589         /**\r
590          * The maximum width in pixels of the message box (defaults to 600)\r
591          * @type Number\r
592          */\r
593         maxWidth : 600,\r
594         /**\r
595          * The minimum width in pixels of the message box (defaults to 100)\r
596          * @type Number\r
597          */\r
598         minWidth : 100,\r
599         /**\r
600          * The minimum width in pixels of the message box if it is a progress-style dialog.  This is useful\r
601          * for setting a different minimum width than text-only dialogs may need (defaults to 250)\r
602          * @type Number\r
603          */\r
604         minProgressWidth : 250,\r
605         /**\r
606          * An object containing the default button text strings that can be overriden for localized language support.\r
607          * Supported properties are: ok, cancel, yes and no.  Generally you should include a locale-specific\r
608          * resource file for handling language support across the framework.\r
609          * Customize the default text like so: Ext.MessageBox.buttonText.yes = "oui"; //french\r
610          * @type Object\r
611          */\r
612         buttonText : {\r
613             ok : "OK",\r
614             cancel : "Cancel",\r
615             yes : "Yes",\r
616             no : "No"\r
617         }\r
618     };\r
619 }();\r
620 \r
621 /**\r
622  * Shorthand for {@link Ext.MessageBox}\r
623  */\r
624 Ext.Msg = Ext.MessageBox;