@@ -579,6 +579,7 @@ public void setControl (Control control) {
579
579
if (control .parent != parent ) error (SWT .ERROR_INVALID_PARENT );
580
580
}
581
581
if ((style & SWT .SEPARATOR ) == 0 ) return ;
582
+ parent .layout (true );
582
583
this .control = control ;
583
584
/*
584
585
* Feature in Windows. When a tool bar wraps, tool items
@@ -705,6 +706,7 @@ public void setDisabledImage (Image image) {
705
706
checkWidget ();
706
707
if ((style & SWT .SEPARATOR ) != 0 ) return ;
707
708
if (image != null && image .isDisposed ()) error (SWT .ERROR_INVALID_ARGUMENT );
709
+ parent .layout (isImageSizeChanged (disabledImage , image ));
708
710
disabledImage = image ;
709
711
updateImages (getEnabled () && parent .getEnabled ());
710
712
}
@@ -730,6 +732,7 @@ public void setHotImage (Image image) {
730
732
checkWidget ();
731
733
if ((style & SWT .SEPARATOR ) != 0 ) return ;
732
734
if (image != null && image .isDisposed ()) error (SWT .ERROR_INVALID_ARGUMENT );
735
+ parent .layout (isImageSizeChanged (hotImage , image ));
733
736
hotImage = image ;
734
737
updateImages (getEnabled () && parent .getEnabled ());
735
738
}
@@ -739,14 +742,18 @@ public void setImage (Image image) {
739
742
checkWidget ();
740
743
if ((style & SWT .SEPARATOR ) != 0 ) return ;
741
744
if (image != null && image .isDisposed ()) error (SWT .ERROR_INVALID_ARGUMENT );
745
+ parent .layout (isImageSizeChanged (super .image , image ));
746
+ super .setImage (image );
747
+ updateImages (getEnabled () && parent .getEnabled ());
748
+ }
749
+
750
+ boolean isImageSizeChanged (Image oldImage , Image image ) {
742
751
boolean changed = true ;
743
752
// check if image size really changed for old and new images
744
- if (super . image != null && !super . image .isDisposed () && image != null && !image .isDisposed ()) {
745
- changed = !super . image .getBounds ().equals (image .getBounds ());
753
+ if (oldImage != null && !oldImage .isDisposed () && image != null && !image .isDisposed ()) {
754
+ changed = !oldImage .getBounds ().equals (image .getBounds ());
746
755
}
747
- parent .layout (changed );
748
- super .setImage (image );
749
- updateImages (getEnabled () && parent .getEnabled ());
756
+ return changed ;
750
757
}
751
758
752
759
boolean setRadioSelection (boolean value ) {
0 commit comments