Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ private void addPlaceholderImageToImageList(long imageListHandle, int bitmapWidt
OS.ReleaseDC(0, hDC);
}

/**
*
* {@return size of Images in the ImageList in points}
*/
public Point getImageSize() {
int [] cx = new int [1], cy = new int [1];
OS.ImageList_GetIconSize (handle, cx, cy);
return new Point (cx [0], cy [0]);
return Win32DPIUtils.pixelToPoint(new Point (cx [0], cy [0]), zoom);
}

public int indexOf (Image image) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,7 @@ ImageList getImageList (int style, int width, int height, int zoom) {
imageList = newList;
}

ImageList list = new ImageList (style, width, height, zoom);
ImageList list = new ImageList (style, Win32DPIUtils.pointToPixel(width, zoom), Win32DPIUtils.pointToPixel(height, zoom), zoom);
imageList [i] = list;
list.addRef();
return list;
Expand Down Expand Up @@ -2092,7 +2092,7 @@ ImageList getImageListToolBar (int style, int width, int height, int zoom) {
toolImageList = newList;
}

ImageList list = new ImageList (style, width, height, zoom);
ImageList list = new ImageList (style, Win32DPIUtils.pointToPixel(width, zoom), Win32DPIUtils.pointToPixel(height, zoom), zoom);
toolImageList [i] = list;
list.addRef();
return list;
Expand Down Expand Up @@ -2122,7 +2122,7 @@ ImageList getImageListToolBarDisabled (int style, int width, int height, int zoo
toolDisabledImageList = newList;
}

ImageList list = new ImageList (style, width, height, zoom);
ImageList list = new ImageList (style, Win32DPIUtils.pointToPixel(width, zoom), Win32DPIUtils.pointToPixel(height, zoom), zoom);
toolDisabledImageList [i] = list;
list.addRef();
return list;
Expand Down Expand Up @@ -2152,7 +2152,7 @@ ImageList getImageListToolBarHot (int style, int width, int height, int zoom) {
toolHotImageList = newList;
}

