void setImage (Image image, boolean sort, boolean right) { int index = parent.indexOf (this); if (index == -1) return; int hwnd = parent.handle; if (OS.COMCTL32_MAJOR < 6) { int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); HDITEM hdItem = new HDITEM (); hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE | OS.HDI_BITMAP; OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem); hdItem.fmt &= ~OS.HDF_BITMAP_ON_RIGHT; if (image != null) { if (sort) { hdItem.mask &= ~OS.HDI_IMAGE; hdItem.fmt &= ~OS.HDF_IMAGE; hdItem.fmt |= OS.HDF_BITMAP; hdItem.hbm = image.handle; } else { hdItem.mask &= ~OS.HDI_BITMAP; hdItem.fmt &= ~OS.HDF_BITMAP; hdItem.fmt |= OS.HDF_IMAGE; hdItem.iImage = parent.imageIndexHeader (image); } if (right) hdItem.fmt |= OS.HDF_BITMAP_ON_RIGHT; } else { hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_BITMAP); } OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem); } else { LVCOLUMN lvColumn = new LVCOLUMN (); lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE; OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, lvColumn); if (image != null) { lvColumn.fmt |= OS.LVCFMT_IMAGE; lvColumn.iImage = parent.imageIndexHeader (image); if (right) lvColumn.fmt |= OS.LVCFMT_BITMAP_ON_RIGHT; } else { lvColumn.fmt &= ~(OS.LVCFMT_IMAGE | OS.LVCFMT_BITMAP_ON_RIGHT); } OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
public void setImage (Image image) { checkWidget(); if (image != null && image.isDisposed ()) { error (SWT.ERROR_INVALID_ARGUMENT); } super.setImage (image); if (parent.sortColumn != this || parent.sortDirection != SWT.NULL) { setImage (image, false, false);
void setImage (Image image, boolean sort, boolean right) {	int index = parent.indexOf (this);	if (index == -1) return;	int hwnd = parent.handle;	if (OS.COMCTL32_MAJOR < 6) {		int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);		HDITEM hdItem = new HDITEM ();		hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE | OS.HDI_BITMAP;		OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);		hdItem.fmt &= ~OS.HDF_BITMAP_ON_RIGHT;		if (image != null) {			if (sort) {				hdItem.mask &= ~OS.HDI_IMAGE;				hdItem.fmt &= ~OS.HDF_IMAGE;				hdItem.fmt |= OS.HDF_BITMAP;				hdItem.hbm = image.handle;			} else {				hdItem.mask &= ~OS.HDI_BITMAP;				hdItem.fmt &= ~OS.HDF_BITMAP;				hdItem.fmt |= OS.HDF_IMAGE;				hdItem.iImage = parent.imageIndexHeader (image);			}			if (right) hdItem.fmt |= OS.HDF_BITMAP_ON_RIGHT;		} else {			hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_BITMAP);		}		OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);	} else {		LVCOLUMN lvColumn = new LVCOLUMN ();		lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE;		OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, lvColumn);		if (image != null) {			lvColumn.fmt |= OS.LVCFMT_IMAGE;			lvColumn.iImage = parent.imageIndexHeader (image);			if (right) lvColumn.fmt |= OS.LVCFMT_BITMAP_ON_RIGHT;		} else {			lvColumn.fmt &= ~(OS.LVCFMT_IMAGE | OS.LVCFMT_BITMAP_ON_RIGHT);		}		OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);	}}