# HG changeset patch # User Frank Benoit # Date 1202151690 -3600 # Node ID 3f4e6a4ecc093b97505f50672c0e17915887045d # Parent 774d936d13808169bff8e816a05c6e4ae4a7da77 Table, TableItem, TableColumn diff -r 774d936d1380 -r 3f4e6a4ecc09 dwt/internal/win32/OS.d --- a/dwt/internal/win32/OS.d Mon Feb 04 16:26:54 2008 +0100 +++ b/dwt/internal/win32/OS.d Mon Feb 04 20:01:30 2008 +0100 @@ -1696,8 +1696,8 @@ public static const int TME_QUERY = 0x40000000; public static const int TMPF_VECTOR = 0x2; public static const int TMT_CONTENTMARGINS = 3602; - public static const char[] TOOLBARCLASSNAME = "ToolbarWindow32"; //$NON-NLS-1$ - public static const char[] TOOLTIPS_CLASS = "tooltips_class32"; //$NON-NLS-1$ + public static const TCHAR[] TOOLBARCLASSNAME = "ToolbarWindow32"; //$NON-NLS-1$ + public static const TCHAR[] TOOLTIPS_CLASS = "tooltips_class32"; //$NON-NLS-1$ public static const int TP_BUTTON = 1; public static const int TP_DROPDOWNBUTTON = 2; public static const int TP_SPLITBUTTON = 3; @@ -4534,6 +4534,7 @@ alias WINAPI.SetWindowPlacement SetWindowPlacement; alias WINAPI.SetWindowPos SetWindowPos; alias WINAPI.SetWindowRgn SetWindowRgn; +alias WINAPI.SetWindowTheme SetWindowTheme; alias STDWIN.SetWorldTransform SetWorldTransform; alias WINAPI.SetWindowTextA SetWindowTextA; alias WINAPI.SetWindowTextW SetWindowTextW; diff -r 774d936d1380 -r 3f4e6a4ecc09 dwt/internal/win32/WINAPI.d --- a/dwt/internal/win32/WINAPI.d Mon Feb 04 16:26:54 2008 +0100 +++ b/dwt/internal/win32/WINAPI.d Mon Feb 04 20:01:30 2008 +0100 @@ -148,6 +148,11 @@ LPCRECT pBoundingRect, LPRECT pExtentRect ); +HRESULT SetWindowTheme( + HWND hwnd, + LPCWSTR pszSubAppName, + LPCWSTR pszSubIdList +); } //-------------------------------------------------------------------------------------- diff -r 774d936d1380 -r 3f4e6a4ecc09 dwt/internal/win32/WINTYPES.d --- a/dwt/internal/win32/WINTYPES.d Mon Feb 04 16:26:54 2008 +0100 +++ b/dwt/internal/win32/WINTYPES.d Mon Feb 04 20:01:30 2008 +0100 @@ -57,6 +57,14 @@ NMHDR hdr; LITEM item; } +struct NMLVODSTATECHANGE { + NMHDR hdr; + int iFrom; + int iTo; + UINT uNewState; + UINT uOldState; +} + // .... //-------------------------------------------------------------------------------- diff -r 774d936d1380 -r 3f4e6a4ecc09 dwt/widgets/Shell.d --- a/dwt/widgets/Shell.d Mon Feb 04 16:26:54 2008 +0100 +++ b/dwt/widgets/Shell.d Mon Feb 04 20:01:30 2008 +0100 @@ -510,7 +510,7 @@ void createBalloonTipHandle () { balloonTipHandle_ = OS.CreateWindowEx ( 0, - StrToTCHARz( OS.TOOLTIPS_CLASS ), + OS.TOOLTIPS_CLASS.ptr, null, OS.TTS_ALWAYSTIP | OS.TTS_BALLOON, OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0, @@ -618,7 +618,7 @@ void createToolTipHandle () { toolTipHandle_ = OS.CreateWindowEx ( 0, - StrToTCHARz( OS.TOOLTIPS_CLASS ), + OS.TOOLTIPS_CLASS.ptr, null, OS.TTS_ALWAYSTIP, OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0, diff -r 774d936d1380 -r 3f4e6a4ecc09 dwt/widgets/Table.d --- a/dwt/widgets/Table.d Mon Feb 04 16:26:54 2008 +0100 +++ b/dwt/widgets/Table.d Mon Feb 04 20:01:30 2008 +0100 @@ -10,13 +10,6 @@ *******************************************************************************/ module dwt.widgets.Table; -import dwt.widgets.Composite; -class Table : Composite { -} -/++ - -//import java.util.*; - import dwt.DWT; import dwt.DWTException; import dwt.events.SelectionEvent; @@ -28,32 +21,19 @@ import dwt.graphics.Point; import dwt.graphics.Rectangle; import dwt.internal.ImageList; -import dwt.internal.win32.HDHITTESTINFO; -import dwt.internal.win32.HDITEM; -import dwt.internal.win32.LRESULT; -import dwt.internal.win32.LVCOLUMN; -import dwt.internal.win32.LVHITTESTINFO; -import dwt.internal.win32.LVITEM; -import dwt.internal.win32.MEASUREITEMSTRUCT; -import dwt.internal.win32.NMHDR; -import dwt.internal.win32.NMHEADER; -import dwt.internal.win32.NMLISTVIEW; -import dwt.internal.win32.NMLVCUSTOMDRAW; -import dwt.internal.win32.NMLVDISPINFO; -import dwt.internal.win32.NMLVODSTATECHANGE; -import dwt.internal.win32.NMRGINFO; -import dwt.internal.win32.NMTTDISPINFO; import dwt.internal.win32.OS; -import dwt.internal.win32.PAINTSTRUCT; -import dwt.internal.win32.POINT; -import dwt.internal.win32.RECT; -import dwt.internal.win32.SCROLLINFO; -import dwt.internal.win32.TCHAR; -import dwt.internal.win32.TEXTMETRIC; -import dwt.internal.win32.TEXTMETRICA; -import dwt.internal.win32.TEXTMETRICW; -import dwt.internal.win32.TOOLINFO; -import dwt.internal.win32.WNDCLASS; + +import dwt.widgets.Composite; +import dwt.widgets.TableItem; +import dwt.widgets.TableColumn; +import dwt.widgets.Listener; +import dwt.widgets.TypedListener; +import dwt.widgets.Event; +import dwt.widgets.Control; +import dwt.widgets.Display; + +import dwt.dwthelper.utils; + /** * Instances of this class implement a selectable user interface @@ -100,7 +80,7 @@ *

