@@ -55,6 +55,8 @@ $.widget( "ui.dialog", {
55
55
} ,
56
56
closeOnEscape : true ,
57
57
closeText : "Close" ,
58
+ minimizeText : "Minimize" ,
59
+ restoreText : "Restore" ,
58
60
draggable : true ,
59
61
hide : null ,
60
62
height : "auto" ,
@@ -441,7 +443,51 @@ $.widget( "ui.dialog", {
441
443
this . close ( event ) ;
442
444
}
443
445
} ) ;
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
+
445
491
uiDialogTitle = $ ( "<span>" ) . uniqueId ( ) . prependTo ( this . uiDialogTitlebar ) ;
446
492
this . _addClass ( uiDialogTitle , "ui-dialog-title" ) ;
447
493
this . _title ( uiDialogTitle ) ;
0 commit comments