Mercurial > projects > dwt-win
changeset 45:f4a025bb42e9
CoolBar
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 02 Feb 2008 18:33:51 +0100 |
parents | c913756e6950 |
children | e28b4e239c0a |
files | dwt/internal/win32/OS.d dwt/internal/win32/WINTYPES.d dwt/widgets/CoolBar.d dwt/widgets/CoolItem.d dwt/widgets/ExpandItem.d |
diffstat | 5 files changed, 192 insertions(+), 121 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/internal/win32/OS.d Sat Feb 02 01:51:46 2008 +0100 +++ b/dwt/internal/win32/OS.d Sat Feb 02 18:33:51 2008 +0100 @@ -1404,7 +1404,7 @@ public static const int RDW_INVALIDATE = 0x1; public static const int RDW_UPDATENOW = 0x100; public static const int READ_CONTROL = 0x20000; - public static const char[] REBARCLASSNAME = "ReBarWindow32"; //$NON-NLS-1$ + public static const TCHAR[] REBARCLASSNAME = "ReBarWindow32"; //$NON-NLS-1$ public static const int RGN_AND = 0x1; public static const int RGN_COPY = 5; public static const int RGN_DIFF = 0x4;
--- a/dwt/internal/win32/WINTYPES.d Sat Feb 02 01:51:46 2008 +0100 +++ b/dwt/internal/win32/WINTYPES.d Sat Feb 02 18:33:51 2008 +0100 @@ -36,6 +36,13 @@ alias HANDLE HTHEME; +struct NMREBARCHILDSIZE { + NMHDR hdr; + UINT uBand; + UINT wID; + RECT rcChild; + RECT rcBand; +} // .... //--------------------------------------------------------------------------------
--- a/dwt/widgets/CoolBar.d Sat Feb 02 01:51:46 2008 +0100 +++ b/dwt/widgets/CoolBar.d Sat Feb 02 18:33:51 2008 +0100 @@ -14,26 +14,19 @@ import dwt.widgets.Composite; -class CoolBar : Composite { -} -/++ + import dwt.DWT; import dwt.DWTException; import dwt.graphics.Point; import dwt.graphics.Rectangle; -import dwt.internal.win32.INITCOMMONCONTROLSEX; -import dwt.internal.win32.LRESULT; -import dwt.internal.win32.MARGINS; -import dwt.internal.win32.NMCUSTOMDRAW; -import dwt.internal.win32.NMHDR; -import dwt.internal.win32.NMREBARCHEVRON; -import dwt.internal.win32.NMREBARCHILDSIZE; import dwt.internal.win32.OS; -import dwt.internal.win32.POINT; -import dwt.internal.win32.REBARBANDINFO; -import dwt.internal.win32.RECT; -import dwt.internal.win32.TCHAR; -import dwt.internal.win32.WNDCLASS; + +import dwt.widgets.Composite; +import dwt.widgets.Control; +import dwt.widgets.CoolItem; +import dwt.widgets.Event; + +import dwt.dwthelper.utils; /** * Instances of this class provide an area for dynamically @@ -59,26 +52,27 @@ * </p> */ -public class CoolBar extends Composite { +public class CoolBar : Composite { + CoolItem [] items; CoolItem [] originalItems; bool locked; bool ignoreResize; - static final int ReBarProc; - static final TCHAR ReBarClass = new TCHAR (0, OS.REBARCLASSNAME, true); - static { - INITCOMMONCONTROLSEX icex = new INITCOMMONCONTROLSEX (); + static const WNDPROC ReBarProc; + static const TCHAR* ReBarClass = OS.REBARCLASSNAME.ptr; + static this() { + INITCOMMONCONTROLSEX icex; icex.dwSize = INITCOMMONCONTROLSEX.sizeof; icex.dwICC = OS.ICC_COOL_CLASSES; - OS.InitCommonControlsEx (icex); - WNDCLASS lpWndClass = new WNDCLASS (); - OS.GetClassInfo (0, ReBarClass, lpWndClass); + OS.InitCommonControlsEx (&icex); + WNDCLASS lpWndClass; + OS.GetClassInfo (null, ReBarClass, &lpWndClass); ReBarProc = lpWndClass.lpfnWndProc; } - static final int SEPARATOR_WIDTH = 2; - static final int MAX_WIDTH = 0x7FFF; - static final int DEFAULT_COOLBAR_WIDTH = 0; - static final int DEFAULT_COOLBAR_HEIGHT = 0; + static const int SEPARATOR_WIDTH = 2; + static const int MAX_WIDTH = 0x7FFF; + static const int DEFAULT_COOLBAR_WIDTH = 0; + static const int DEFAULT_COOLBAR_HEIGHT = 0; /** * Constructs a new instance of this class given its parent @@ -108,7 +102,7 @@ * @see Widget#checkSubclass * @see Widget#getStyle */ -public CoolBar (Composite parent, int style) { +public this (Composite parent, int style) { super (parent, checkStyle (style)); /* * Ensure that either of HORIZONTAL or VERTICAL is set. @@ -130,9 +124,9 @@ } } -int callWindowProc (int hwnd, int msg, int wParam, int lParam) { - if (handle is 0) return 0; - return OS.CallWindowProc (ReBarProc, hwnd, msg, wParam, lParam); +LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { + if (handle is null) return LRESULT.NULL; + return cast(LRESULT) OS.CallWindowProc (ReBarProc, hwnd, msg, wParam, lParam); } static int checkStyle (int style) { @@ -174,22 +168,22 @@ } } } - RECT oldRect = new RECT (); - OS.GetWindowRect (handle, oldRect); + RECT oldRect; + OS.GetWindowRect (handle, &oldRect); int oldWidth = oldRect.right - oldRect.left; int oldHeight = oldRect.bottom - oldRect.top; int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER; - SetWindowPos (handle, 0, 0, 0, newWidth, newHeight, flags); - RECT rect = new RECT (); - OS.SendMessage (handle, OS.RB_GETRECT, count - 1, rect); + SetWindowPos (handle, null, 0, 0, newWidth, newHeight, flags); + RECT rect; + OS.SendMessage (handle, OS.RB_GETRECT, count - 1, &rect); height = Math.max (height, rect.bottom); - SetWindowPos (handle, 0, 0, 0, oldWidth, oldHeight, flags); - REBARBANDINFO rbBand = new REBARBANDINFO (); + SetWindowPos (handle, null, 0, 0, oldWidth, oldHeight, flags); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_IDEALSIZE | OS.RBBIM_STYLE; int rowWidth = 0; for (int i = 0; i < count; i++) { - OS.SendMessage(handle, OS.RB_GETBANDINFO, i, rbBand); + OS.SendMessage(handle, OS.RB_GETBANDINFO, i, &rbBand); if ((rbBand.fStyle & OS.RBBS_BREAK) !is 0) { width = Math.max(width, rowWidth); rowWidth = 0; @@ -236,7 +230,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); } @@ -250,9 +244,9 @@ System.arraycopy (items, 0, newItems, 0, items.length); items = newItems; } - int hHeap = OS.GetProcessHeap (); - int lpText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); - REBARBANDINFO rbBand = new REBARBANDINFO (); + auto hHeap = OS.GetProcessHeap (); + auto lpText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_TEXT | OS.RBBIM_STYLE | OS.RBBIM_ID; rbBand.fStyle = OS.RBBS_VARIABLEHEIGHT | OS.RBBS_GRIPPERALWAYS; @@ -289,7 +283,7 @@ } /* Insert the item */ - if (OS.SendMessage (handle, OS.RB_INSERTBAND, index, rbBand) is 0) { + if (OS.SendMessage (handle, OS.RB_INSERTBAND, index, &rbBand) is 0) { error (DWT.ERROR_ITEM_NOT_ADDED); } @@ -380,7 +374,7 @@ originalItems = newOriginals; } -void drawThemeBackground (int hDC, int hwnd, RECT rect) { +void drawThemeBackground (HDC hDC, HWND hwnd, RECT* rect) { if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { if (background is -1 && (style & DWT.FLAT) !is 0) { Control control = findBackgroundControl (); @@ -390,11 +384,11 @@ } } } - RECT rect2 = new RECT (); - OS.GetClientRect (handle, rect2); - OS.MapWindowPoints (handle, hwnd, rect2, 2); - POINT lpPoint = new POINT (); - OS.SetWindowOrgEx (hDC, -rect2.left, -rect2.top, lpPoint); + RECT rect2; + OS.GetClientRect (handle, &rect2); + OS.MapWindowPoints (handle, hwnd, cast(POINT*) &rect2, 2); + POINT lpPoint; + OS.SetWindowOrgEx (hDC, -rect2.left, -rect2.top, &lpPoint); OS.SendMessage (handle, OS.WM_PRINT, hDC, OS.PRF_CLIENT | OS.PRF_ERASEBKGND); OS.SetWindowOrgEx (hDC, lpPoint.x, lpPoint.y, null); } @@ -407,12 +401,12 @@ int getMargin (int index) { int margin = 0; if (OS.COMCTL32_MAJOR >= 6) { - MARGINS margins = new MARGINS (); - OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins); + MARGINS margins; + OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, &margins); margin += margins.cxLeftWidth + margins.cxRightWidth; } - RECT rect = new RECT (); - OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, rect); + RECT rect; + OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, &rect); if ((style & DWT.FLAT) !is 0) { /* * Bug in Windows. When the style bit RBS_BANDBORDERS is not set @@ -459,10 +453,10 @@ checkWidget (); int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); if (!(0 <= index && index < count)) error (DWT.ERROR_INVALID_RANGE); - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_ID; - OS.SendMessage (handle, OS.RB_GETBANDINFO, index, rbBand); + OS.SendMessage (handle, OS.RB_GETBANDINFO, index, &rbBand); return items [rbBand.wID]; } @@ -506,11 +500,11 @@ checkWidget (); int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); int [] indices = new int [count]; - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_ID; for (int i=0; i<count; i++) { - OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); + OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); CoolItem item = items [rbBand.wID]; int index = 0; while (index<originalItems.length) { @@ -543,11 +537,11 @@ checkWidget (); int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); CoolItem [] result = new CoolItem [count]; - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_ID; for (int i=0; i<count; i++) { - OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); + OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); result [i] = items [rbBand.wID]; } return result; @@ -569,17 +563,17 @@ checkWidget (); int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); Point [] sizes = new Point [count]; - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_CHILDSIZE; int separator = (style & DWT.FLAT) is 0 ? SEPARATOR_WIDTH : 0; - MARGINS margins = new MARGINS (); + MARGINS margins; for (int i=0; i<count; i++) { - RECT rect = new RECT (); - OS.SendMessage (handle, OS.RB_GETRECT, i, rect); - OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); + RECT rect; + OS.SendMessage (handle, OS.RB_GETRECT, i, &rect); + OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); if (OS.COMCTL32_MAJOR >= 6) { - OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins); + OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, &margins); rect.left -= margins.cxLeftWidth; rect.right += margins.cxRightWidth; } @@ -596,11 +590,11 @@ int getLastIndexOfRow (int index) { int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); if (count is 0) return -1; - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_STYLE; for (int i=index + 1; i<count; i++) { - OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); + OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); if ((rbBand.fStyle & OS.RBBS_BREAK) !is 0) { return i - 1; } @@ -611,10 +605,10 @@ bool isLastItemOfRow (int index) { int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); if (index + 1 is count) return true; - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_STYLE; - OS.SendMessage (handle, OS.RB_GETBANDINFO, index + 1, rbBand); + OS.SendMessage (handle, OS.RB_GETBANDINFO, index + 1, &rbBand); return (rbBand.fStyle & OS.RBBS_BREAK) !is 0; } @@ -695,25 +689,25 @@ */ int count = OS.SendMessage(handle, OS.RB_GETBANDCOUNT, 0, 0); if (0 <= index && index < count) { - REBARBANDINFO rbBand = new REBARBANDINFO(); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_IDEALSIZE; - OS.SendMessage (handle, OS.RB_GETBANDINFO, index, rbBand); - RECT rect = new RECT (); - OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, rect); + OS.SendMessage (handle, OS.RB_GETBANDINFO, index, &rbBand); + RECT rect; + OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, &rect); rbBand.cx = rbBand.cxIdeal + rect.left; if ((style & DWT.FLAT) is 0) rbBand.cx += rect.right; rbBand.fMask = OS.RBBIM_SIZE; - OS.SendMessage (handle, OS.RB_SETBANDINFO, index, rbBand); + OS.SendMessage (handle, OS.RB_SETBANDINFO, index, &rbBand); } } void resizeToMaximumWidth (int index) { - REBARBANDINFO rbBand = new REBARBANDINFO(); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_SIZE; rbBand.cx = MAX_WIDTH; - OS.SendMessage (handle, OS.RB_SETBANDINFO, index, rbBand); + OS.SendMessage (handle, OS.RB_SETBANDINFO, index, &rbBand); } void releaseChildren (bool destroy) { @@ -754,7 +748,7 @@ 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); } } @@ -766,13 +760,13 @@ void setItemColors (int foreColor, int backColor) { int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_COLORS; rbBand.clrFore = foreColor; rbBand.clrBack = backColor; for (int i=0; i<count; i++) { - OS.SendMessage (handle, OS.RB_SETBANDINFO, i, rbBand); + OS.SendMessage (handle, OS.RB_SETBANDINFO, i, &rbBand); } } @@ -849,8 +843,8 @@ set [index] = true; } - REBARBANDINFO rbBand = new REBARBANDINFO (); - rbBand.cbSize = REBARBANDINFO.sizeof; + //REBARBANDINFO rbBand; + //rbBand.cbSize = REBARBANDINFO.sizeof; for (int i=0; i<itemOrder.length; i++) { int id = originalItems [itemOrder [i]].id; int index = OS.SendMessage (handle, OS.RB_IDTOINDEX, id, 0); @@ -898,11 +892,11 @@ if (sizes is null) error (DWT.ERROR_NULL_ARGUMENT); int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); if (sizes.length !is count) error (DWT.ERROR_INVALID_ARGUMENT); - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_ID; for (int i=0; i<count; i++) { - OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); + OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); items [rbBand.wID].setSize (sizes [i].x, sizes [i].y); } } @@ -924,17 +918,17 @@ checkWidget (); this.locked = locked; int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); - REBARBANDINFO rbBand = new REBARBANDINFO (); + REBARBANDINFO rbBand; rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_STYLE; for (int i=0; i<count; i++) { - OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); + OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); if (locked) { rbBand.fStyle |= OS.RBBS_NOGRIPPER; } else { rbBand.fStyle &= ~OS.RBBS_NOGRIPPER; } - OS.SendMessage (handle, OS.RB_SETBANDINFO, i, rbBand); + OS.SendMessage (handle, OS.RB_SETBANDINFO, i, &rbBand); } } @@ -990,12 +984,12 @@ return bits; } -TCHAR windowClass () { - return ReBarClass; +char[] windowClass () { + return TCHARzToStr( ReBarClass ); } int windowProc () { - return ReBarProc; + return cast(int) ReBarProc; } LRESULT WM_COMMAND (int wParam, int lParam) { @@ -1018,7 +1012,7 @@ * for this control. */ LRESULT result = super.WM_COMMAND (wParam, lParam); - if (result !is null) return result; + if (result !is LRESULT.NULL) return result; return LRESULT.ZERO; } @@ -1038,8 +1032,8 @@ * been erased. */ if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { - drawBackground (wParam); - return null; + drawBackground ( cast(HDC) wParam); + return LRESULT.NULL; } return result; } @@ -1064,13 +1058,13 @@ * for this control. */ LRESULT result = super.WM_NOTIFY (wParam, lParam); - if (result !is null) return result; + if (result !is LRESULT.NULL) return result; return LRESULT.ZERO; } LRESULT WM_SETREDRAW (int wParam, int lParam) { LRESULT result = super.WM_SETREDRAW (wParam, lParam); - if (result !is null) return result; + if (result !is LRESULT.NULL) return result; /* * Feature in Windows. When redraw is turned off, the rebar * control does not call the default window proc. This means @@ -1094,17 +1088,17 @@ Rectangle rect = getBounds (); int code = callWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam); OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam); - if (!rect.equals (getBounds ())) { + if ( rect != getBounds ()) { parent.redraw (rect.x, rect.y, rect.width, rect.height, true); } - return new LRESULT (code); + return cast( LRESULT )(code); } LRESULT WM_SIZE (int wParam, int lParam) { if (ignoreResize) { int code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam); if (code is 0) return LRESULT.ZERO; - return new LRESULT (code); + return cast( LRESULT )(code); } //TEMPORARY CODE // if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { @@ -1115,14 +1109,14 @@ return super.WM_SIZE (wParam, lParam); } -LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) { +LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) { switch (hdr.code) { case OS.RBN_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); int button = display.lastButton !is 0 ? display.lastButton : 1; if (!sendDragEvent (button, pt.x, pt.y)) return LRESULT.ONE; break; @@ -1137,15 +1131,15 @@ * nothing. If the control is a combo, the drop down portion is * recalculated. */ - NMREBARCHILDSIZE lprbcs = new NMREBARCHILDSIZE (); - OS.MoveMemory (lprbcs, lParam, NMREBARCHILDSIZE.sizeof); + NMREBARCHILDSIZE* lprbcs = cast(NMREBARCHILDSIZE*)lParam; + //OS.MoveMemory (lprbcs, lParam, NMREBARCHILDSIZE.sizeof); if (lprbcs.uBand !is -1) { CoolItem item = items [lprbcs.wID]; Control control = item.control; if (control !is null) { - int width = lprbcs.rcChild_right - lprbcs.rcChild_left; - int height = lprbcs.rcChild_bottom - lprbcs.rcChild_top; - control.setBounds (lprbcs.rcChild_left, lprbcs.rcChild_top, width, height); + int width = lprbcs.rcChild.right - lprbcs.rcChild.left; + int height = lprbcs.rcChild.bottom - lprbcs.rcChild.top; + control.setBounds (lprbcs.rcChild.left, lprbcs.rcChild.top, width, height); } } break; @@ -1164,18 +1158,18 @@ break; } case OS.RBN_CHEVRONPUSHED: { - NMREBARCHEVRON lpnm = new NMREBARCHEVRON (); - OS.MoveMemory (lpnm, lParam, NMREBARCHEVRON.sizeof); + NMREBARCHEVRON* lpnm = cast(NMREBARCHEVRON*)lParam; + //OS.MoveMemory (lpnm, lParam, NMREBARCHEVRON.sizeof); CoolItem item = items [lpnm.wID]; if (item !is null) { Event event = new Event(); event.detail = DWT.ARROW; if ((style & DWT.VERTICAL) !is 0) { - event.x = lpnm.right; - event.y = lpnm.top; + event.x = lpnm.rc.right; + event.y = lpnm.rc.top; } else { - event.x = lpnm.left; - event.y = lpnm.bottom; + event.x = lpnm.rc.left; + event.y = lpnm.rc.bottom; } item.postEvent (DWT.Selection, event); } @@ -1190,11 +1184,11 @@ */ if (OS.COMCTL32_MAJOR < 6) break; if (findBackgroundControl () !is null || (style & DWT.FLAT) !is 0) { - NMCUSTOMDRAW nmcd = new NMCUSTOMDRAW (); - OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof); + NMCUSTOMDRAW* nmcd = cast(NMCUSTOMDRAW*)lParam; + //OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof); switch (nmcd.dwDrawStage) { case OS.CDDS_PREERASE: - return new LRESULT (OS.CDRF_SKIPDEFAULT | OS.CDRF_NOTIFYPOSTERASE); + return cast(LRESULT) (OS.CDRF_SKIPDEFAULT | OS.CDRF_NOTIFYPOSTERASE); case OS.CDDS_POSTERASE: drawBackground (nmcd.hdc); break; @@ -1206,4 +1200,3 @@ return super.wmNotifyChild (hdr, wParam, lParam); } } -++/ \ No newline at end of file
--- a/dwt/widgets/CoolItem.d Sat Feb 02 01:51:46 2008 +0100 +++ b/dwt/widgets/CoolItem.d Sat Feb 02 18:33:51 2008 +0100 @@ -15,10 +15,43 @@ import dwt.widgets.Item; import dwt.widgets.Widget; -class CoolItem : Item { +import dwt.events.SelectionListener; +import dwt.graphics.Point; +import dwt.graphics.Rectangle; +import dwt.widgets.Control; +import dwt.widgets.CoolBar; +import dwt.widgets.Item; +class CoolItem : Item { public this (Widget parent, int style) { super (parent, style); } + Rectangle getClientArea(); + override void checkSubclass(); + Point computeSize(int, int); + override void destroyWidget(); + override void releaseHandle(); + void setControl(Control); + bool getWrap(); + void setWrap(bool); + CoolBar getParent(); + Point getSize(); + void setSize(int, int); + void setSize(Point); + Rectangle getBounds(); + Point getMinimumSize(); + Point getPreferredSize(); + void setMinimumSize(int, int); + void setMinimumSize(Point); + void setPreferredSize(int, int); + void setPreferredSize(Point); + Control getControl(); + void addSelectionListener(SelectionListener); + void removeSelectionListener(SelectionListener); + CoolBar parent; + Control control; + int id; + bool ideal; + bool minimum; } /++ import dwt.DWT;
--- a/dwt/widgets/ExpandItem.d Sat Feb 02 01:51:46 2008 +0100 +++ b/dwt/widgets/ExpandItem.d Sat Feb 02 18:33:51 2008 +0100 @@ -15,11 +15,49 @@ import dwt.widgets.Item; import dwt.widgets.Widget; -class ExpandItem : Item { +import dwt.graphics.GC; +import dwt.graphics.Image; +import dwt.internal.win32.OS; +import dwt.widgets.Control; +import dwt.widgets.ExpandBar; +import dwt.widgets.Item; +class ExpandItem : Item { public this (Widget parent, int style) { super (parent, style); } + void redraw(bool); + override void releaseWidget(); + override void destroyWidget(); + override void releaseHandle(); + bool getExpanded(); + void setControl(Control); + void drawItem(GC, int, RECT, bool); + bool isHover(int, int); + void setExpanded(bool); + ExpandBar getParent(); + void setBounds(int, int, int, int, bool, bool); + int getHeight(); + override void setText(char[]); + Control getControl(); + void setHeight(int); + override void setImage(Image); + int getPreferredWidth(int, int); + int getHeaderHeight(); + ExpandBar parent; + Control control; + bool expanded; + bool hover; + int x; + int y; + int width; + int height; + int imageHeight; + int imageWidth; + static int TEXT_INSET; + static int BORDER; + static int CHEVRON_SIZE; } + /++ import dwt.DWT; import dwt.DWTException;