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