*/ -public class Table extends Composite { +public class Table : Composite { alias Composite.computeSize computeSize; alias Composite.setBackgroundImage setBackgroundImage; @@ -117,21 +97,22 @@ bool ignoreCustomDraw, ignoreDrawForeground, ignoreDrawBackground, ignoreDrawFocus, ignoreDrawSelection, ignoreDrawHot; bool customDraw, dragStarted, explorerTheme, firstColumnImage, fixScrollWidth, tipRequested, wasSelected, wasResized; bool ignoreActivate, ignoreSelect, ignoreShrink, ignoreResize, ignoreColumnMove, ignoreColumnResize; - int headerToolTipHandle, itemHeight, lastIndexOf, lastWidth, sortDirection, resizeCount, selectionForeground, hotIndex; - static /*final*/ int HeaderProc; - static final int INSET = 4; - static final int GRID_WIDTH = 1; - static final int SORT_WIDTH = 10; - static final int HEADER_MARGIN = 12; - static final int HEADER_EXTRA = 3; - static final int VISTA_EXTRA = 2; - static final int EXPLORER_EXTRA = 2; - static final bool EXPLORER_THEME = true; - static final int TableProc; - static final TCHAR TableClass = new TCHAR (0, OS.WC_LISTVIEW, true); - static { - WNDCLASS lpWndClass = new WNDCLASS (); - OS.GetClassInfo (0, TableClass, lpWndClass); + HWND headerToolTipHandle; + int itemHeight, lastIndexOf, lastWidth, sortDirection, resizeCount, selectionForeground, hotIndex; + static /*final*/ WNDPROC HeaderProc; + static const int INSET = 4; + static const int GRID_WIDTH = 1; + static const int SORT_WIDTH = 10; + static const int HEADER_MARGIN = 12; + static const int HEADER_EXTRA = 3; + static const int VISTA_EXTRA = 2; + static const int EXPLORER_EXTRA = 2; + static const bool EXPLORER_THEME = true; + static const WNDPROC TableProc; + static const TCHAR[] TableClass = OS.WC_LISTVIEW; + static this() { + WNDCLASS lpWndClass; + OS.GetClassInfo (null, TableClass.ptr, &lpWndClass); TableProc = lpWndClass.lpfnWndProc; } @@ -168,7 +149,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public Table (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); } @@ -228,14 +209,14 @@ addListener (DWT.DefaultSelection,typedListener); } -override int callWindowProc (int hwnd, int msg, int wParam, int lParam) { +override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { return callWindowProc (hwnd, msg, wParam, lParam, false); } -int callWindowProc (int hwnd, int msg, int wParam, int lParam, bool forceSelect) { - if (handle is 0) return 0; +LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam, bool forceSelect) { + if (handle is null) return LRESULT.ZERO; if (handle !is hwnd) { - return OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam); + return cast(LRESULT) OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam); } int topIndex = 0; bool checkSelection = false, checkActivate = false, redraw = false; @@ -333,8 +314,8 @@ if (redraw) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); OS.InvalidateRect (handle, null, true); - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - if (hwndHeader !is 0) OS.InvalidateRect (hwndHeader, null, true); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + if (hwndHeader !is null) OS.InvalidateRect (hwndHeader, null, true); } //FALL THROUGH @@ -367,7 +348,7 @@ } } } - return code; + return cast(LRESULT) code; } static int checkStyle (int style) { @@ -382,11 +363,11 @@ return checkBits (style, DWT.SINGLE, DWT.MULTI, 0, 0, 0, 0); } -LRESULT CDDS_ITEMPOSTPAINT (NMLVCUSTOMDRAW nmcd, int wParam, int lParam) { - int hDC = nmcd.hdc; +LRESULT CDDS_ITEMPOSTPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) { + auto hDC = nmcd.nmcd.hdc; if (explorerTheme && !ignoreCustomDraw) { hotIndex = -1; - if (hooks (DWT.EraseItem) && nmcd.left !is nmcd.right) { + if (hooks (DWT.EraseItem) && nmcd.nmcd.rc.left !is nmcd.nmcd.rc.right) { OS.RestoreDC (hDC, -1); } } @@ -402,36 +383,36 @@ * it is necessary to draw the focus rectangle after the * item has been drawn. */ - if (!ignoreCustomDraw && !ignoreDrawFocus && nmcd.left !is nmcd.right) { + if (!ignoreCustomDraw && !ignoreDrawFocus && nmcd.nmcd.rc.left !is nmcd.nmcd.rc.right) { if (OS.IsWindowVisible (handle) && OS.IsWindowEnabled (handle)) { if (!explorerTheme && (style & DWT.FULL_SELECTION) !is 0) { if (OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) is OS.CLR_NONE) { int dwExStyle = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) is 0) { // if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { - if (OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED) is nmcd.dwItemSpec) { + if (OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED) is nmcd.nmcd.dwItemSpec) { if (handle is OS.GetFocus ()) { int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); if ((uiState & OS.UISF_HIDEFOCUS) is 0) { - RECT rect = new RECT (); + RECT rect; rect.left = OS.LVIR_BOUNDS; bool oldIgnore = ignoreCustomDraw; ignoreCustomDraw = true; - OS.SendMessage (handle, OS. LVM_GETITEMRECT, nmcd.dwItemSpec, rect); - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + OS.SendMessage (handle, OS. LVM_GETITEMRECT, nmcd.nmcd.dwItemSpec, &rect); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0); - RECT itemRect = new RECT (); + RECT itemRect; if (index is 0) { itemRect.left = OS.LVIR_LABEL; - OS.SendMessage (handle, OS. LVM_GETITEMRECT, index, itemRect); + OS.SendMessage (handle, OS. LVM_GETITEMRECT, index, &itemRect); } else { itemRect.top = index; itemRect.left = OS.LVIR_ICON; - OS.SendMessage (handle, OS. LVM_GETSUBITEMRECT, nmcd.dwItemSpec, itemRect); + OS.SendMessage (handle, OS. LVM_GETSUBITEMRECT, nmcd.nmcd.dwItemSpec, &itemRect); } ignoreCustomDraw = oldIgnore; rect.left = itemRect.left; - OS.DrawFocusRect (nmcd.hdc, rect); + OS.DrawFocusRect (nmcd.nmcd.hdc, &rect); } } } @@ -440,10 +421,10 @@ } } } - return null; + return LRESULT.NULL; } -LRESULT CDDS_ITEMPREPAINT (NMLVCUSTOMDRAW nmcd, int wParam, int lParam) { +LRESULT CDDS_ITEMPREPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) { /* * Bug in Windows. When the table has the extended style * LVS_EX_FULLROWSELECT and LVM_SETBKCOLOR is used with @@ -462,9 +443,9 @@ if (OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) is OS.CLR_NONE) { int dwExStyle = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) is 0) { - if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { - nmcd.uItemState &= ~OS.CDIS_FOCUS; - OS.MoveMemory (lParam, nmcd, NMLVCUSTOMDRAW.sizeof); + if ((nmcd.nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { + nmcd.nmcd.uItemState &= ~OS.CDIS_FOCUS; + OS.MoveMemory (cast(NMLVCUSTOMDRAW*)lParam, nmcd, NMLVCUSTOMDRAW.sizeof); } } } @@ -472,19 +453,19 @@ } } if (explorerTheme && !ignoreCustomDraw) { - hotIndex = (nmcd.uItemState & OS.CDIS_HOT) !is 0 ? nmcd.dwItemSpec : -1; - if (hooks (DWT.EraseItem) && nmcd.left !is nmcd.right) { - OS.SaveDC (nmcd.hdc); - int hrgn = OS.CreateRectRgn (0, 0, 0, 0); - OS.SelectClipRgn (nmcd.hdc, hrgn); + hotIndex = (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0 ? nmcd.nmcd.dwItemSpec : -1; + if (hooks (DWT.EraseItem) && nmcd.nmcd.rc.left !is nmcd.nmcd.rc.right) { + OS.SaveDC (nmcd.nmcd.hdc); + auto hrgn = OS.CreateRectRgn (0, 0, 0, 0); + OS.SelectClipRgn (nmcd.nmcd.hdc, hrgn); OS.DeleteObject (hrgn); } } - return new LRESULT (OS.CDRF_NOTIFYSUBITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); + return cast(LRESULT) (OS.CDRF_NOTIFYSUBITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); } -LRESULT CDDS_POSTPAINT (NMLVCUSTOMDRAW nmcd, int wParam, int lParam) { - if (ignoreCustomDraw) return null; +LRESULT CDDS_POSTPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) { + if (ignoreCustomDraw) return LRESULT.NULL; /* * Bug in Windows. When the table has the extended style * LVS_EX_FULLROWSELECT and LVM_SETBKCOLOR is used with @@ -500,13 +481,13 @@ if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) is 0) { int bits = OS.LVS_EX_FULLROWSELECT; if (OS.IsWinCE) { - RECT rect = new RECT (); - bool damaged = OS.GetUpdateRect (handle, rect, true); + RECT rect; + bool damaged = cast(bool) OS.GetUpdateRect (handle, &rect, true); OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits); OS.ValidateRect (handle, null); - if (damaged) OS.InvalidateRect (handle, rect, true); + if (damaged) OS.InvalidateRect (handle, &rect, true); } else { - int rgn = OS.CreateRectRgn (0, 0, 0, 0); + auto rgn = OS.CreateRectRgn (0, 0, 0, 0); int result = OS.GetUpdateRgn (handle, rgn, true); OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits); OS.ValidateRect (handle, null); @@ -517,12 +498,12 @@ } } } - return null; + return LRESULT.NULL; } -LRESULT CDDS_PREPAINT (NMLVCUSTOMDRAW nmcd, int wParam, int lParam) { +LRESULT CDDS_PREPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) { if (ignoreCustomDraw) { - return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); + return cast(LRESULT) (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); } /* * Bug in Windows. When the table has the extended style @@ -539,13 +520,13 @@ if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) !is 0) { int bits = OS.LVS_EX_FULLROWSELECT; if (OS.IsWinCE) { - RECT rect = new RECT (); - bool damaged = OS.GetUpdateRect (handle, rect, true); + RECT rect; + bool damaged = cast(bool) OS.GetUpdateRect (handle, &rect, true); OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0); OS.ValidateRect (handle, null); - if (damaged) OS.InvalidateRect (handle, rect, true); + if (damaged) OS.InvalidateRect (handle, &rect, true); } else { - int rgn = OS.CreateRectRgn (0, 0, 0, 0); + auto rgn = OS.CreateRectRgn (0, 0, 0, 0); int result = OS.GetUpdateRgn (handle, rgn, true); OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0); OS.ValidateRect (handle, null); @@ -565,44 +546,44 @@ * The fix is to draw the background using custom draw. */ if (explorerTheme && columnCount is 0) { - int hDC = nmcd.hdc; - RECT rect = new RECT (); - OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); + auto hDC = nmcd.nmcd.hdc; + RECT rect; + OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); if (OS.IsWindowEnabled (handle) || findImageControl () !is null) { - drawBackground (hDC, rect); + drawBackground (hDC, &rect); } else { - fillBackground (hDC, OS.GetSysColor (OS.COLOR_3DFACE), rect); + fillBackground (hDC, OS.GetSysColor (OS.COLOR_3DFACE), &rect); } draw = false; } if (draw) { Control control = findBackgroundControl (); if (control !is null && control.backgroundImage !is null) { - RECT rect = new RECT (); - OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); - fillImageBackground (nmcd.hdc, control, rect); + RECT rect; + OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); + fillImageBackground (nmcd.nmcd.hdc, control, &rect); } else { if (OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) is OS.CLR_NONE) { if (OS.IsWindowEnabled (handle)) { - RECT rect = new RECT (); - OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); + RECT rect; + OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); if (control is null) control = this; - fillBackground (nmcd.hdc, control.getBackgroundPixel (), rect); + fillBackground (nmcd.nmcd.hdc, control.getBackgroundPixel (), &rect); if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { if (sortColumn !is null && sortDirection !is DWT.NONE) { int index = indexOf (sortColumn); if (index !is -1) { parent.forceResize (); int clrSortBk = getSortColumnPixel (); - RECT columnRect = new RECT (), headerRect = new RECT (); - OS.GetClientRect (handle, columnRect); - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect) !is 0) { - OS.MapWindowPoints (hwndHeader, handle, headerRect, 2); + RECT columnRect, headerRect; + OS.GetClientRect (handle, &columnRect); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect) !is 0) { + OS.MapWindowPoints (hwndHeader, handle, cast(POINT*) &headerRect, 2); columnRect.left = headerRect.left; columnRect.right = headerRect.right; - if (OS.IntersectRect(columnRect, columnRect, rect)) { - fillBackground (nmcd.hdc, clrSortBk, columnRect); + if (OS.IntersectRect(&columnRect, &columnRect, &rect)) { + fillBackground (nmcd.nmcd.hdc, clrSortBk, &columnRect); } } } @@ -613,13 +594,13 @@ } } } - return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); + return cast(LRESULT) (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); } -LRESULT CDDS_SUBITEMPOSTPAINT (NMLVCUSTOMDRAW nmcd, int wParam, int lParam) { - if (ignoreCustomDraw) return null; - if (nmcd.left is nmcd.right) return new LRESULT (OS.CDRF_DODEFAULT); - int hDC = nmcd.hdc; +LRESULT CDDS_SUBITEMPOSTPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) { + if (ignoreCustomDraw) return LRESULT.NULL; + if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return cast(LRESULT) (OS.CDRF_DODEFAULT); + auto hDC = nmcd.nmcd.hdc; if (ignoreDrawForeground) OS.RestoreDC (hDC, -1); if (OS.IsWindowVisible (handle)) { /* @@ -634,7 +615,8 @@ int oldColumn = OS.SendMessage (handle, OS.LVM_GETSELECTEDCOLUMN, 0, 0); if (oldColumn is -1) { int newColumn = indexOf (sortColumn); - int result = 0, rgn = 0; + int result = 0; + HRGN rgn; if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { rgn = OS.CreateRectRgn (0, 0, 0, 0); result = OS.GetUpdateRgn (handle, rgn, true); @@ -650,17 +632,17 @@ } } if (hooks (DWT.PaintItem)) { - TableItem item = _getItem (nmcd.dwItemSpec); + TableItem item = _getItem (nmcd.nmcd.dwItemSpec); sendPaintItemEvent (item, nmcd); //widget could be disposed at this point } } - return null; + return LRESULT.NULL; } -LRESULT CDDS_SUBITEMPREPAINT (NMLVCUSTOMDRAW nmcd, int wParam, int lParam) { - int hDC = nmcd.hdc; - if (explorerTheme && !ignoreCustomDraw && hooks (DWT.EraseItem) && (nmcd.left !is nmcd.right)) { +LRESULT CDDS_SUBITEMPREPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) { + auto hDC = nmcd.nmcd.hdc; + if (explorerTheme && !ignoreCustomDraw && hooks (DWT.EraseItem) && (nmcd.nmcd.rc.left !is nmcd.nmcd.rc.right)) { OS.RestoreDC (hDC, -1); } /* @@ -671,25 +653,25 @@ * has been added to the array. The fix is to check for * null. */ - TableItem item = _getItem (nmcd.dwItemSpec); - if (item is null) return null; - int hFont = item.cellFont !is null ? item.cellFont [nmcd.iSubItem] : -1; - if (hFont is -1) hFont = item.font; - if (hFont !is -1) OS.SelectObject (hDC, hFont); - if (ignoreCustomDraw || (nmcd.left is nmcd.right)) { - return new LRESULT (hFont is -1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT); + TableItem item = _getItem (nmcd.nmcd.dwItemSpec); + if (item is null) return LRESULT.NULL; + HFONT hFont = item.cellFont !is null ? item.cellFont [nmcd.iSubItem] : cast(HFONT)-1; + if (hFont is cast(HFONT)-1) hFont = item.font; + if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); + if (ignoreCustomDraw || (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right)) { + return cast(LRESULT) (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT); } int code = OS.CDRF_DODEFAULT; selectionForeground = -1; ignoreDrawForeground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawBackground = false; if (OS.IsWindowVisible (handle)) { if (hooks (DWT.MeasureItem)) { - sendMeasureItemEvent (item, nmcd.dwItemSpec, nmcd.iSubItem, nmcd.hdc); - if (isDisposed () || item.isDisposed ()) return null; + sendMeasureItemEvent (item, nmcd.nmcd.dwItemSpec, nmcd.iSubItem, nmcd.nmcd.hdc); + if (isDisposed () || item.isDisposed ()) return LRESULT.NULL; } if (hooks (DWT.EraseItem)) { sendEraseItemEvent (item, nmcd, lParam); - if (isDisposed () || item.isDisposed ()) return null; + if (isDisposed () || item.isDisposed ()) return LRESULT.NULL; code |= OS.CDRF_NOTIFYPOSTPAINT; } if (ignoreDrawForeground || hooks (DWT.PaintItem)) code |= OS.CDRF_NOTIFYPOSTPAINT; @@ -716,11 +698,11 @@ * even for items that are not selected. The fix is to get * the selection state from the item. */ - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_STATE; lvItem.stateMask = OS.LVIS_SELECTED; - lvItem.iItem = nmcd.dwItemSpec; - int result = OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem); + lvItem.iItem = nmcd.nmcd.dwItemSpec; + int result = OS.SendMessage (handle, OS.LVM_GETITEM, 0, &lvItem); if ((result !is 0 && (lvItem.state & OS.LVIS_SELECTED) !is 0)) { int clrSelection = -1; if (nmcd.iSubItem is 0) { @@ -742,8 +724,8 @@ } } if (clrSelection !is -1) { - RECT rect = item.getBounds (nmcd.dwItemSpec, nmcd.iSubItem, true, nmcd.iSubItem !is 0, true, false, hDC); - fillBackground (hDC, clrSelection, rect); + RECT rect = item.getBounds (nmcd.nmcd.dwItemSpec, nmcd.iSubItem, true, nmcd.iSubItem !is 0, true, false, hDC); + fillBackground (hDC, clrSelection, &rect); } } } @@ -758,15 +740,15 @@ * attribute could have changed. */ bool hasAttributes = true; - if (hFont is -1 && clrText is -1 && clrTextBk is -1) { + if (hFont is cast(HFONT)-1 && clrText is -1 && clrTextBk is -1) { if (item.cellForeground is null && item.cellBackground is null && item.cellFont is null) { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); if (count is 1) hasAttributes = false; } } if (hasAttributes) { - if (hFont is -1) hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); + if (hFont is cast(HFONT)-1) hFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); OS.SelectObject (hDC, hFont); if (OS.IsWindowEnabled (handle)) { nmcd.clrText = clrText is -1 ? getForegroundPixel () : clrText; @@ -799,7 +781,8 @@ if (clrTextBk !is -1) { int oldColumn = OS.SendMessage (handle, OS.LVM_GETSELECTEDCOLUMN, 0, 0); if (oldColumn !is -1 && oldColumn is nmcd.iSubItem) { - int result = 0, rgn = 0; + int result = 0; + HRGN rgn; if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { rgn = OS.CreateRectRgn (0, 0, 0, 0); result = OS.GetUpdateRgn (handle, rgn, true); @@ -825,11 +808,11 @@ } else { nmcd.clrTextBk = OS.GetSysColor (OS.COLOR_3DFACE); } - nmcd.uItemState &= ~OS.CDIS_SELECTED; + nmcd.nmcd.uItemState &= ~OS.CDIS_SELECTED; OS.MoveMemory (lParam, nmcd, NMLVCUSTOMDRAW.sizeof); code |= OS.CDRF_NEWFONT; } - return new LRESULT (code); + return cast(LRESULT) (code); } override void checkBuffered () { @@ -864,9 +847,9 @@ return true; } -override bool checkHandle (int hwnd) { +override bool checkHandle (HWND hwnd) { if (hwnd is handle) return true; - return hwnd is OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + return hwnd is cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); } override protected void checkSubclass () { @@ -913,11 +896,11 @@ * cached bounds. */ if ((style & DWT.VIRTUAL) is 0 && item.cached) { - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_TEXT | OS.LVIF_INDENT; lvItem.pszText = OS.LPSTR_TEXTCALLBACK; lvItem.iItem = index; - OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEM, 0, &lvItem); item.cached = false; } if (currentItem is null && drawCount is 0 && OS.IsWindowVisible (handle)) { @@ -960,7 +943,7 @@ if (start is 0 && end is count - 1) { clearAll (); } else { - LVITEM lvItem = null; + LVITEM lvItem; bool cleared = false; for (int i=start; i<=end; i++) { TableItem item = items [i]; @@ -981,13 +964,13 @@ * cached bounds. */ if ((style & DWT.VIRTUAL) is 0 && item.cached) { - if (lvItem is null) { - lvItem = new LVITEM (); + //if (lvItem is null) { + //lvItem = new LVITEM (); lvItem.mask = OS.LVIF_TEXT | OS.LVIF_INDENT; lvItem.pszText = OS.LPSTR_TEXTCALLBACK; - } + //} lvItem.iItem = i; - OS.SendMessage (handle, OS.LVM_SETITEM, 0, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEM, 0, &lvItem); item.cached = false; } } @@ -1034,7 +1017,7 @@ error (DWT.ERROR_INVALID_RANGE); } } - LVITEM lvItem = null; + LVITEM lvItem; bool cleared = false; for (int i=0; i= OS.VERSION (6, 0)) { explorerTheme = true; - OS.SetWindowTheme (handle, Display.EXPLORER, null); + OS.SetWindowTheme (handle, Display.EXPLORER.ptr, null); } } /* Get the header window proc */ - if (HeaderProc is 0) { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - HeaderProc = OS.GetWindowLong (hwndHeader, OS.GWL_WNDPROC); + if (HeaderProc is null) { + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + HeaderProc = cast(WNDPROC) OS.GetWindowLong (hwndHeader, OS.GWL_WNDPROC); } /* @@ -1221,7 +1204,7 @@ * not have the problem). This is the recommended work * around from the MSDN. */ - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { if (OS.COMCTL32_MAJOR < 6) { OS.SendMessage (handle, OS.CCM_SETVERSION, 5, 0); } @@ -1256,7 +1239,7 @@ * The control will not destroy a font that it did not * create. */ - int hFont = OS.GetStockObject (OS.SYSTEM_FONT); + auto hFont = OS.GetStockObject (OS.SYSTEM_FONT); OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0); /* @@ -1266,12 +1249,12 @@ * The fix is to set the text to an empty string when * the column is inserted. */ - LVCOLUMN lvColumn = new LVCOLUMN (); + LVCOLUMN lvColumn; lvColumn.mask = OS.LVCF_TEXT | OS.LVCF_WIDTH; - int hHeap = OS.GetProcessHeap (); - int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); + auto hHeap = OS.GetProcessHeap (); + auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); lvColumn.pszText = pszText; - OS.SendMessage (handle, OS.LVM_INSERTCOLUMN, 0, lvColumn); + OS.SendMessage (handle, OS.LVM_INSERTCOLUMN, 0, &lvColumn); OS.HeapFree (hHeap, 0, pszText); /* Set the extended style bits */ @@ -1292,26 +1275,26 @@ */ if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return; if ((style & DWT.RIGHT_TO_LEFT) !is 0) { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); int bits2 = OS.GetWindowLong (hwndHeader, OS.GWL_EXSTYLE); OS.SetWindowLong (hwndHeader, OS.GWL_EXSTYLE, bits2 | OS.WS_EX_LAYOUTRTL); } } void createHeaderToolTips () { - if (OS.IsWinCE) return; - if (headerToolTipHandle !is 0) return; + static if (OS.IsWinCE) return; + if (headerToolTipHandle !is null) return; headerToolTipHandle = OS.CreateWindowEx ( 0, - new TCHAR (0, OS.TOOLTIPS_CLASS, true), + OS.TOOLTIPS_CLASS.ptr, null, 0, OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0, handle, - 0, + null, OS.GetModuleHandle (null), null); - if (headerToolTipHandle is 0) error (DWT.ERROR_NO_HANDLES); + if (headerToolTipHandle is null) error (DWT.ERROR_NO_HANDLES); /* * Feature in Windows. Despite the fact that the * tool tip text contains \r\n, the tooltip will @@ -1337,9 +1320,9 @@ for (int i=0; i 1) { - LVCOLUMN lvColumn = new LVCOLUMN (); + LVCOLUMN lvColumn; lvColumn.mask = OS.LVCF_WIDTH; - OS.SendMessage (handle, OS.LVM_INSERTCOLUMN, 1, lvColumn); - OS.SendMessage (handle, OS.LVM_GETCOLUMN, 1, lvColumn); + 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 (); + auto hHeap = OS.GetProcessHeap (); int byteCount = cchTextMax * TCHAR.sizeof; - int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); + auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 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); + 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.pszText = null, 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 !is 0) OS.HeapFree (hHeap, 0, pszText); + OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, &lvColumn); + if (pszText !is null) OS.HeapFree (hHeap, 0, pszText); } else { OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, 0); } if ((parent.style & DWT.VIRTUAL) is 0) { - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_TEXT | OS.LVIF_IMAGE; lvItem.pszText = OS.LPSTR_TEXTCALLBACK; lvItem.iImage = OS.I_IMAGECALLBACK; for (int i=0; i= 0) { ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, indices [i], lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, indices [i], &lvItem); ignoreSelect = false; } } @@ -1594,10 +1577,10 @@ * items. Ensure that index is greater than -1. */ if (index < 0) return; - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.stateMask = OS.LVIS_SELECTED; ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, index, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, index, &lvItem); ignoreSelect = false; } @@ -1622,7 +1605,7 @@ if (start is 0 && end is count - 1) { deselectAll (); } else { - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.stateMask = OS.LVIS_SELECTED; /* * An index of -1 will apply the change to all @@ -1631,7 +1614,7 @@ start = Math.max (0, start); for (int i=start; i<=end; i++) { ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, i, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, i, &lvItem); ignoreSelect = false; } } @@ -1647,11 +1630,11 @@ */ public void deselectAll () { checkWidget (); - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_STATE; lvItem.stateMask = OS.LVIS_SELECTED; ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, -1, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, -1, &lvItem); ignoreSelect = false; } @@ -1671,7 +1654,7 @@ } int orderIndex = 0; int [] oldOrder = new int [columnCount]; - OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, oldOrder); + OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, oldOrder.ptr); while (orderIndex < columnCount) { if (oldOrder [orderIndex] is index) break; orderIndex++; @@ -1683,45 +1666,45 @@ if (columnCount > 1) { index = 1; int cchTextMax = 1024; - int hHeap = OS.GetProcessHeap (); + auto hHeap = OS.GetProcessHeap (); int byteCount = cchTextMax * TCHAR.sizeof; - int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - LVCOLUMN lvColumn = new LVCOLUMN (); + auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); + LVCOLUMN lvColumn; 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, 1, lvColumn); + OS.SendMessage (handle, OS.LVM_GETCOLUMN, 1, &lvColumn); lvColumn.fmt &= ~(OS.LVCFMT_CENTER | OS.LVCFMT_RIGHT); lvColumn.fmt |= OS.LVCFMT_LEFT; - OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn); - if (pszText !is 0) OS.HeapFree (hHeap, 0, pszText); + OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, &lvColumn); + if (pszText !is null) OS.HeapFree (hHeap, 0, pszText); } else { - int hHeap = OS.GetProcessHeap (); - int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); - LVCOLUMN lvColumn = new LVCOLUMN (); + auto hHeap = OS.GetProcessHeap (); + auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); + LVCOLUMN lvColumn; lvColumn.mask = OS.LVCF_TEXT | OS.LVCF_IMAGE | OS.LVCF_WIDTH | OS.LVCF_FMT; lvColumn.pszText = pszText; lvColumn.iImage = OS.I_IMAGENONE; lvColumn.fmt = OS.LVCFMT_LEFT; - OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn); - if (pszText !is 0) OS.HeapFree (hHeap, 0, pszText); + OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, &lvColumn); + if (pszText !is null) OS.HeapFree (hHeap, 0, pszText); if (OS.COMCTL32_MAJOR >= 6) { - HDITEM hdItem = new HDITEM (); + HDITEM hdItem; hdItem.mask = OS.HDI_FORMAT; hdItem.fmt = OS.HDF_LEFT; - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, &hdItem); } } if ((parent.style & DWT.VIRTUAL) is 0) { - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_TEXT | OS.LVIF_IMAGE; lvItem.pszText = OS.LPSTR_TEXTCALLBACK; lvItem.iImage = OS.I_IMAGECALLBACK; int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); for (int i=0; i 1)) return; - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.state = OS.LVIS_SELECTED; lvItem.stateMask = OS.LVIS_SELECTED; for (int i=length-1; i>=0; --i) { @@ -2963,7 +2946,7 @@ */ if (indices [i] >= 0) { ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, indices [i], lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, indices [i], &lvItem); ignoreSelect = false; } } @@ -2988,11 +2971,11 @@ * items. Ensure that index is greater than -1. */ if (index < 0) return; - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.state = OS.LVIS_SELECTED; lvItem.stateMask = OS.LVIS_SELECTED; ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, index, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, index, &lvItem); ignoreSelect = false; } @@ -3033,12 +3016,12 @@ * An index of -1 will apply the change to all * items. Indices must be greater than -1. */ - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.state = OS.LVIS_SELECTED; lvItem.stateMask = OS.LVIS_SELECTED; for (int i=start; i<=end; i++) { ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, i, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, i, &lvItem); ignoreSelect = false; } } @@ -3058,19 +3041,19 @@ public void selectAll () { checkWidget (); if ((style & DWT.SINGLE) !is 0) return; - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_STATE; lvItem.state = OS.LVIS_SELECTED; lvItem.stateMask = OS.LVIS_SELECTED; ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, -1, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, -1, &lvItem); ignoreSelect = false; } -void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, int lParam) { - int hDC = nmcd.hdc; - int hFont = item.cellFont !is null ? item.cellFont [nmcd.iSubItem] : -1; - if (hFont is -1) hFont = item.font; +void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW* nmcd, int lParam) { + auto hDC = nmcd.nmcd.hdc; + auto hFont = item.cellFont !is null ? item.cellFont [nmcd.iSubItem] : cast(HFONT)-1; + if (hFont is cast(HFONT)-1) hFont = item.font; int clrText = item.cellForeground !is null ? item.cellForeground [nmcd.iSubItem] : -1; if (clrText is -1) clrText = item.foreground; int clrTextBk = -1; @@ -3090,18 +3073,18 @@ * even for items that are not selected. The fix is to get * the selection state from the item. */ - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_STATE; lvItem.stateMask = OS.LVIS_SELECTED; - lvItem.iItem = nmcd.dwItemSpec; - int result = OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem); + lvItem.iItem = nmcd.nmcd.dwItemSpec; + int result = OS.SendMessage (handle, OS.LVM_GETITEM, 0, &lvItem); bool selected = (result !is 0 && (lvItem.state & OS.LVIS_SELECTED) !is 0); GCData data = new GCData (); data.device = display; int clrSelectionBk = -1; bool drawSelected = false, drawBackground = false, drawHot = false; if (nmcd.iSubItem is 0 || (style & DWT.FULL_SELECTION) !is 0) { - drawHot = hotIndex is nmcd.dwItemSpec; + drawHot = hotIndex is nmcd.nmcd.dwItemSpec; } if (OS.IsWindowEnabled (handle)) { if (selected && (nmcd.iSubItem is 0 || (style & DWT.FULL_SELECTION) !is 0)) { @@ -3141,16 +3124,16 @@ } data.hFont = hFont; data.uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); - int nSavedDC = OS.SaveDC (hDC); + auto nSavedDC = OS.SaveDC (hDC); GC gc = GC.win32_new (hDC, data); - RECT cellRect = item.getBounds (nmcd.dwItemSpec, nmcd.iSubItem, true, true, true, true, hDC); + RECT cellRect = item.getBounds (nmcd.nmcd.dwItemSpec, nmcd.iSubItem, true, true, true, true, hDC); Event event = new Event (); event.item = item; event.gc = gc; event.index = nmcd.iSubItem; event.detail |= DWT.FOREGROUND; -// if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { - if (OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED) is nmcd.dwItemSpec) { +// if ((nmcd.nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { + if (OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED) is nmcd.nmcd.dwItemSpec) { if (nmcd.iSubItem is 0 || (style & DWT.FULL_SELECTION) !is 0) { if (handle is OS.GetFocus ()) { int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); @@ -3168,7 +3151,7 @@ gc.setClipping (event.x, event.y, event.width, event.height); sendEvent (DWT.EraseItem, event); event.gc = null; - int clrSelectionText = data.foreground; + auto clrSelectionText = data.foreground; gc.dispose (); OS.RestoreDC (hDC, nSavedDC); if (isDisposed () || item.isDisposed ()) return; @@ -3187,40 +3170,40 @@ if (nmcd.iSubItem is 0 || (style & DWT.FULL_SELECTION) !is 0) { selectionForeground = clrSelectionText; } - nmcd.uItemState &= ~OS.CDIS_SELECTED; + nmcd.nmcd.uItemState &= ~OS.CDIS_SELECTED; OS.MoveMemory (lParam, nmcd, NMLVCUSTOMDRAW.sizeof); } } else { if (ignoreDrawSelection) { - nmcd.uItemState |= OS.CDIS_SELECTED; + nmcd.nmcd.uItemState |= OS.CDIS_SELECTED; OS.MoveMemory (lParam, nmcd, NMLVCUSTOMDRAW.sizeof); } } if (ignoreDrawFocus) { - nmcd.uItemState &= ~OS.CDIS_FOCUS; + nmcd.nmcd.uItemState &= ~OS.CDIS_FOCUS; OS.MoveMemory (lParam, nmcd, NMLVCUSTOMDRAW.sizeof); } - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); bool firstColumn = nmcd.iSubItem is OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0); if (ignoreDrawForeground && ignoreDrawHot) { if (!ignoreDrawBackground && drawBackground) { - RECT backgroundRect = item.getBounds (nmcd.dwItemSpec, nmcd.iSubItem, true, false, true, false, hDC); - fillBackground (hDC, clrTextBk, backgroundRect); + RECT backgroundRect = item.getBounds (nmcd.nmcd.dwItemSpec, nmcd.iSubItem, true, false, true, false, hDC); + fillBackground (hDC, clrTextBk, &backgroundRect); } } if (!ignoreDrawHot || (!ignoreDrawSelection && clrSelectionBk !is -1)) { if (explorerTheme) { bool hot = drawHot; - RECT pClipRect = new RECT (); - OS.SetRect (pClipRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); - RECT rect = new RECT (); - OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); + RECT pClipRect; + OS.SetRect (&pClipRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); + RECT rect; + OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); if ((style & DWT.FULL_SELECTION) !is 0) { int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, count - 1, 0); - RECT headerRect = new RECT (); - OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect); - OS.MapWindowPoints (hwndHeader, handle, headerRect, 2); + RECT headerRect; + OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect); + OS.MapWindowPoints (hwndHeader, handle, cast(POINT*) &headerRect, 2); rect.left = 0; rect.right = headerRect.right; pClipRect.left = cellRect.left; @@ -3229,32 +3212,32 @@ rect.right += EXPLORER_EXTRA; pClipRect.right += EXPLORER_EXTRA; } - int hTheme = OS.OpenThemeData (handle, Display.LISTVIEW); + auto hTheme = OS.OpenThemeData (handle, Display.LISTVIEW.ptr); int iStateId = selected ? OS.LISS_SELECTED : OS.LISS_HOT; if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.LISS_SELECTEDNOTFOCUS; - OS.DrawThemeBackground (hTheme, hDC, OS.LVP_LISTITEM, iStateId, rect, pClipRect); + OS.DrawThemeBackground (hTheme, hDC, OS.LVP_LISTITEM, iStateId, &rect, &pClipRect); OS.CloseThemeData (hTheme); } else { bool fullText = ((style & DWT.FULL_SELECTION) !is 0 || !firstColumn); - RECT textRect = item.getBounds (nmcd.dwItemSpec, nmcd.iSubItem, true, false, fullText, false, hDC); - fillBackground (hDC, clrSelectionBk, textRect); + RECT textRect = item.getBounds (nmcd.nmcd.dwItemSpec, nmcd.iSubItem, true, false, fullText, false, hDC); + fillBackground (hDC, clrSelectionBk, &textRect); } } if (ignoreDrawForeground) { - RECT clipRect = item.getBounds (nmcd.dwItemSpec, nmcd.iSubItem, true, true, true, false, hDC); + RECT clipRect = item.getBounds (nmcd.nmcd.dwItemSpec, nmcd.iSubItem, true, true, true, false, hDC); OS.SaveDC (hDC); - OS.SelectClipRgn (hDC, 0); + OS.SelectClipRgn (hDC, null); OS.ExcludeClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); } } -Event sendMeasureItemEvent (TableItem item, int row, int column, int hDC) { - int hFont = item.cellFont !is null ? item.cellFont [column] : -1; - if (hFont is -1) hFont = item.font; +Event sendMeasureItemEvent (TableItem item, int row, int column, HDC hDC) { + auto hFont = item.cellFont !is null ? item.cellFont [column] : cast(HFONT)-1; + if (hFont is cast(HFONT)-1) hFont = item.font; GCData data = new GCData (); data.device = display; data.hFont = hFont; - int nSavedDC = OS.SaveDC (hDC); + auto nSavedDC = OS.SaveDC (hDC); GC gc = GC.win32_new (hDC, data); RECT itemRect = item.getBounds (row, column, true, true, false, false, hDC); Event event = new Event (); @@ -3294,10 +3277,10 @@ * box, the widget eats the mouse up. When the mouse is dragged, * the widget does not eat the mouse up. */ - LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); - OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo); + LVHITTESTINFO pinfo; + pinfo.pt.x = cast(short) (lParam & 0xFFFF); + pinfo.pt.y = cast(short) (lParam >> 16); + OS.SendMessage (handle, OS.LVM_HITTEST, 0, &pinfo); Display display = this.display; display.captureChanged = false; if (!sendMouseEvent (type, button, handle, msg, wParam, lParam)) { @@ -3345,11 +3328,11 @@ bool forceSelect = false; int count = OS.SendMessage (handle, OS.LVM_GETSELECTEDCOUNT, 0, 0); if (count is 1 && pinfo.iItem !is -1) { - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_STATE; lvItem.stateMask = OS.LVIS_SELECTED; lvItem.iItem = pinfo.iItem; - OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem); + OS.SendMessage (handle, OS.LVM_GETITEM, 0, &lvItem); if ((lvItem.state & OS.LVIS_SELECTED) !is 0) { forceSelect = true; } @@ -3385,30 +3368,30 @@ } } dragStarted = false; - return new LRESULT (code); + return cast(LRESULT) (code); } -void sendPaintItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd) { - int hDC = nmcd.hdc; +void sendPaintItemEvent (TableItem item, NMLVCUSTOMDRAW* nmcd) { + auto hDC = nmcd.nmcd.hdc; GCData data = new GCData (); data.device = display; - int hFont = item.cellFont !is null ? item.cellFont [nmcd.iSubItem] : -1; - if (hFont is -1) hFont = item.font; + auto hFont = item.cellFont !is null ? item.cellFont [nmcd.iSubItem] : cast(HFONT)-1; + if (hFont is cast(HFONT)-1) hFont = item.font; data.hFont = hFont; /* * Bug in Windows. For some reason, CDIS_SELECTED always set, * even for items that are not selected. The fix is to get * the selection state from the item. */ - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.mask = OS.LVIF_STATE; lvItem.stateMask = OS.LVIS_SELECTED; - lvItem.iItem = nmcd.dwItemSpec; - int result = OS.SendMessage (handle, OS.LVM_GETITEM, 0, lvItem); + lvItem.iItem = nmcd.nmcd.dwItemSpec; + int result = OS.SendMessage (handle, OS.LVM_GETITEM, 0, &lvItem); bool selected = result !is 0 && (lvItem.state & OS.LVIS_SELECTED) !is 0; bool drawSelected = false, drawBackground = false, drawHot = false; if (nmcd.iSubItem is 0 || (style & DWT.FULL_SELECTION) !is 0) { - drawHot = hotIndex is nmcd.dwItemSpec; + drawHot = hotIndex is nmcd.nmcd.dwItemSpec; } if (OS.IsWindowEnabled (handle)) { if (selected && (nmcd.iSubItem is 0 || (style & DWT.FULL_SELECTION) !is 0)) { @@ -3456,16 +3439,16 @@ data.background = OS.GetSysColor (OS.COLOR_3DFACE); } data.uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); - int nSavedDC = OS.SaveDC (hDC); + auto nSavedDC = OS.SaveDC (hDC); GC gc = GC.win32_new (hDC, data); - RECT itemRect = item.getBounds (nmcd.dwItemSpec, nmcd.iSubItem, true, true, false, false, hDC); + RECT itemRect = item.getBounds (nmcd.nmcd.dwItemSpec, nmcd.iSubItem, true, true, false, false, hDC); Event event = new Event (); event.item = item; event.gc = gc; event.index = nmcd.iSubItem; event.detail |= DWT.FOREGROUND; -// if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { - if (OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED) is nmcd.dwItemSpec) { +// if ((nmcd.nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { + if (OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED) is nmcd.nmcd.dwItemSpec) { if (nmcd.iSubItem is 0 || (style & DWT.FULL_SELECTION) !is 0) { if (handle is OS.GetFocus ()) { int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); @@ -3480,7 +3463,7 @@ event.y = itemRect.top; event.width = itemRect.right - itemRect.left; event.height = itemRect.bottom - itemRect.top; - RECT cellRect = item.getBounds (nmcd.dwItemSpec, nmcd.iSubItem, true, true, true, true, hDC); + RECT cellRect = item.getBounds (nmcd.nmcd.dwItemSpec, nmcd.iSubItem, true, true, true, true, hDC); int cellWidth = cellRect.right - cellRect.left; int cellHeight = cellRect.bottom - cellRect.top; gc.setClipping (cellRect.left, cellRect.top, cellWidth, cellHeight); @@ -3490,9 +3473,9 @@ OS.RestoreDC (hDC, nSavedDC); } -override void setBackgroundImage (int hBitmap) { +override void setBackgroundImage (HBITMAP hBitmap) { super.setBackgroundImage (hBitmap); - if (!customDraw) setBackgroundTransparent (hBitmap !is 0); + if (!customDraw) setBackgroundTransparent (hBitmap !is null); } override void setBackgroundPixel (int newPixel) { @@ -3643,14 +3626,14 @@ public void setColumnOrder (int [] order) { checkWidget (); if (order is null) error (DWT.ERROR_NULL_ARGUMENT); - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); if (columnCount is 0) { if (order.length !is 0) error (DWT.ERROR_INVALID_ARGUMENT); return; } if (order.length !is columnCount) error (DWT.ERROR_INVALID_ARGUMENT); int [] oldOrder = new int [columnCount]; - OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, oldOrder); + OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, oldOrder.ptr); bool reorder = false; bool [] seen = new bool [columnCount]; for (int i=0; i= 6 && OS.IsAppThemed ()) { Control control = findBackgroundControl (); @@ -3777,40 +3760,40 @@ clrBackground = 0x0200FF00; } } - int hBrush = OS.CreateSolidBrush (clrBackground); - OS.FillRect (memDC, rect, hBrush); + auto hBrush = OS.CreateSolidBrush (clrBackground); + OS.FillRect (memDC, &rect, hBrush); OS.DeleteObject (hBrush); - int oldFont = OS.SelectObject (hDC, defaultFont ()); - TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); - OS.GetTextMetrics (hDC, tm); + auto oldFont = OS.SelectObject (hDC, defaultFont ()); + TEXTMETRIC tm; + OS.GetTextMetrics (hDC, &tm); OS.SelectObject (hDC, oldFont); int itemWidth = Math.min (tm.tmHeight, width); int itemHeight = Math.min (tm.tmHeight, height); int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2 + 1; - OS.SetRect (rect, left, top, left + itemWidth, top + itemHeight); + OS.SetRect (&rect, left, top, left + itemWidth, top + itemHeight); if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { - int hTheme = display.hButtonTheme (); - OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, rect, null); + auto hTheme = display.hButtonTheme (); + OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, &rect, null); rect.left += width; rect.right += width; - OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_CHECKEDNORMAL, rect, null); + OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_CHECKEDNORMAL, &rect, null); rect.left += width; rect.right += width; - OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, rect, null); + OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, &rect, null); rect.left += width; rect.right += width; - OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_MIXEDNORMAL, rect, null); + OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_MIXEDNORMAL, &rect, null); } else { - OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_FLAT); + OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_FLAT); rect.left += width; rect.right += width; - OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_FLAT); + OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_FLAT); rect.left += width; rect.right += width; - OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_INACTIVE | OS.DFCS_FLAT); + OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_INACTIVE | OS.DFCS_FLAT); rect.left += width; rect.right += width; - OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_INACTIVE | OS.DFCS_FLAT); + OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_INACTIVE | OS.DFCS_FLAT); } OS.SelectObject (memDC, hOldBitmap); OS.DeleteDC (memDC); OS.ReleaseDC (handle, hDC); if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { - OS.ImageList_Add (hStateList, hBitmap, 0); + OS.ImageList_Add (hStateList, hBitmap, null); } else { OS.ImageList_AddMasked (hStateList, hBitmap, clrBackground); } @@ -3829,9 +3812,9 @@ setRedraw (false); setTopIndex (0); } - int hOldStateList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0); + auto hOldStateList = cast(HANDLE) OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0); OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_STATE, hStateList); - if (hOldStateList !is 0) OS.ImageList_Destroy (hOldStateList); + if (hOldStateList !is null) OS.ImageList_Destroy (hOldStateList); /* * Bug in Windows. Setting the LVSIL_STATE state image list * when the table already has a LVSIL_SMALL image list causes @@ -3839,7 +3822,7 @@ * LVSIL_SMALL image list. */ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { - int hImageList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0); + auto hImageList = cast(HANDLE) OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0); OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, hImageList); } if (fixScroll && topIndex !is 0) { @@ -3855,11 +3838,11 @@ * items. Ensure that index is greater than -1. */ if (index < 0) return; - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.state = OS.LVIS_FOCUSED; lvItem.stateMask = OS.LVIS_FOCUSED; ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, index, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, index, &lvItem); ignoreSelect = false; OS.SendMessage (handle, OS.LVM_SETSELECTIONMARK, 0, index); } @@ -3900,7 +3883,7 @@ * to be redrawn but not the column headers. The fix is * to force a redraw of the column headers. */ - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); OS.InvalidateRect (hwndHeader, null, true); } @@ -4058,7 +4041,7 @@ * WM_SETFONT which recomputes and assigns the default item * height. */ - int hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); + auto hFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0); } else { /* @@ -4068,15 +4051,15 @@ * WM_MEASUREITEM to be sent, then clear LVS_OWNERDRAWFIXED. */ forceResize (); - RECT rect = new RECT (); - OS.GetWindowRect (handle, rect); + RECT rect; + OS.GetWindowRect (handle, &rect); int width = rect.right - rect.left, height = rect.bottom - rect.top; int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); OS.SetWindowLong (handle, OS.GWL_STYLE, bits | OS.LVS_OWNERDRAWFIXED); int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER; ignoreResize = true; - SetWindowPos (handle, 0 , 0, 0, width, height + 1, flags); - SetWindowPos (handle, 0 , 0, 0, width, height, flags); + SetWindowPos (handle, null , 0, 0, width, height + 1, flags); + SetWindowPos (handle, null , 0, 0, width, height, flags); ignoreResize = false; OS.SetWindowLong (handle, OS.GWL_STYLE, bits); } @@ -4178,20 +4161,20 @@ */ setDeferResize (true); OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - if (hwndHeader !is 0) OS.SendMessage (hwndHeader, OS.WM_SETREDRAW, 1, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + if (hwndHeader !is null) OS.SendMessage (hwndHeader, OS.WM_SETREDRAW, 1, 0); if ((state & HIDDEN) !is 0) { state &= ~HIDDEN; OS.ShowWindow (handle, OS.SW_HIDE); } else { if (OS.IsWinCE) { OS.InvalidateRect (handle, null, false); - if (hwndHeader !is 0) { + if (hwndHeader !is null) { OS.InvalidateRect (hwndHeader, null, false); } } else { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; - OS.RedrawWindow (handle, null, 0, flags); + OS.RedrawWindow (handle, null, null, flags); } } setDeferResize (false); @@ -4199,8 +4182,8 @@ } else { if (drawCount++ is 0) { OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - if (hwndHeader !is 0) OS.SendMessage (hwndHeader, OS.WM_SETREDRAW, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + if (hwndHeader !is null) OS.SendMessage (hwndHeader, OS.WM_SETREDRAW, 0, 0); /* * When many items are added to a table, it is faster to @@ -4238,35 +4221,35 @@ int newWidth = 0, imageIndent = 0, index = 0; int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); while (index < itemCount) { - String string = null; - int font = -1; + char[] string = null; + HFONT font = cast(HFONT)-1; if (item !is null) { string = item.text; imageIndent = Math.max (imageIndent, item.imageIndent); if (item.cellFont !is null) font = item.cellFont [0]; - if (font is -1) font = item.font; + if (font is cast(HFONT)-1) font = item.font; } else { if (items [index] !is null) { TableItem tableItem = items [index]; string = tableItem.text; imageIndent = Math.max (imageIndent, tableItem.imageIndent); if (tableItem.cellFont !is null) font = tableItem.cellFont [0]; - if (font is -1) font = tableItem.font; + if (font is cast(HFONT)-1) font = tableItem.font; } } - if (string !is null && string.length () !is 0) { - if (font !is -1) { - int hDC = OS.GetDC (handle); - int oldFont = OS.SelectObject (hDC, font); + if (string !is null && string.length !is 0) { + if (font !is cast(HFONT)-1) { + auto hDC = OS.GetDC (handle); + auto oldFont = OS.SelectObject (hDC, font); int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX; - TCHAR buffer = new TCHAR (getCodePage (), string, false); - RECT rect = new RECT (); - OS.DrawText (hDC, buffer, buffer.length (), rect, flags); + TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false); + RECT rect; + OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags); OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); newWidth = Math.max (newWidth, rect.right - rect.left); } else { - TCHAR buffer = new TCHAR (getCodePage (), string, true); + TCHAR* buffer = StrToTCHARz (getCodePage (), string ); newWidth = Math.max (newWidth, OS.SendMessage (handle, OS.LVM_GETSTRINGWIDTH, 0, buffer)); } } @@ -4284,20 +4267,20 @@ * space. */ if (newWidth is 0) { - TCHAR buffer = new TCHAR (getCodePage (), " ", true); - newWidth = Math.max (newWidth, OS.SendMessage (handle, OS.LVM_GETSTRINGWIDTH, 0, buffer)); + TCHAR[] buffer = StrToTCHARs (getCodePage (), " ", true); + newWidth = Math.max (newWidth, OS.SendMessage (handle, OS.LVM_GETSTRINGWIDTH, 0, buffer.ptr)); } - int hStateList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0); - if (hStateList !is 0) { - int [] cx = new int [1], cy = new int [1]; - OS.ImageList_GetIconSize (hStateList, cx, cy); - newWidth += cx [0] + INSET; + auto hStateList = cast(HANDLE) OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0); + if (hStateList !is null) { + int cx, cy; + OS.ImageList_GetIconSize (hStateList, &cx, &cy); + newWidth += cx + INSET; } - int hImageList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0); - if (hImageList !is 0) { - int [] cx = new int [1], cy = new int [1]; - OS.ImageList_GetIconSize (hImageList, cx, cy); - newWidth += (imageIndent + 1) * cx [0]; + auto hImageList = cast(HANDLE) OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0); + if (hImageList !is null) { + int cx, cy; + OS.ImageList_GetIconSize (hImageList, &cx, &cy); + newWidth += (imageIndent + 1) * cx; } else { /* * Bug in Windows. When LVM_SETIMAGELIST is used to remove the @@ -4332,12 +4315,12 @@ if (redraw) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); if (OS.IsWinCE) { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - if (hwndHeader !is 0) OS.InvalidateRect (hwndHeader, null, true); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + if (hwndHeader !is null) OS.InvalidateRect (hwndHeader, null, true); OS.InvalidateRect (handle, null, true); } else { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; - OS.RedrawWindow (handle, null, 0, flags); + OS.RedrawWindow (handle, null, null, flags); } } return true; @@ -4403,7 +4386,7 @@ public void setSelection (TableItem item) { checkWidget (); if (item is null) error (DWT.ERROR_NULL_ARGUMENT); - setSelection (new TableItem [] {item}); + setSelection ([item]); } /** @@ -4557,7 +4540,7 @@ void setSubImagesVisible (bool visible) { int dwExStyle = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); - if ((dwExStyle & OS.LVS_EX_SUBITEMIMAGES) !is 0 is visible) return; + if (((dwExStyle & OS.LVS_EX_SUBITEMIMAGES) !is 0 ) is visible) return; int bits = visible ? OS.LVS_EX_SUBITEMIMAGES : 0; OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, OS.LVS_EX_SUBITEMIMAGES, bits); } @@ -4573,12 +4556,12 @@ * Windows to reserve the smallest possible space when an image * list is removed. */ - int hImageList = OS.ImageList_Create (1, 1, 0, 0, 0); + auto hImageList = OS.ImageList_Create (1, 1, 0, 0, 0); OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, hImageList); OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, 0); if (headerImageList !is null) { - int hHeaderImageList = headerImageList.getHandle (); - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hHeaderImageList = headerImageList.getHandle (); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); OS.SendMessage (hwndHeader, OS.HDM_SETIMAGELIST, 0, hHeaderImageList); } OS.ImageList_Destroy (hImageList); @@ -4659,10 +4642,10 @@ } /* Use LVM_SCROLL to scroll the table */ - RECT rect = new RECT (); + RECT rect; rect.left = OS.LVIR_BOUNDS; ignoreCustomDraw = true; - OS.SendMessage (handle, OS.LVM_GETITEMRECT, 0, rect); + OS.SendMessage (handle, OS.LVM_GETITEMRECT, 0, &rect); ignoreCustomDraw = false; int dy = (index - topIndex) * (rect.bottom - rect.top); OS.SendMessage (handle, OS.LVM_SCROLL, 0, dy); @@ -4702,12 +4685,12 @@ * the width of the first. The left edge of the second column is * also used as the right edge of the first. */ - RECT itemRect = new RECT (); + RECT itemRect; itemRect.left = OS.LVIR_BOUNDS; if (index is 0) { itemRect.top = 1; ignoreCustomDraw = true; - OS.SendMessage (handle, OS.LVM_GETSUBITEMRECT, -1, itemRect); + OS.SendMessage (handle, OS.LVM_GETSUBITEMRECT, -1, &itemRect); ignoreCustomDraw = false; itemRect.right = itemRect.left; int width = OS.SendMessage (handle, OS.LVM_GETCOLUMNWIDTH, 0, 0); @@ -4715,7 +4698,7 @@ } else { itemRect.top = index; ignoreCustomDraw = true; - OS.SendMessage (handle, OS.LVM_GETSUBITEMRECT, -1, itemRect); + OS.SendMessage (handle, OS.LVM_GETSUBITEMRECT, -1, &itemRect); ignoreCustomDraw = false; } /* @@ -4728,14 +4711,14 @@ int oldPos = 0; int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((bits & OS.LVS_EX_GRIDLINES) !is 0) { - SCROLLINFO info = new SCROLLINFO (); + SCROLLINFO info; info.cbSize = SCROLLINFO.sizeof; info.fMask = OS.SIF_POS; - OS.GetScrollInfo (handle, OS.SB_HORZ, info); + OS.GetScrollInfo (handle, OS.SB_HORZ, &info); oldPos = info.nPos; } - RECT rect = new RECT (); - OS.GetClientRect (handle, rect); + RECT rect; + OS.GetClientRect (handle, &rect); if (itemRect.left < rect.left) { int dx = itemRect.left - rect.left; OS.SendMessage (handle, OS.LVM_SCROLL, dx, 0); @@ -4754,14 +4737,14 @@ * get the new scroll position and redraw the new area. */ if ((bits & OS.LVS_EX_GRIDLINES) !is 0) { - SCROLLINFO info = new SCROLLINFO (); + SCROLLINFO info; info.cbSize = SCROLLINFO.sizeof; info.fMask = OS.SIF_POS; - OS.GetScrollInfo (handle, OS.SB_HORZ, info); + OS.GetScrollInfo (handle, OS.SB_HORZ, &info); int newPos = info.nPos; if (newPos < oldPos) { rect.right = oldPos - newPos + GRID_WIDTH; - OS.InvalidateRect (handle, rect, true); + OS.InvalidateRect (handle, &rect, true); } } } @@ -4861,19 +4844,19 @@ override void subclass () { super.subclass (); - if (HeaderProc !is 0) { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + if (HeaderProc !is null) { + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, display.windowProc); } } -override String toolTipText (NMTTDISPINFO hdr) { - int hwndToolTip = OS.SendMessage (handle, OS.LVM_GETTOOLTIPS, 0, 0); - if (hwndToolTip is hdr.hwndFrom && toolTipText !is null) return ""; //$NON-NLS-1$ - if (headerToolTipHandle is hdr.hwndFrom) { +override char[] toolTipText (NMTTDISPINFO* hdr) { + auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.LVM_GETTOOLTIPS, 0, 0); + if (hwndToolTip is hdr.hdr.hwndFrom && toolTipText_ !is null) return ""; //$NON-NLS-1$ + if (headerToolTipHandle is hdr.hdr.hwndFrom) { for (int i=0; i> 16); - OS.ScreenToClient (hwnd, pt); - pinfo.x = pt.x; - pinfo.y = pt.y; - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - int index = OS.SendMessage (hwndHeader, OS.HDM_HITTEST, 0, pinfo); + POINT pt; + pt.x = cast(short) (pos & 0xFFFF); + pt.y = cast(short) (pos >> 16); + OS.ScreenToClient (hwnd, &pt); + pinfo.pt.x = pt.x; + pinfo.pt.y = pt.y; + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + int index = OS.SendMessage (hwndHeader, OS.HDM_HITTEST, 0, &pinfo); if (0 <= index && index < columnCount && !columns [index].resizable) { if ((pinfo.flags & (OS.HHT_ONDIVIDER | OS.HHT_ONDIVOPEN)) !is 0) { - OS.SetCursor (OS.LoadCursor (0, OS.IDC_ARROW)); + OS.SetCursor (OS.LoadCursor (null, cast(TCHAR*)OS.IDC_ARROW)); return 1; } } @@ -5070,7 +5053,7 @@ override LRESULT WM_CHAR (int wParam, int lParam) { LRESULT result = super.WM_CHAR (wParam, lParam); - if (result !is null) return result; + if (result !is LRESULT.NULL) return result; switch (wParam) { case ' ': if ((style & DWT.CHECK) !is 0) { @@ -5090,7 +5073,7 @@ * performed in WM_KEYDOWN from WM_CHAR. */ int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam); - return new LRESULT (code); + return cast(LRESULT) (code); case DWT.CR: /* * Feature in Windows. Windows sends LVN_ITEMACTIVATE from WM_KEYDOWN @@ -5153,7 +5136,7 @@ override LRESULT WM_KEYDOWN (int wParam, int lParam) { LRESULT result = super.WM_KEYDOWN (wParam, lParam); - if (result !is null) return result; + if (result !is LRESULT.NULL) return result; switch (wParam) { case OS.VK_SPACE: /* @@ -5198,14 +5181,14 @@ * current proc must be restored or header tooltips stop working. */ int oldHeaderProc = 0, oldTableProc = 0; - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); bool fixSubclass = !hasChildren () && !hooks (DWT.Paint) && !filters (DWT.Paint); if (fixSubclass) { - oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, TableProc); - oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, HeaderProc); + oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TableProc); + oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, cast(int) HeaderProc); } int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam); - result = code is 0 ? LRESULT.ZERO : new LRESULT (code); + result = code is 0 ? LRESULT.ZERO : cast(LRESULT) (code); if (fixSubclass) { OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldTableProc); OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, oldHeaderProc); @@ -5242,10 +5225,10 @@ * wrong, this is unexpected. The fix is to detect the * case and avoid calling the window proc. */ - LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); - int index = OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo); + LVHITTESTINFO pinfo; + pinfo.pt.x = cast(short) (lParam & 0xFFFF); + pinfo.pt.y = cast(short) (lParam >> 16); + int index = OS.SendMessage (handle, OS.LVM_HITTEST, 0, &pinfo); Display display = this.display; display.captureChanged = false; sendMouseEvent (DWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam); @@ -5294,9 +5277,9 @@ /* Look for check/uncheck */ if ((style & DWT.CHECK) !is 0) { - LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); + LVHITTESTINFO pinfo; + pinfo.pt.x = cast(short) (lParam & 0xFFFF); + pinfo.pt.y = cast(short) (lParam >> 16); /* * Note that when the table has LVS_EX_FULLROWSELECT and the * user clicks anywhere on a row except on the check box, all @@ -5305,7 +5288,7 @@ * the correct way to determine that the user has selected * the check box, equality is needed. */ - int index = OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo); + int index = OS.SendMessage (handle, OS.LVM_HITTEST, 0, &pinfo); if (index !is -1 && pinfo.flags is OS.LVHT_ONITEMSTATEICON) { TableItem item = _getItem (index); item.setChecked (!item.getChecked (), true); @@ -5349,46 +5332,46 @@ int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((bits & OS.LVS_EX_DOUBLEBUFFER) is 0) { GC gc = null; - int paintDC = 0; - PAINTSTRUCT ps = new PAINTSTRUCT (); + HDC paintDC; + PAINTSTRUCT ps; bool hooksPaint = hooks (DWT.Paint); if (hooksPaint) { GCData data = new GCData (); - data.ps = ps; + data.ps = &ps; data.hwnd = handle; gc = GC.win32_new (this, data); paintDC = gc.handle; } else { - paintDC = OS.BeginPaint (handle, ps); + paintDC = OS.BeginPaint (handle, &ps); } - int width = ps.right - ps.left; - int height = ps.bottom - ps.top; + int width = ps.rcPaint.right - ps.rcPaint.left; + int height = ps.rcPaint.bottom - ps.rcPaint.top; if (width !is 0 && height !is 0) { - int hDC = OS.CreateCompatibleDC (paintDC); - POINT lpPoint1 = new POINT (), lpPoint2 = new POINT (); - OS.SetWindowOrgEx (hDC, ps.left, ps.top, lpPoint1); - OS.SetBrushOrgEx (hDC, ps.left, ps.top, lpPoint2); - int hBitmap = OS.CreateCompatibleBitmap (paintDC, width, height); - int hOldBitmap = OS.SelectObject (hDC, hBitmap); + auto hDC = OS.CreateCompatibleDC (paintDC); + POINT lpPoint1, lpPoint2; + OS.SetWindowOrgEx (hDC, ps.rcPaint.left, ps.rcPaint.top, &lpPoint1); + OS.SetBrushOrgEx (hDC, ps.rcPaint.left, ps.rcPaint.top, &lpPoint2); + auto hBitmap = OS.CreateCompatibleBitmap (paintDC, width, height); + auto hOldBitmap = OS.SelectObject (hDC, hBitmap); if (OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) !is OS.CLR_NONE) { - RECT rect = new RECT (); - OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom); - drawBackground (hDC, rect); + RECT rect; + OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); + drawBackground (hDC, &rect); } - callWindowProc (handle, OS.WM_PAINT, hDC, 0); + callWindowProc (handle, OS.WM_PAINT, cast(int) hDC, 0); OS.SetWindowOrgEx (hDC, lpPoint1.x, lpPoint1.y, null); OS.SetBrushOrgEx (hDC, lpPoint2.x, lpPoint2.y, null); - OS.BitBlt (paintDC, ps.left, ps.top, width, height, hDC, 0, 0, OS.SRCCOPY); + OS.BitBlt (paintDC, ps.rcPaint.left, ps.rcPaint.top, width, height, hDC, 0, 0, OS.SRCCOPY); OS.SelectObject (hDC, hOldBitmap); OS.DeleteObject (hBitmap); OS.DeleteObject (hDC); if (hooksPaint) { Event event = new Event (); event.gc = gc; - event.x = ps.left; - event.y = ps.top; - event.width = ps.right - ps.left; - event.height = ps.bottom - ps.top; + event.x = ps.rcPaint.left; + event.y = ps.rcPaint.top; + event.width = ps.rcPaint.right - ps.rcPaint.left; + event.height = ps.rcPaint.bottom - ps.rcPaint.top; sendEvent (DWT.Paint, event); // widget could be disposed at this point event.gc = null; @@ -5397,7 +5380,7 @@ if (hooksPaint) { gc.dispose (); } else { - OS.EndPaint (handle, ps); + OS.EndPaint (handle, &ps); } return LRESULT.ZERO; } @@ -5414,10 +5397,10 @@ * wrong, this is unexpected. The fix is to detect the * case and avoid calling the window proc. */ - LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); - OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo); + LVHITTESTINFO pinfo; + pinfo.pt.x = cast(short) (lParam & 0xFFFF); + pinfo.pt.y = cast(short) (lParam >> 16); + OS.SendMessage (handle, OS.LVM_HITTEST, 0, &pinfo); Display display = this.display; display.captureChanged = false; sendMouseEvent (DWT.MouseDown, 3, handle, OS.WM_RBUTTONDOWN, wParam, lParam); @@ -5466,11 +5449,11 @@ if (count is 0) return result; int index = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, -1, OS.LVNI_FOCUSED); if (index is -1) { - LVITEM lvItem = new LVITEM (); + LVITEM lvItem; lvItem.state = OS.LVIS_FOCUSED; lvItem.stateMask = OS.LVIS_FOCUSED; ignoreSelect = true; - OS.SendMessage (handle, OS.LVM_SETITEMSTATE, 0, lvItem); + OS.SendMessage (handle, OS.LVM_SETITEMSTATE, 0, &lvItem); ignoreSelect = false; } return result; @@ -5478,7 +5461,7 @@ override LRESULT WM_SETFONT (int wParam, int lParam) { LRESULT result = super.WM_SETFONT (wParam, lParam); - if (result !is null) return result; + if (result !is LRESULT.NULL) return result; /* * Bug in Windows. When a header has a sort indicator @@ -5491,30 +5474,30 @@ * the header so that all that is necessary here is to * set the default first. */ - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); OS.SendMessage (hwndHeader, OS.WM_SETFONT, 0, lParam); - if (headerToolTipHandle !is 0) { + if (headerToolTipHandle !is null) { OS.SendMessage (headerToolTipHandle, OS.WM_SETFONT, wParam, lParam); } return result; } override LRESULT WM_SIZE (int wParam, int lParam) { - if (ignoreResize) return null; + if (ignoreResize) return LRESULT.NULL; if (hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) { OS.InvalidateRect (handle, null, true); } if (resizeCount !is 0) { wasResized = true; - return null; + return LRESULT.NULL; } return super.WM_SIZE (wParam, lParam); } override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam); - if (result !is null) return result; + if (result !is LRESULT.NULL) return result; if (findBackgroundControl () is null) { setBackgroundPixel (defaultBackground ()); } else { @@ -5536,10 +5519,10 @@ int oldPos = 0; int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((bits & OS.LVS_EX_GRIDLINES) !is 0) { - SCROLLINFO info = new SCROLLINFO (); + SCROLLINFO info; info.cbSize = SCROLLINFO.sizeof; info.fMask = OS.SIF_POS; - OS.GetScrollInfo (handle, OS.SB_HORZ, info); + OS.GetScrollInfo (handle, OS.SB_HORZ, &info); oldPos = info.nPos; } @@ -5555,11 +5538,11 @@ * current proc must be restored or header tooltips stop working. */ int oldHeaderProc = 0, oldTableProc = 0; - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); bool fixSubclass = !hasChildren () && !hooks (DWT.Paint) && !filters (DWT.Paint); if (fixSubclass) { - oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, TableProc); - oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, HeaderProc); + oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int)TableProc); + oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, cast(int)HeaderProc); } LRESULT result = super.WM_HSCROLL (wParam, lParam); if (fixSubclass) { @@ -5575,16 +5558,16 @@ * get the new scroll position and redraw the new area. */ if ((bits & OS.LVS_EX_GRIDLINES) !is 0) { - SCROLLINFO info = new SCROLLINFO (); + SCROLLINFO info; info.cbSize = SCROLLINFO.sizeof; info.fMask = OS.SIF_POS; - OS.GetScrollInfo (handle, OS.SB_HORZ, info); + OS.GetScrollInfo (handle, OS.SB_HORZ, &info); int newPos = info.nPos; if (newPos < oldPos) { - RECT rect = new RECT (); - OS.GetClientRect (handle, rect); + RECT rect; + OS.GetClientRect (handle, &rect); rect.right = oldPos - newPos + GRID_WIDTH; - OS.InvalidateRect (handle, rect, true); + OS.InvalidateRect (handle, &rect, true); } } return result; @@ -5603,11 +5586,11 @@ * current proc must be restored or header tooltips stop working. */ int oldHeaderProc = 0, oldTableProc = 0; - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); bool fixSubclass = !hasChildren () && !hooks (DWT.Paint) && !filters (DWT.Paint); if (fixSubclass) { - oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, TableProc); - oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, HeaderProc); + oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TableProc); + oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, cast(int) HeaderProc); } LRESULT result = super.WM_VSCROLL (wParam, lParam); if (fixSubclass) { @@ -5633,11 +5616,11 @@ break; case OS.SB_LINEDOWN: case OS.SB_LINEUP: - RECT rect = new RECT (); - OS.GetWindowRect (hwndHeader, rect); + RECT rect; + OS.GetWindowRect (hwndHeader, &rect); int headerHeight = rect.bottom - rect.top; - RECT clientRect = new RECT (); - OS.GetClientRect (handle, clientRect); + RECT clientRect; + OS.GetClientRect (handle, &clientRect); clientRect.top += headerHeight; int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); @@ -5647,7 +5630,7 @@ } else { clientRect.bottom = clientRect.top + itemHeight + GRID_WIDTH; } - OS.InvalidateRect (handle, clientRect, true); + OS.InvalidateRect (handle, &clientRect, true); break; case OS.SB_PAGEDOWN: case OS.SB_PAGEUP: @@ -5659,21 +5642,21 @@ } override LRESULT wmMeasureChild (int wParam, int lParam) { - MEASUREITEMSTRUCT struct = new MEASUREITEMSTRUCT (); - OS.MoveMemory (struct, lParam, MEASUREITEMSTRUCT.sizeof); + MEASUREITEMSTRUCT* struct_ = cast(MEASUREITEMSTRUCT*)lParam; + //OS.MoveMemory (struct_, lParam, MEASUREITEMSTRUCT.sizeof); if (itemHeight is -1) { int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); - struct.itemHeight = (oneItem >> 16) - (empty >> 16); + struct_.itemHeight = (oneItem >> 16) - (empty >> 16); } else { - struct.itemHeight = itemHeight; - } - OS.MoveMemory (lParam, struct, MEASUREITEMSTRUCT.sizeof); - return null; + struct_.itemHeight = itemHeight; + } + //OS.MoveMemory (lParam, struct_, MEASUREITEMSTRUCT.sizeof); + return LRESULT.NULL; } -override LRESULT wmNotify (NMHDR hdr, int wParam, int lParam) { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); +override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) { + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); if (hdr.hwndFrom is hwndHeader) { /* * Feature in Windows. On NT, the automatically created @@ -5695,8 +5678,8 @@ case OS.HDN_DIVIDERDBLCLICKW: case OS.HDN_DIVIDERDBLCLICKA: { if (columnCount is 0) return LRESULT.ONE; - NMHEADER phdn = new NMHEADER (); - OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); + NMHEADER* phdn = cast(NMHEADER*)lParam; + //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); TableColumn column = columns [phdn.iItem]; if (column !is null && !column.getResizable ()) { return LRESULT.ONE; @@ -5735,8 +5718,8 @@ int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((bits & OS.LVS_EX_HEADERDRAGDROP) is 0) break; if (columnCount is 0) return LRESULT.ONE; - NMHEADER phdn = new NMHEADER (); - OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); + NMHEADER* phdn = cast(NMHEADER*)lParam; + //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); if (phdn.iItem !is -1) { TableColumn column = columns [phdn.iItem]; if (column !is null && !column.getMoveable ()) { @@ -5749,15 +5732,15 @@ case OS.HDN_ENDDRAG: { int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((bits & OS.LVS_EX_HEADERDRAGDROP) is 0) break; - NMHEADER phdn = new NMHEADER (); - OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); - if (phdn.iItem !is -1 && phdn.pitem !is 0) { - HDITEM pitem = new HDITEM (); - OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof); + NMHEADER* phdn = cast(NMHEADER*)lParam; + //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); + if (phdn.iItem !is -1 && phdn.pitem !is null) { + HDITEM* pitem = cast(HDITEM*)phdn.pitem; + //OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof); if ((pitem.mask & OS.HDI_ORDER) !is 0 && pitem.iOrder !is -1) { if (columnCount is 0) break; int [] order = new int [columnCount]; - OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, order); + OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, order.ptr); int index = 0; while (index < order.length) { if (order [index] is phdn.iItem) break; @@ -5792,19 +5775,19 @@ if (lastWidth is 0 && width > 0) { int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((bits & OS.LVS_EX_GRIDLINES) !is 0) { - RECT rect = new RECT (); - OS.GetClientRect (handle, rect); + RECT rect; + OS.GetClientRect (handle, &rect); rect.right = rect.left + width; - OS.InvalidateRect (handle, rect, true); + OS.InvalidateRect (handle, &rect, true); } } lastWidth = width; if (!ignoreColumnResize) { - NMHEADER phdn = new NMHEADER (); - OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); - if (phdn.pitem !is 0) { - HDITEM pitem = new HDITEM (); - OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof); + NMHEADER* phdn = cast(NMHEADER*)lParam; + //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); + if (phdn.pitem !is null) { + HDITEM* pitem = cast(HDITEM*)phdn.pitem; + //OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof); if ((pitem.mask & OS.HDI_WIDTH) !is 0) { TableColumn column = columns [phdn.iItem]; if (column !is null) { @@ -5820,7 +5803,7 @@ TableColumn [] newColumns = new TableColumn [columnCount]; System.arraycopy (columns, 0, newColumns, 0, columnCount); int [] order = new int [columnCount]; - OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, order); + OS.SendMessage (handle, OS.LVM_GETCOLUMNORDERARRAY, columnCount, order.ptr); bool moved = false; for (int i=0; i buffer.length) { - buffer = display.tableBuffer = new char [plvfi.cchTextMax]; + if (buffer is null || plvfi.item.cchTextMax > buffer.length) { + buffer = display.tableBuffer = new char [plvfi.item.cchTextMax]; } - string.getChars (0, length, buffer, 0); - buffer [length++] = 0; - if (OS.IsUnicode) { - OS.MoveMemory (plvfi.pszText, buffer, length * 2); + string.getChars (0, length_, buffer, 0); + buffer [length_++] = 0; + static if (OS.IsUnicode) { + OS.MoveMemory (plvfi.item.pszText, buffer.ptr, length_ * 2); } else { - OS.WideCharToMultiByte (getCodePage (), 0, buffer, length, plvfi.pszText, plvfi.cchTextMax, null, null); - OS.MoveMemory (plvfi.pszText + plvfi.cchTextMax - 1, new byte [1], 1); + OS.WideCharToMultiByte (getCodePage (), 0, buffer.ptr, length_, plvfi.item.pszText, plvfi.item.cchTextMax, null, null); + byte dummy; + OS.MoveMemory (plvfi.item.pszText + plvfi.item.cchTextMax - 1, &dummy, 1); } } } bool move = false; - if ((plvfi.mask & OS.LVIF_IMAGE) !is 0) { + if ((plvfi.item.mask & OS.LVIF_IMAGE) !is 0) { Image image = null; - if (plvfi.iSubItem is 0) { + if (plvfi.item.iSubItem is 0) { image = item.image; } else { Image [] images = item.images; - if (images !is null) image = images [plvfi.iSubItem]; + if (images !is null) image = images [plvfi.item.iSubItem]; } if (image !is null) { - plvfi.iImage = imageIndex (image, plvfi.iSubItem); + plvfi.item.iImage = imageIndex (image, plvfi.item.iSubItem); move = true; } } - if ((plvfi.mask & OS.LVIF_STATE) !is 0) { - if (plvfi.iSubItem is 0) { + if ((plvfi.item.mask & OS.LVIF_STATE) !is 0) { + if (plvfi.item.iSubItem is 0) { int state = 1; if (item.checked) state++; if (item.grayed) state +=2; - plvfi.state = state << 12; - plvfi.stateMask = OS.LVIS_STATEIMAGEMASK; + plvfi.item.state = state << 12; + plvfi.item.stateMask = OS.LVIS_STATEIMAGEMASK; move = true; } } - if ((plvfi.mask & OS.LVIF_INDENT) !is 0) { - if (plvfi.iSubItem is 0) { - plvfi.iIndent = item.imageIndent; + if ((plvfi.item.mask & OS.LVIF_INDENT) !is 0) { + if (plvfi.item.iSubItem is 0) { + plvfi.item.iIndent = item.imageIndent; move = true; } } - if (move) OS.MoveMemory (lParam, plvfi, NMLVDISPINFO.sizeof); + //if (move) OS.MoveMemory (lParam, plvfi, NMLVDISPINFO.sizeof); break; } case OS.NM_CUSTOMDRAW: { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); if (hdr.hwndFrom is hwndHeader) break; if (!customDraw && findImageControl () is null) { /* @@ -6026,9 +6010,9 @@ if (!explorerTheme || columnCount !is 0) break; } } - NMLVCUSTOMDRAW nmcd = new NMLVCUSTOMDRAW (); - OS.MoveMemory (nmcd, lParam, NMLVCUSTOMDRAW.sizeof); - switch (nmcd.dwDrawStage) { + NMLVCUSTOMDRAW* nmcd = cast(NMLVCUSTOMDRAW*)lParam; + //OS.MoveMemory (nmcd, lParam, NMLVCUSTOMDRAW.sizeof); + switch (nmcd.nmcd.dwDrawStage) { case OS.CDDS_PREPAINT: return CDDS_PREPAINT (nmcd, wParam, lParam); case OS.CDDS_ITEMPREPAINT: return CDDS_ITEMPREPAINT (nmcd, wParam, lParam); case OS.CDDS_ITEMPOSTPAINT: return CDDS_ITEMPOSTPAINT (nmcd, wParam, lParam); @@ -6050,17 +6034,17 @@ dragStarted = true; if (hdr.code is OS.LVN_BEGINDRAG) { int pos = OS.GetMessagePos (); - POINT pt = new POINT (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); - OS.ScreenToClient (handle, pt); + POINT pt; + pt.x = cast(short) (pos & 0xFFFF); + pt.y = cast(short) (pos >> 16); + OS.ScreenToClient (handle, &pt); sendDragEvent (1, pt.x, pt.y); } break; } case OS.LVN_COLUMNCLICK: { - NMLISTVIEW pnmlv = new NMLISTVIEW (); - OS.MoveMemory(pnmlv, lParam, NMLISTVIEW.sizeof); + NMLISTVIEW* pnmlv = cast(NMLISTVIEW*)lParam; + //OS.MoveMemory(pnmlv, lParam, NMLISTVIEW.sizeof); TableColumn column = columns [pnmlv.iSubItem]; if (column !is null) { column.postEvent (DWT.Selection); @@ -6069,8 +6053,8 @@ } case OS.LVN_ITEMACTIVATE: { if (ignoreActivate) break; - NMLISTVIEW pnmlv = new NMLISTVIEW (); - OS.MoveMemory(pnmlv, lParam, NMLISTVIEW.sizeof); + NMLISTVIEW* pnmlv = cast(NMLISTVIEW*)lParam; + //OS.MoveMemory(pnmlv, lParam, NMLISTVIEW.sizeof); if (pnmlv.iItem !is -1) { Event event = new Event (); event.item = _getItem (pnmlv.iItem); @@ -6080,8 +6064,8 @@ } case OS.LVN_ITEMCHANGED: { if (!ignoreSelect) { - NMLISTVIEW pnmlv = new NMLISTVIEW (); - OS.MoveMemory (pnmlv, lParam, NMLISTVIEW.sizeof); + NMLISTVIEW* pnmlv = cast(NMLISTVIEW*)lParam; + //OS.MoveMemory (pnmlv, lParam, NMLISTVIEW.sizeof); if ((pnmlv.uChanged & OS.LVIF_STATE) !is 0) { if (pnmlv.iItem is -1) { wasSelected = true; @@ -6093,28 +6077,28 @@ } } if (hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) { - int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); if (count !is 0) { forceResize (); - RECT rect = new RECT (); - OS.GetClientRect (handle, rect); - NMLISTVIEW pnmlv = new NMLISTVIEW (); - OS.MoveMemory (pnmlv, lParam, NMLISTVIEW.sizeof); + RECT rect; + OS.GetClientRect (handle, &rect); + NMLISTVIEW* pnmlv = cast(NMLISTVIEW*)lParam; + //OS.MoveMemory (pnmlv, lParam, NMLISTVIEW.sizeof); if (pnmlv.iItem !is -1) { - RECT itemRect = new RECT (); + RECT itemRect; itemRect.left = OS.LVIR_BOUNDS; ignoreCustomDraw = true; - OS.SendMessage (handle, OS. LVM_GETITEMRECT, pnmlv.iItem, itemRect); + OS.SendMessage (handle, OS. LVM_GETITEMRECT, pnmlv.iItem, &itemRect); ignoreCustomDraw = false; - RECT headerRect = new RECT (); + RECT headerRect; int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, count - 1, 0); - OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect); - OS.MapWindowPoints (hwndHeader, handle, headerRect, 2); + OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect); + OS.MapWindowPoints (hwndHeader, handle, cast(POINT*) &headerRect, 2); rect.left = headerRect.right; rect.top = itemRect.top; rect.bottom = itemRect.bottom; - OS.InvalidateRect (handle, rect, true); + OS.InvalidateRect (handle, &rect, true); } } } @@ -6130,17 +6114,17 @@ * TRUE when receiving the Pocket PC 2002 specific NM_RECOGNIZEGESTURE * message. */ - if (OS.IsPPC) { + if (OS.IsPPC_) { bool hasMenu = menu !is null && !menu.isDisposed (); if (!hasMenu && !hooks (DWT.MenuDetect)) return LRESULT.ONE; } break; case OS.GN_CONTEXTMENU: - if (OS.IsPPC) { + if (OS.IsPPC_) { bool hasMenu = menu !is null && !menu.isDisposed (); if (hasMenu || hooks (DWT.MenuDetect)) { - NMRGINFO nmrg = new NMRGINFO (); - OS.MoveMemory (nmrg, lParam, NMRGINFO.sizeof); + NMRGINFO* nmrg = cast(NMRGINFO*)lParam; + //OS.MoveMemory (nmrg, lParam, NMRGINFO.sizeof); showMenu (nmrg.x, nmrg.y); return LRESULT.ONE; } @@ -6151,4 +6135,4 @@ } } -++/ + diff -r 774d936d1380 -r 3f4e6a4ecc09 dwt/widgets/TableColumn.d --- a/dwt/widgets/TableColumn.d Mon Feb 04 16:26:54 2008 +0100 +++ b/dwt/widgets/TableColumn.d Mon Feb 04 20:01:30 2008 +0100 @@ -10,15 +10,6 @@ *******************************************************************************/ module dwt.widgets.TableColumn; -import dwt.widgets.Item; -import dwt.widgets.Widget; -class TableColumn : Item { - public this (Widget parent, int style) { - super (parent, style); - } -} - -/++ import dwt.DWT; import dwt.DWTException; @@ -27,12 +18,16 @@ import dwt.events.SelectionListener; import dwt.graphics.Image; import dwt.graphics.Rectangle; -import dwt.internal.win32.HDITEM; -import dwt.internal.win32.LVCOLUMN; import dwt.internal.win32.OS; -import dwt.internal.win32.RECT; -import dwt.internal.win32.TCHAR; -import dwt.internal.win32.TOOLINFO; + +import dwt.widgets.Item; +import dwt.widgets.Widget; +import dwt.widgets.Table; +import dwt.widgets.TypedListener; +import dwt.widgets.TableItem; +import dwt.widgets.Event; + +import dwt.dwthelper.utils; /** * Instances of this class represent a column in a table widget. @@ -48,10 +43,10 @@ * IMPORTANT: This class is not intended to be subclassed. *

