Bug 568148 - ImageList does not update image size
Summary: ImageList does not update image size
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-23 04:02 EDT by Christoph Laeubrich CLA
Modified: 2020-12-22 06:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.