*** empty log message ***
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index 458b2cd..8b5aa12 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -116,6 +116,7 @@
public static final int BIF_RETURNONLYFSDIRS = 0x1;
public static final int BIF_VALIDATE = 0x20;
public static final int BITSPIXEL = 0xc;
+ public static final int BLACKNESS = 0x42;
public static final int BM_CLICK = 0xf5;
public static final int BM_GETCHECK = 0xf0;
public static final int BM_SETCHECK = 0xf1;
@@ -341,6 +342,7 @@
public static final int HBMMENU_CALLBACK = 0xffffffff;
public static final int HDI_WIDTH = 0x1;
public static final int HDM_FIRST = 0x1200;
+ public static final int HDM_GETBITMAPMARGIN = HDM_FIRST + 21;
public static final int HDM_GETITEMCOUNT = 0x1200;
public static final int HDN_BEGINTRACK = IsUnicode ? 0xfffffeba : 0xfffffece;
public static final int HDN_BEGINTRACKW = 0xfffffeba;
@@ -453,9 +455,11 @@
public static final int LPSTR_TEXTCALLBACK = 0xffffffff;
public static final int LR_DEFAULTCOLOR = 0x0;
public static final int LVCFMT_CENTER = 0x2;
+ public static final int LVCFMT_IMAGE = 0x800;
public static final int LVCFMT_LEFT = 0x0;
public static final int LVCFMT_RIGHT = 0x1;
public static final int LVCF_FMT = 0x1;
+ public static final int LVCF_IMAGE = 0x10;
public static final int LVCF_TEXT = 0x4;
public static final int LVCF_WIDTH = 0x2;
public static final int LVHT_ONITEM = 0xe;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java
index a859d2a..ca3f8b0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java
@@ -137,18 +137,22 @@
int createMask (int hBitmap, int width, int height, int background) {
int hMask = OS.CreateBitmap (width, height, 1, 1, null);
+ int hDC = OS.GetDC (0);
+ int hdc1 = OS.CreateCompatibleDC (hDC);
if (background != -1) {
- int hDC = OS.GetDC (0);
- int hdc1 = OS.CreateCompatibleDC (hDC);
OS.SelectObject (hdc1, hBitmap);
int hdc2 = OS.CreateCompatibleDC (hDC);
OS.SelectObject (hdc2, hMask);
OS.SetBkColor (hdc1, background);
OS.BitBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, OS.SRCCOPY);
- OS.ReleaseDC (0, hDC);
- OS.DeleteDC (hdc1);
OS.DeleteDC (hdc2);
+ } else {
+ int hOldBitmap = OS.SelectObject (hdc1, hMask);
+ OS.PatBlt (hdc1, 0, 0, width, height, OS.BLACKNESS);
+ OS.SelectObject (hdc1, hOldBitmap);
}
+ OS.ReleaseDC (0, hDC);
+ OS.DeleteDC (hdc1);
return hMask;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index bb7b022..4293f9a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -246,6 +246,8 @@
LVCOLUMN lvColumn = new LVCOLUMN ();
lvColumn.mask = OS.LVCF_WIDTH;
OS.SendMessage (handle, OS.LVM_INSERTCOLUMN, 1, lvColumn);
+ OS.SendMessage (handle, OS.LVM_GETCOLUMN, 1, lvColumn);
+ int width = lvColumn.cx;
int cchTextMax = 1024;
int hHeap = OS.GetProcessHeap ();
int byteCount = cchTextMax * TCHAR.sizeof;
@@ -266,11 +268,19 @@
lvItem.iImage = OS.I_IMAGENONE;
OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem);
}
- lvColumn.mask = OS.LVCF_TEXT | OS.LVCF_WIDTH | OS.LVCF_FMT;
+ lvColumn.mask = OS.LVCF_TEXT | OS.LVCF_IMAGE | OS.LVCF_WIDTH | OS.LVCF_FMT;
lvColumn.pszText = pszText;
lvColumn.cchTextMax = cchTextMax;
OS.SendMessage (handle, OS.LVM_GETCOLUMN, 0, lvColumn);
OS.SendMessage (handle, OS.LVM_SETCOLUMN, 1, lvColumn);
+ lvColumn.fmt = OS.LVCFMT_IMAGE;
+ lvColumn.cx = width;
+ lvColumn.iImage = OS.I_IMAGENONE;
+ lvColumn.pszText = lvColumn.cchTextMax = 0;
+ OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn);
+ lvColumn.mask = OS.LVCF_FMT;
+ lvColumn.fmt = OS.LVCFMT_LEFT;
+ OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn);
if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
}
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
index d2be76f..0a2f12a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
@@ -266,11 +266,26 @@
if (index == -1) return;
int hwnd = parent.handle;
TCHAR buffer = new TCHAR (parent.getCodePage (), text, true);
- int headerWidth = OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer);
+ int headerWidth = OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + 10;
+ if (image != null) {
+ int margin = 0;
+ if ((COMCTL32_MAJOR << 16 | COMCTL32_MINOR) >= (5 << 16 | 80)) {
+ int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
+ margin = OS.SendMessage (hwndHeader, OS.HDM_GETBITMAPMARGIN, 0, 0);
+ } else {
+ margin = OS.GetSystemMetrics (OS.SM_CXEDGE) * 3;
+ }
+ Rectangle rect = image.getBounds ();
+ headerWidth += rect.width + margin * 2;
+ }
OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, OS.LVSCW_AUTOSIZE);
int columnWidth = OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0);
if (headerWidth > columnWidth) {
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, OS.LVSCW_AUTOSIZE_USEHEADER);
+ if (image == null) {
+ OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, OS.LVSCW_AUTOSIZE_USEHEADER);
+ } else {
+ OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, headerWidth);
+ }
}
}
@@ -364,6 +379,29 @@
OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
}
+public void setImage (Image image) {
+ checkWidget();
+ if (image != null && image.isDisposed ()) {
+ error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ super.setImage (image);
+ int hwnd = parent.handle;
+ LVCOLUMN lvColumn = new LVCOLUMN ();
+ lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE;
+ lvColumn.fmt = OS.LVCFMT_IMAGE;
+ lvColumn.iImage = parent.imageIndex (image);
+ OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
+ if (image == null) {
+ lvColumn.mask = OS.LVCF_FMT;
+ if ((style & SWT.LEFT) == SWT.LEFT) lvColumn.fmt = OS.LVCFMT_LEFT;
+ if ((style & SWT.CENTER) == SWT.CENTER) lvColumn.fmt = OS.LVCFMT_CENTER;
+ if ((style & SWT.RIGHT) == SWT.RIGHT) lvColumn.fmt = OS.LVCFMT_RIGHT;
+ OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
+ }
+}
+
/**
* Sets the resizable attribute. A column that is
* not resizable cannot be dragged by the user but