*/ -public class TableColumn extends Item { +public class TableColumn : Item { Table parent; bool resizable, moveable; - String toolTipText; + char[] toolTipText; int id; /** @@ -86,7 +81,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableColumn (Table parent, int style) { +public this (Table parent, int style) { super (parent, checkStyle (style)); resizable = true; this.parent = parent; @@ -127,7 +122,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableColumn (Table parent, int style, int index) { +public this (Table parent, int style, int index) { super (parent, checkStyle (style)); resizable = true; this.parent = parent; @@ -226,7 +221,7 @@ return DWT.LEFT; } -override String getNameText () { +override char[] getNameText () { return getText (); } @@ -300,7 +295,7 @@ * * @since 3.2 */ -public String getToolTipText () { +public char[] getToolTipText () { checkWidget(); return toolTipText; } @@ -319,7 +314,7 @@ checkWidget (); int index = parent.indexOf (this); if (index is -1) return 0; - int hwnd = parent.handle; + auto hwnd = parent.handle; return OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0); } @@ -338,9 +333,9 @@ checkWidget (); int index = parent.indexOf (this); if (index is -1) return; - int hwnd = parent.handle; + auto hwnd = parent.handle; int oldWidth = OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0); - TCHAR buffer = new TCHAR (parent.getCodePage (), text, true); + TCHAR* buffer = StrToTCHARz (parent.getCodePage (), text); int headerWidth = OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + Table.HEADER_MARGIN; if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) headerWidth += Table.HEADER_EXTRA; bool hasHeaderImage = false; @@ -362,7 +357,7 @@ } int margin = 0; if (OS.COMCTL32_VERSION >= OS.VERSION (5, 80)) { - int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); + auto hwndHeader = cast(HWND) 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; @@ -379,27 +374,27 @@ * each items ourselves rather than letting Windows do it. */ if ((index is 0 && !parent.firstColumnImage) || parent.hooks (DWT.MeasureItem)) { - RECT headerRect = new RECT (); - int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); - OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect); - OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2); - int hDC = OS.GetDC (hwnd); - int oldFont = 0, newFont = OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); - if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont); + RECT headerRect; + auto hwndHeader = cast(HWND) OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); + OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect); + OS.MapWindowPoints (hwndHeader, hwnd, cast(POINT*) &headerRect, 2); + auto hDC = OS.GetDC (hwnd); + HFONT oldFont, newFont = cast(HFONT) OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); + if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); int count = OS.SendMessage (hwnd, OS.LVM_GETITEMCOUNT, 0, 0); for (int i=0; i= 6) { int index = parent.indexOf (this); if (index is -1) return; - int hwnd = parent.handle; - int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); - HDITEM hdItem = new HDITEM (); + auto hwnd = parent.handle; + auto hwndHeader = cast(HWND) OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); + HDITEM hdItem; hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE; - OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem); + OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem); switch (direction) { case DWT.UP: hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN); @@ -721,7 +716,7 @@ } break; } - OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem); + OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, &hdItem); /* * Bug in Windows. When LVM_SETSELECTEDCOLUMN is used to * specify a selected column, Windows does not redraw either @@ -736,28 +731,28 @@ * selected column. */ parent.forceResize (); - RECT rect = new RECT (); - OS.GetClientRect (hwnd, rect); + RECT rect; + OS.GetClientRect (hwnd, &rect); if (OS.SendMessage (hwnd, OS.LVM_GETBKCOLOR, 0, 0) !is OS.CLR_NONE) { int oldColumn = OS.SendMessage (hwnd, OS.LVM_GETSELECTEDCOLUMN, 0, 0); int newColumn = direction is DWT.NONE ? -1 : index; OS.SendMessage (hwnd, OS.LVM_SETSELECTEDCOLUMN, newColumn, 0); - RECT headerRect = new RECT (); + RECT headerRect; if (oldColumn !is -1) { - if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, oldColumn, headerRect) !is 0) { - OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2); + if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, oldColumn, &headerRect) !is 0) { + OS.MapWindowPoints (hwndHeader, hwnd, cast(POINT*) &headerRect, 2); rect.left = headerRect.left; rect.right = headerRect.right; - OS.InvalidateRect (hwnd, rect, true); + OS.InvalidateRect (hwnd, &rect, true); } } } - RECT headerRect = new RECT (); - if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect) !is 0) { - OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2); + RECT headerRect; + if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect) !is 0) { + OS.MapWindowPoints (hwndHeader, hwnd, cast(POINT*) &headerRect, 2); rect.left = headerRect.left; rect.right = headerRect.right; - OS.InvalidateRect (hwnd, rect, true); + OS.InvalidateRect (hwnd, &rect, true); } } else { switch (direction) { @@ -772,10 +767,10 @@ } } -override public void setText (String string) { +override public void setText (char[] string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); - if (string.equals (text)) return; + if (string==/*eq*/text) return; int index = parent.indexOf (this); if (index is -1) return; super.setText (string); @@ -787,10 +782,10 @@ * text does not draw. The fix is to query and then * set the alignment. */ - int hwnd = parent.handle; - LVCOLUMN lvColumn = new LVCOLUMN (); + auto hwnd = parent.handle; + LVCOLUMN lvColumn; lvColumn.mask = OS.LVCF_FMT; - OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, lvColumn); + OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, cast(int) &lvColumn); /* * Bug in Windows. When a column header contains a @@ -800,15 +795,15 @@ * mnemonic characters and replace doubled mnemonics * with spaces. */ - int hHeap = OS.GetProcessHeap (); - TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string), true); - int byteCount = buffer.length () * TCHAR.sizeof; - int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (pszText, buffer, byteCount); + auto hHeap = OS.GetProcessHeap (); + TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), fixMnemonic (string), true); + int byteCount = buffer.length * TCHAR.sizeof; + auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); + OS.MoveMemory (pszText, buffer.ptr, byteCount); lvColumn.mask |= OS.LVCF_TEXT; lvColumn.pszText = pszText; - int result = OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn); - if (pszText !is 0) OS.HeapFree (hHeap, 0, pszText); + int result = OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, cast(int) &lvColumn); + if (pszText !is null) OS.HeapFree (hHeap, 0, pszText); if (result is 0) error (DWT.ERROR_CANNOT_SET_TEXT); } @@ -825,11 +820,11 @@ * * @since 3.2 */ -public void setToolTipText (String string) { +public void setToolTipText (char[] string) { checkWidget(); toolTipText = string; - int hwndHeaderToolTip = parent.headerToolTipHandle; - if (hwndHeaderToolTip is 0) { + auto hwndHeaderToolTip = parent.headerToolTipHandle; + if (hwndHeaderToolTip is null) { parent.createHeaderToolTips (); parent.updateHeaderToolTips (); } @@ -850,29 +845,29 @@ if (width < 0) return; int index = parent.indexOf (this); if (index is -1) return; - int hwnd = parent.handle; + auto hwnd = parent.handle; OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, width); } void updateToolTip (int index) { - int hwndHeaderToolTip = parent.headerToolTipHandle; - if (hwndHeaderToolTip !is 0) { - int hwnd = parent.handle; - int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); - RECT rect = new RECT (); - if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, rect) !is 0) { - TOOLINFO lpti = new TOOLINFO (); + auto hwndHeaderToolTip = parent.headerToolTipHandle; + if (hwndHeaderToolTip !is null) { + auto hwnd = parent.handle; + auto hwndHeader = cast(HWND) OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); + RECT rect; + if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &rect) !is 0) { + TOOLINFO lpti; lpti.cbSize = TOOLINFO.sizeof; lpti.hwnd = hwndHeader; lpti.uId = id; - lpti.left = rect.left; - lpti.top = rect.top; - lpti.right = rect.right; - lpti.bottom = rect.bottom; - OS.SendMessage (hwndHeaderToolTip, OS.TTM_NEWTOOLRECT, 0, lpti); + lpti.rect.left = rect.left; + lpti.rect.top = rect.top; + lpti.rect.right = rect.right; + lpti.rect.bottom = rect.bottom; + OS.SendMessage (hwndHeaderToolTip, OS.TTM_NEWTOOLRECT, 0, &lpti); } } } } -++/ + diff -r 774d936d1380 -r 3f4e6a4ecc09 dwt/widgets/TableItem.d --- a/dwt/widgets/TableItem.d Mon Feb 04 16:26:54 2008 +0100 +++ b/dwt/widgets/TableItem.d Mon Feb 04 20:01:30 2008 +0100 @@ -10,26 +10,20 @@ *******************************************************************************/ module dwt.widgets.TableItem; -import dwt.widgets.Item; -import dwt.widgets.Widget; - -class TableItem : Item { - public this (Widget parent, int style) { - super (parent, style); - } -} -/++ - import dwt.DWT; import dwt.DWTException; import dwt.graphics.Color; import dwt.graphics.Font; import dwt.graphics.Image; import dwt.graphics.Rectangle; -import dwt.internal.win32.LVITEM; import dwt.internal.win32.OS; -import dwt.internal.win32.RECT; -import dwt.internal.win32.TCHAR; + +import dwt.widgets.Item; +import dwt.widgets.Widget; +import dwt.widgets.Table; +import dwt.widgets.Event; + +import dwt.dwthelper.utils; /** * Instances of this class represent a selectable user interface object @@ -45,13 +39,15 @@ *

*/ -public class TableItem extends Item { +public class TableItem : Item { Table parent; - String [] strings; + char[] [] strings; Image [] images; bool checked, grayed, cached; - int imageIndent, background = -1, foreground = -1, font = -1; - int [] cellBackground, cellForeground, cellFont; + int imageIndent, background = -1, foreground = -1; + HFONT font = cast(HFONT)-1; + int [] cellBackground, cellForeground; + HFONT[] cellFont; /** * Constructs a new instance of this class given its parent @@ -83,7 +79,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableItem (Table parent, int style) { +public this (Table parent, int style) { this (parent, style, checkNull (parent).getItemCount (), true); } @@ -119,11 +115,11 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public TableItem (Table parent, int style, int index) { +public this (Table parent, int style, int index) { this (parent, style, index, true); } -TableItem (Table parent, int style, int index, bool create) { +this (Table parent, int style, int index, bool create) { super (parent, style); this.parent = parent; if (create) parent.createItem (this, index); @@ -145,8 +141,10 @@ images = null; imageIndent = 0; checked = grayed = false; - background = foreground = font = -1; - cellBackground = cellForeground = cellFont = null; + background = foreground = -1; + font = cast(HFONT)-1; + cellBackground = cellForeground = null; + cellFont = null; if ((parent.style & DWT.VIRTUAL) !is 0) cached = false; } @@ -242,46 +240,46 @@ } RECT getBounds (int row, int column, bool getText, bool getImage, bool fullText) { - return getBounds (row, column, getText, getImage, fullText, false, 0); + return getBounds (row, column, getText, getImage, fullText, false, null); } -RECT getBounds (int row, int column, bool getText, bool getImage, bool fullText, bool fullImage, int hDC) { - if (!getText && !getImage) return new RECT (); +RECT getBounds (int row, int column, bool getText, bool getImage, bool fullText, bool fullImage, HDC hDC) { + if (!getText && !getImage) return RECT.init; int columnCount = parent.getColumnCount (); if (!(0 <= column && column < Math.max (1, columnCount))) { - return new RECT (); + return RECT.init; } if (parent.fixScrollWidth) parent.setScrollWidth (null, true); - RECT rect = new RECT (); - int hwnd = parent.handle; + RECT rect; + auto hwnd = parent.handle; int bits = OS.SendMessage (hwnd, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if (column is 0 && (bits & OS.LVS_EX_FULLROWSELECT) is 0) { if (parent.explorerTheme) { rect.left = OS.LVIR_ICON; parent.ignoreCustomDraw = true; - int code = OS.SendMessage (hwnd, OS. LVM_GETITEMRECT, row, rect); + int code = OS.SendMessage (hwnd, OS. LVM_GETITEMRECT, row, &rect); parent.ignoreCustomDraw = false; - if (code is 0) return new RECT (); + if (code is 0) return RECT.init; if (getText) { int width = 0; - int hFont = cellFont !is null ? cellFont [column] : -1; - if (hFont is -1) hFont = font; - if (hFont is -1 && hDC is 0) { - TCHAR buffer = new TCHAR (parent.getCodePage (), text, true); + auto hFont = cellFont !is null ? cellFont [column] : cast(HFONT)-1; + if (hFont is cast(HFONT)-1) hFont = font; + if (hFont is cast(HFONT)-1 && hDC is null) { + TCHAR* buffer = StrToTCHARz (parent.getCodePage (), text); width = OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer); } else { - TCHAR buffer = new TCHAR (parent.getCodePage (), text, false); - int textDC = hDC !is 0 ? hDC : OS.GetDC (hwnd), oldFont = -1; - if (hDC is 0) { - if (hFont is -1) hFont = OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); + TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), text, false); + auto textDC = hDC !is null ? hDC : OS.GetDC (hwnd), oldFont = cast(HFONT)-1; + if (hDC is null) { + if (hFont is cast(HFONT)-1) hFont = cast(HFONT) OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); oldFont = OS.SelectObject (textDC, hFont); } - RECT textRect = new RECT (); + RECT textRect; int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_CALCRECT; - OS.DrawText (textDC, buffer, buffer.length (), textRect, flags); + OS.DrawText (textDC, buffer.ptr, buffer.length, &textRect, flags); width = textRect.right - textRect.left; - if (hDC is 0) { - if (oldFont !is -1) OS.SelectObject (textDC, oldFont); + if (hDC is null) { + if (oldFont !is cast(HFONT)-1) OS.SelectObject (textDC, oldFont); OS.ReleaseDC (hwnd, textDC); } } @@ -292,30 +290,30 @@ if (getText) { rect.left = OS.LVIR_SELECTBOUNDS; parent.ignoreCustomDraw = true; - int code = OS.SendMessage (hwnd, OS.LVM_GETITEMRECT, row, rect); + int code = OS.SendMessage (hwnd, OS.LVM_GETITEMRECT, row, &rect); parent.ignoreCustomDraw = false; - if (code is 0) return new RECT (); + if (code is 0) return RECT.init; if (!getImage) { - RECT iconRect = new RECT (); + RECT iconRect; iconRect.left = OS.LVIR_ICON; parent.ignoreCustomDraw = true; - code = OS.SendMessage (hwnd, OS. LVM_GETITEMRECT, row, iconRect); + code = OS.SendMessage (hwnd, OS. LVM_GETITEMRECT, row, &iconRect); parent.ignoreCustomDraw = false; if (code !is 0) rect.left = iconRect.right; } } else { rect.left = OS.LVIR_ICON; parent.ignoreCustomDraw = true; - int code = OS.SendMessage (hwnd, OS.LVM_GETITEMRECT, row, rect); + int code = OS.SendMessage (hwnd, OS.LVM_GETITEMRECT, row, &rect); parent.ignoreCustomDraw = false; - if (code is 0) return new RECT (); + if (code is 0) return RECT.init; } } if (fullText || fullImage) { - RECT headerRect = new RECT (); - int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); - OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, 0, headerRect); - OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2); + RECT headerRect; + auto hwndHeader = cast(HWND) OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); + OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, 0, &headerRect); + OS.MapWindowPoints (hwndHeader, hwnd, cast(POINT*) &headerRect, 2); if (getText && fullText) rect.right = headerRect.right; if (getImage && fullImage) rect.left = headerRect.left; } @@ -328,7 +326,7 @@ */ bool hasImage = (column is 0 && image !is null) || (images !is null && images [column] !is null); rect.top = column; - if (fullText || fullImage || hDC is 0) { + if (fullText || fullImage || hDC is null) { /* * Bug in Windows. Despite the fact that the documentation states * that LVIR_BOUNDS and LVIR_LABEL are identical when used with @@ -337,9 +335,9 @@ */ rect.left = getText ? OS.LVIR_LABEL : OS.LVIR_ICON; parent.ignoreCustomDraw = true; - int code = OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, rect); + int code = OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, &rect); parent.ignoreCustomDraw = false; - if (code is 0) return new RECT (); + if (code is 0) return RECT.init; /* * Feature in Windows. Calling LVM_GETSUBITEMRECT with LVIR_LABEL * and zero for the column number gives the bounds of the first item @@ -350,19 +348,19 @@ * bounds using the icon bounds. */ if (column is 0 && getText && getImage) { - RECT iconRect = new RECT (); + RECT iconRect; iconRect.left = OS.LVIR_ICON; parent.ignoreCustomDraw = true; - code = OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, iconRect); + code = OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, &iconRect); parent.ignoreCustomDraw = false; if (code !is 0) rect.left = iconRect.left; } if (hasImage) { if (column !is 0 && getText && !getImage) { - RECT iconRect = new RECT (); + RECT iconRect; iconRect.top = column; iconRect.left = OS.LVIR_ICON; - if (OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, iconRect) !is 0) { + if (OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, &iconRect) !is 0) { rect.left = iconRect.right + Table.INSET / 2; } } @@ -370,26 +368,26 @@ if (getImage && !getText) rect.right = rect.left; } if (column is 0 && fullImage) { - RECT headerRect = new RECT (); - int hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); - OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, 0, headerRect); - OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2); + RECT headerRect; + auto hwndHeader = cast(HWND) OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0); + OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, 0, &headerRect); + OS.MapWindowPoints (hwndHeader, hwnd, cast(POINT*) &headerRect, 2); rect.left = headerRect.left; } } else { rect.left = OS.LVIR_ICON; parent.ignoreCustomDraw = true; - int code = OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, rect); + int code = OS.SendMessage (hwnd, OS. LVM_GETSUBITEMRECT, row, &rect); parent.ignoreCustomDraw = false; - if (code is 0) return new RECT (); + if (code is 0) return RECT.init; if (!hasImage) rect.right = rect.left; if (getText) { - String string = column is 0 ? text : strings !is null ? strings [column] : null; + char[] string = column is 0 ? text : strings !is null ? strings [column] : null; if (string !is null) { - RECT textRect = new RECT (); - TCHAR buffer = new TCHAR (parent.getCodePage (), string, false); + RECT textRect; + TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, false); int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_CALCRECT; - OS.DrawText (hDC, buffer, buffer.length (), textRect, flags); + OS.DrawText (hDC, buffer.ptr, buffer.length, &textRect, flags); rect.right += textRect.right - textRect.left + Table.INSET * 3 + 1; } } @@ -444,7 +442,7 @@ public Font getFont () { checkWidget (); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - return font is -1 ? parent.getFont () : Font.win32_new (display, font); + return font is cast(HFONT)-1 ? parent.getFont () : Font.win32_new (display, font); } /** @@ -466,8 +464,8 @@ if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count -1) return getFont (); - int hFont = (cellFont !is null) ? cellFont [index] : font; - return hFont is -1 ? getFont () : Font.win32_new (display, hFont); + auto hFont = (cellFont !is null) ? cellFont [index] : font; + return hFont is cast(HFONT)-1 ? getFont () : Font.win32_new (display, hFont); } /** @@ -599,7 +597,7 @@ return imageIndent; } -override String getNameText () { +override char[] getNameText () { if ((parent.style & DWT.VIRTUAL) !is 0) { if (!cached) return "*virtual*"; //$NON-NLS-1$ } @@ -621,7 +619,7 @@ return parent; } -override public String getText () { +override public char[] getText () { checkWidget(); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); return super.getText (); @@ -639,13 +637,13 @@ *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • * */ -public String getText (int index) { +public char[] getText (int index) { checkWidget(); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); if (index is 0) return getText (); if (strings !is null) { if (0 <= index && index < strings.length) { - String string = strings [index]; + char[] string = strings [index]; return string !is null ? string : ""; } } @@ -685,7 +683,7 @@ void redraw () { if (parent.currentItem is this || parent.drawCount !is 0) return; - int hwnd = parent.handle; + auto hwnd = parent.handle; if (!OS.IsWindowVisible (hwnd)) return; int index = parent.indexOf (this); if (index is -1) return; @@ -694,12 +692,12 @@ void redraw (int column, bool drawText, bool drawImage) { if (parent.currentItem is this || parent.drawCount !is 0) return; - int hwnd = parent.handle; + auto hwnd = parent.handle; if (!OS.IsWindowVisible (hwnd)) return; int index = parent.indexOf (this); if (index is -1) return; RECT rect = getBounds (index, column, drawText, drawImage, true); - OS.InvalidateRect (hwnd, rect, true); + OS.InvalidateRect (hwnd, &rect, true); } override void releaseHandle () { @@ -711,7 +709,8 @@ super.releaseWidget (); strings = null; images = null; - cellBackground = cellForeground = cellFont = null; + cellBackground = cellForeground = null; + cellFont = null; } /** @@ -841,7 +840,7 @@ if (font !is null && font.isDisposed ()) { DWT.error (DWT.ERROR_INVALID_ARGUMENT); } - int hFont = -1; + HFONT hFont = cast(HFONT)-1; if (font !is null) { parent.setCustomDraw (true); hFont = font.handle; @@ -863,12 +862,12 @@ if ((parent.style & DWT.VIRTUAL) is 0 && cached) { int itemIndex = parent.indexOf (this); if (itemIndex !is -1) { - int hwnd = parent.handle; - LVITEM lvItem = new LVITEM (); + auto hwnd = parent.handle; + LVITEM lvItem; lvItem.mask = OS.LVIF_TEXT; lvItem.iItem = itemIndex; lvItem.pszText = OS.LPSTR_TEXTCALLBACK; - OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem); + OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, cast(int) &lvItem); cached = false; } } @@ -902,15 +901,15 @@ } int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return; - int hFont = -1; + auto hFont = cast(HFONT)-1; if (font !is null) { parent.setCustomDraw (true); hFont = font.handle; } if (cellFont is null) { - cellFont = new int [count]; + cellFont = new HFONT [count]; for (int i = 0; i < count; i++) { - cellFont [i] = -1; + cellFont [i] = cast(HFONT)-1; } } if (cellFont [index] is hFont) return; @@ -931,12 +930,12 @@ if ((parent.style & DWT.VIRTUAL) is 0 && cached) { int itemIndex = parent.indexOf (this); if (itemIndex !is -1) { - int hwnd = parent.handle; - LVITEM lvItem = new LVITEM (); + auto hwnd = parent.handle; + LVITEM lvItem; lvItem.mask = OS.LVIF_TEXT; lvItem.iItem = itemIndex; lvItem.pszText = OS.LPSTR_TEXTCALLBACK; - OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem); + OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, cast(int) &lvItem); cached = false; } } @@ -1054,7 +1053,7 @@ *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • * */ -override public void setImage (Image [] images) { +public void setImage (Image [] images) { checkWidget(); if (images is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; iERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * */ -override public void setText (String [] strings) { +public void setText (char[] [] strings) { checkWidget(); if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; iERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * */ -public void setText (int index, String string) { +public void setText (int index, char[] string) { checkWidget(); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (index is 0) { - if (string.equals (text)) return; + if (string ==/*eq*/text) return; super.setText (string); } int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return; if (strings is null && index !is 0) { - strings = new String [count]; + strings = new char[] [count]; strings [0] = text; } if (strings !is null) { - if (string.equals (strings [index])) return; + if (string==/*eq*/strings [index]) return; strings [index] = string; } if ((parent.style & DWT.VIRTUAL) !is 0) cached = true; @@ -1221,12 +1220,12 @@ if ((parent.style & DWT.VIRTUAL) is 0 && cached) { int itemIndex = parent.indexOf (this); if (itemIndex !is -1) { - int hwnd = parent.handle; - LVITEM lvItem = new LVITEM (); + auto hwnd = parent.handle; + LVITEM lvItem; lvItem.mask = OS.LVIF_TEXT; lvItem.iItem = itemIndex; lvItem.pszText = OS.LPSTR_TEXTCALLBACK; - OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, lvItem); + OS.SendMessage (hwnd, OS.LVM_SETITEM, 0, cast(int) &lvItem); cached = false; } } @@ -1235,10 +1234,9 @@ redraw (index, true, false); } -public void setText (String string) { +override public void setText (char[] string) { checkWidget(); setText (0, string); } } -++/ \ No newline at end of file diff -r 774d936d1380 -r 3f4e6a4ecc09 tango_sys_win32/Types.di --- a/tango_sys_win32/Types.di Mon Feb 04 16:26:54 2008 +0100 +++ b/tango_sys_win32/Types.di Mon Feb 04 20:01:30 2008 +0100 @@ -9567,6 +9567,7 @@ alias HD_HITTESTINFO _HD_HITTESTINFO; alias HD_HITTESTINFO THDHITTESTINFO; +alias HD_HITTESTINFO HDHITTESTINFO; alias HD_HITTESTINFO* PHDHITTESTINFO; struct HD_ITEM