} if (newColumn != -1) { if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, newColumn, headerRect) != 0) { OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2); rect.left = headerRect.left; rect.right = headerRect.right; OS.InvalidateRect (hwnd, rect, true);
if (newColumn != -1) { if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, newColumn, headerRect) != 0) { OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2); rect.left = headerRect.left; rect.right = headerRect.right; OS.InvalidateRect (hwnd, rect, true); }
void setSortDirection (int direction) {	if (OS.COMCTL32_MAJOR >= 6) {		int index = parent.indexOf (this);		if (index == -1) return;		int hwnd = parent.handle;		int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);		HDITEM hdItem = new HDITEM ();		hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE;		OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);		switch (direction) {			case SWT.UP:				hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN);				hdItem.fmt |= OS.HDF_SORTUP;				break;			case SWT.DOWN:				hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTUP);				hdItem.fmt |= OS.HDF_SORTDOWN;				break;			case SWT.NONE:				hdItem.fmt &= ~(OS.HDF_SORTUP | OS.HDF_SORTDOWN);				if (image != null) {					hdItem.fmt |= OS.HDF_IMAGE;					hdItem.iImage = parent.imageIndexHeader (image);				} else {					hdItem.fmt &= ~OS.HDF_IMAGE;				}				break;		}		OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);		/* 		* Feature in Windows.  When LVM_SETBKCOLOR is used with		* CLR_NONE and LVM_SETSELECTEDCOLUMN is used to select		* a column, Windows fills the column with the selection		* color, drawing on top of the background image and any		* other custom drawing.  The fix is to avoid setting the		* selected column.		*/		if (OS.SendMessage (hwnd, OS.LVM_GETBKCOLOR, 0, 0) != OS.CLR_NONE) {			int oldColumn = OS.SendMessage (hwnd, OS.LVM_GETSELECTEDCOLUMN, 0, 0);			int newColumn = direction == SWT.NONE ? -1 : index;			OS.SendMessage (hwnd, OS.LVM_SETSELECTEDCOLUMN, newColumn, 0);			/* 			* Bug in Windows.  When LVM_SETSELECTEDCOLUMN is used to			* specify a selected column, Windows does not redraw either			* the new or the previous selected column.  The fix is to			* force a redraw of both.			*/			parent.forceResize ();			RECT rect = new RECT (), headerRect = new RECT ();			OS.GetClientRect (hwnd, rect);			if (oldColumn != -1) {				if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, oldColumn, headerRect) != 0) {					OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);					rect.left = headerRect.left;					rect.right = headerRect.right;					OS.InvalidateRect (hwnd, rect, true);				}			}			if (newColumn != -1) {				if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, newColumn, headerRect) != 0) {					OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);					rect.left = headerRect.left;					rect.right = headerRect.right;					OS.InvalidateRect (hwnd, rect, true);				}			}		}	} else {		switch (direction) {			case SWT.UP:			case SWT.DOWN:				setImage (display.getSortImage (direction), true, true);				break;			case SWT.NONE:				setImage (image, false, false);				break;		}	}}