Bug 568148

Summary: ImageList does not update image size
Product: [Eclipse Project] Platform Reporter: Christoph Laeubrich <laeubi>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: sravankumarl
Version: 4.14   
Target Milestone: ---   
Hardware: PC   
OS: Windows All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=569691
Whiteboard:

Description Christoph Laeubrich CLA 2020-10-23 04:02:15 EDT
Under Windows images of a ToolBar are manged inside an org.eclipse.swt.internal.ImageList.

The problem is that the ImageList.add(Image) only set the size for the FIRST image added to the list, so all images get shrinked (or zoomed) according to the first item added to the list. And even if all images are replaced by larger ones the first ever added ones size is used. This is very confusing.

Is there any reason not either:
- using the largest size of all images (update if necessary)
- using the smallest size of all images (update if necessary)
- keeping the size (don't know if possible under windows, at leas it works that way under linux)

If I understand the code right everything boils down to the set(...) method where the current size is determined and the images are explicitly scaled, so maybe if windows does not support variable size icons it could be emulated here by simply adding transparent borders around smaller ones?
Comment 1 Sravan Kumar Lakkimsetti CLA 2020-10-27 01:48:07 EDT
We had the same problem in Gtk port. we updated ImageList whenever there is a update in size.

Please take a look at MenuItem.setImage() method. there is code to manage the size whenever a image is scaled.