ImageList list = new ImageList (style, width, height, zoom);
ImageList list = new ImageList (style, Win32DPIUtils.pointToPixel(width, zoom), Win32DPIUtils.pointToPixel(height, zoom), zoom);
toolHotImageList [i] = list;
list.addRef();
return list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ int imageIndex (Image image) {
*/
if (image == null) return -1;
if (imageList == null) {
Rectangle bounds = Win32DPIUtils.scaleBounds(image.getBounds(), this.getZoom(), 100);
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height, this.getZoom());
Rectangle boundsInPoints = image.getBounds();
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, boundsInPoints.width, boundsInPoints.height, getZoom());
int index = imageList.add (image);
long hImageList = imageList.getHandle(getZoom());
OS.SendMessage (handle, OS.TCM_SETIMAGELIST, 0, hImageList);
Expand Down Expand Up @@ -837,9 +837,9 @@ void updateOrientation () {
OS.SetWindowPos (handle, 0, 0, 0, width - 1, height - 1, OS.SWP_NOMOVE | OS.SWP_NOZORDER);
OS.SetWindowPos (handle, 0, 0, 0, width, height, OS.SWP_NOMOVE | OS.SWP_NOZORDER);
if (imageList != null) {
Point size = imageList.getImageSize ();
Point sizeInPoints = imageList.getImageSize();
display.releaseImageList (imageList);
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, size.x, size.y, this.getZoom());
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, this.getZoom());
long hImageList = imageList.getHandle(getZoom());
OS.SendMessage (handle, OS.TCM_SETIMAGELIST, 0, hImageList);
TCITEM tcItem = new TCITEM ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2849,8 +2849,8 @@ int imageIndex (Image image, int column) {
setSubImagesVisible (true);
}
if (imageList == null) {
Rectangle bounds = Win32DPIUtils.scaleBounds(image.getBounds(), this.getZoom(), 100);
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height, getZoom());
Rectangle boundsInPoints = image.getBounds();
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, boundsInPoints.width, boundsInPoints.height, getZoom());
int index = imageList.indexOf (image);
if (index == -1) index = imageList.add (image);
long hImageList = imageList.getHandle(getZoom());
Expand Down Expand Up @@ -2889,8 +2889,8 @@ int imageIndex (Image image, int column) {
int imageIndexHeader (Image image) {
if (image == null) return OS.I_IMAGENONE;
if (headerImageList == null) {
Rectangle bounds = Win32DPIUtils.scaleBounds(image.getBounds(), this.getZoom(), 100);
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height, getZoom());
Rectangle boundsInPoints = image.getBounds();
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, boundsInPoints.width, boundsInPoints.height, getZoom());
int index = headerImageList.indexOf (image);
if (index == -1) index = headerImageList.add (image);
long hImageList = headerImageList.getHandle(getZoom());
Expand Down Expand Up @@ -5576,9 +5576,9 @@ void updateOrientation () {
}
if ((style & SWT.CHECK) != 0) fixCheckboxImageListColor (false);
if (imageList != null) {
Point size = imageList.getImageSize ();
Point sizeInPoints = imageList.getImageSize();
display.releaseImageList (imageList);
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, size.x, size.y, getZoom());
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, getZoom());
int count = (int)OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
for (int i = 0; i < count; i++) {
TableItem item = _getItem (i, false);
Expand All @@ -5595,9 +5595,9 @@ void updateOrientation () {
}
if (hwndHeader != 0) {
if (headerImageList != null) {
Point size = headerImageList.getImageSize ();
Point sizeInPoints = headerImageList.getImageSize();
display.releaseImageList (headerImageList);
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, size.x, size.y, getZoom());
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, getZoom());
if (columns != null) {
for (int i = 0; i < columns.length; i++) {
TableColumn column = columns [i];
Expand Down Expand Up @@ -7297,7 +7297,7 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long lParam) {
if (image != null) {
Rectangle rect = Win32DPIUtils.pointToPixel(image.getBounds(), getZoom());
RECT imageRect = item.getBounds (pinfo.iItem, pinfo.iSubItem, false, true, false, false, hDC);
Point size = imageList == null ? new Point (rect.width, rect.height) : imageList.getImageSize ();
Point size = imageList == null ? new Point (rect.width, rect.height) : Win32DPIUtils.pointToPixel(imageList.getImageSize(), getZoom());
int y = imageRect.top + Math.max (0, (imageRect.bottom - imageRect.top - size.y) / 2);
int zoom = getZoom();
rect = Win32DPIUtils.pixelToPoint(rect, zoom);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1272,10 +1272,10 @@ String toolTipText (NMTTDISPINFO hdr) {
void updateOrientation () {
super.updateOrientation ();
if (imageList != null) {
Point size = imageList.getImageSize ();
ImageList newImageList = display.getImageListToolBar (style & SWT.RIGHT_TO_LEFT, size.x, size.y, getZoom());
ImageList newHotImageList = display.getImageListToolBarHot (style & SWT.RIGHT_TO_LEFT, size.x, size.y, getZoom());
ImageList newDisabledImageList = display.getImageListToolBarDisabled (style & SWT.RIGHT_TO_LEFT, size.x, size.y, getZoom());
Point sizeInPoints = imageList.getImageSize();
ImageList newImageList = display.getImageListToolBar (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, getZoom());
ImageList newHotImageList = display.getImageListToolBarHot (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, getZoom());
ImageList newDisabledImageList = display.getImageListToolBarDisabled (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, getZoom());
TBBUTTONINFO info = new TBBUTTONINFO ();
info.cbSize = TBBUTTONINFO.sizeof;
info.dwMask = OS.TBIF_IMAGE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1103,16 +1103,16 @@ void updateImages (boolean enabled) {
ImageList hotImageList = parent.getHotImageList ();
ImageList disabledImageList = parent.getDisabledImageList();
if (info.iImage == OS.I_IMAGENONE) {
Rectangle bounds = Win32DPIUtils.scaleBounds(image.getBounds(), getParent().getZoom(), 100);
Rectangle boundsInPoints = image.getBounds();
int listStyle = parent.style & SWT.RIGHT_TO_LEFT;
if (imageList == null) {
imageList = display.getImageListToolBar (listStyle, bounds.width, bounds.height, getZoom());
imageList = display.getImageListToolBar (listStyle, boundsInPoints.width, boundsInPoints.height, getZoom());
}
if (disabledImageList == null) {
disabledImageList = display.getImageListToolBarDisabled (listStyle, bounds.width, bounds.height, getZoom());
disabledImageList = display.getImageListToolBarDisabled (listStyle, boundsInPoints.width, boundsInPoints.height, getZoom());
}
if (hotImageList == null) {
hotImageList = display.getImageListToolBarHot (listStyle, bounds.width, bounds.height, getZoom());
hotImageList = display.getImageListToolBarHot (listStyle, boundsInPoints.width, boundsInPoints.height, getZoom());
}
Image disabled = disabledImage;
if (disabledImage == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3058,7 +3058,7 @@ public boolean getHeaderVisible () {
}

Point getImageSize () {
if (imageList != null) return imageList.getImageSize ();
if (imageList != null) return Win32DPIUtils.pointToPixel(imageList.getImageSize(), getZoom());
return new Point (0, getItemHeightInPixels ());
}

Expand Down Expand Up @@ -3740,8 +3740,8 @@ boolean hitTestSelection (long hItem, int x, int y) {
int imageIndex (Image image, int index) {
if (image == null) return OS.I_IMAGENONE;
if (imageList == null) {
Rectangle bounds = Win32DPIUtils.scaleBounds(image.getBounds(), this.getZoom(), 100);
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height, getZoom());
Rectangle boundsInPoints = image.getBounds();
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, boundsInPoints.width, boundsInPoints.height, getZoom());
}
int imageIndex = imageList.indexOf (image);
if (imageIndex == -1) imageIndex = imageList.add (image);
Expand All @@ -3764,8 +3764,8 @@ int imageIndex (Image image, int index) {
int imageIndexHeader (Image image) {
if (image == null) return OS.I_IMAGENONE;
if (headerImageList == null) {
Rectangle bounds = Win32DPIUtils.scaleBounds(image.getBounds(), this.getZoom(), 100);
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height, getZoom());
Rectangle boundsInPoints = image.getBounds();
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, boundsInPoints.width, boundsInPoints.height, getZoom());
int index = headerImageList.indexOf (image);
if (index == -1) index = headerImageList.add (image);
long hImageList = headerImageList.getHandle(getZoom());
Expand Down Expand Up @@ -5791,9 +5791,9 @@ void updateOrientation () {
}
if ((style & SWT.CHECK) != 0) setCheckboxImageList ();
if (imageList != null) {
Point size = imageList.getImageSize ();
Point sizeInPoints = imageList.getImageSize();
display.releaseImageList (imageList);
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, size.x, size.y, getZoom());
imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, getZoom());
for (TreeItem item : items) {
if (item != null) {
Image image = item.image;
Expand All @@ -5808,9 +5808,9 @@ void updateOrientation () {
}
if (hwndHeader != 0) {
if (headerImageList != null) {
Point size = headerImageList.getImageSize ();
Point sizeInPoints = headerImageList.getImageSize();
display.releaseImageList (headerImageList);
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, size.x, size.y, getZoom());
headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, sizeInPoints.x, sizeInPoints.y, getZoom());
if (columns != null) {
for (int i = 0; i < columns.length; i++) {
TreeColumn column = columns[i];
Expand Down
Loading