@@ -55,6 +55,8 @@ $.widget( "ui.dialog", {
5555 } ,
5656 closeOnEscape : true ,
5757 closeText : "Close" ,
58+ minimizeText : "Minimize" ,
59+ restoreText : "Restore" ,
5860 draggable : true ,
5961 hide : null ,
6062 height : "auto" ,
@@ -441,7 +443,51 @@ $.widget( "ui.dialog", {
441443 this . close ( event ) ;
442444 }
443445 } ) ;
444-
446+
447+ this . uiDialogTitlebarMinimize = $ ( "<button type='button'></button>" )
448+ . button ( {
449+ label : $ ( "<a>" ) . text ( this . options . minimizeText ) . html ( ) ,
450+ icon : "ui-icon ui-icon-minimize" ,
451+ showLabel : false
452+ } )
453+ . appendTo ( this . uiDialogTitlebar ) ;
454+ this . _addClass ( this . uiDialogTitlebarMinimize , "ui-dialog-titlebar-minimize" ) ;
455+ this . _on ( this . uiDialogTitlebarMinimize , {
456+ click : function ( event ) {
457+ event . preventDefault ( ) ;
458+ this . options . restoreWidth = this . options . width ;
459+ this . options . restoreHeight = this . options . height ;
460+ this . uiDialog . width ( 300 ) ;
461+ this . uiDialog . height ( this . uiDialogButtonPane . height ) ;
462+ this . element . hide ( ) ;
463+ this . uiDialogButtonPane . hide ( ) ;
464+ this . uiDialogTitlebarRestore . button ( "enable" ) ;
465+ this . uiDialogTitlebarMinimize . button ( "disable" ) ;
466+ }
467+ } ) ;
468+ this . uiDialogTitlebarRestore = $ ( "<button type='button'></button>" )
469+ . button ( {
470+ label : $ ( "<a>" ) . text ( this . options . restoreText ) . html ( ) ,
471+ icon : "ui-icon ui-icon-restore" ,
472+ showLabel : false
473+ } )
474+ . appendTo ( this . uiDialogTitlebar ) ;
475+ this . _addClass ( this . uiDialogTitlebarRestore , "ui-dialog-titlebar-restore" ) ;
476+ this . _on ( this . uiDialogTitlebarRestore , {
477+ click : function ( event ) {
478+ event . preventDefault ( ) ;
479+ if ( this . options . restoreWidth != undefined && this . options . restoreWidth != null && this . options . restoreWidth != "" )
480+ this . uiDialog . width ( this . options . restoreWidth ) ;
481+ if ( this . options . restoreHeight != undefined && this . options . restoreHeight != null && this . options . restoreHeight != "" )
482+ this . uiDialog . height ( this . options . restoreHeight ) ;
483+ this . element . show ( ) ;
484+ this . uiDialogButtonPane . show ( ) ;
485+ this . uiDialogTitlebarMinimize . button ( "enable" ) ;
486+ this . uiDialogTitlebarRestore . button ( "disable" ) ;
487+ }
488+ } ) ;
489+ this . uiDialogTitlebarRestore . button ( "disable" ) ;
490+
445491 uiDialogTitle = $ ( "<span>" ) . uniqueId ( ) . prependTo ( this . uiDialogTitlebar ) ;
446492 this . _addClass ( uiDialogTitle , "ui-dialog-title" ) ;
447493 this . _title ( uiDialogTitle ) ;
0 commit comments