Mercurial > projects > dwt-win
diff dwt/widgets/Combo.d @ 108:6f75fdfa1bcd
Change LRESULT to class, like done in the old DWT.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 11 Feb 2008 02:44:32 +0100 |
parents | 43c42c637c9c |
children | f353be82b6be |
line wrap: on
line diff
--- a/dwt/widgets/Combo.d Mon Feb 11 00:56:33 2008 +0100 +++ b/dwt/widgets/Combo.d Mon Feb 11 02:44:32 2008 +0100 @@ -318,20 +318,20 @@ addListener (DWT.Verify, typedListener); } -override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { - if (handle is null) return LRESULT.ZERO; +override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { + if (handle is null) return 0; if (hwnd is handle) { - return cast(LRESULT) OS.CallWindowProc( ComboProc, hwnd, msg, wParam, lParam); + return OS.CallWindowProc( ComboProc, hwnd, msg, wParam, lParam); } auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); if (hwnd is hwndText) { - return cast(LRESULT) OS.CallWindowProc( EditProc, hwnd, msg, wParam, lParam); + return OS.CallWindowProc( EditProc, hwnd, msg, wParam, lParam); } auto hwndList = OS.GetDlgItem (handle, CBID_LIST); if (hwnd is hwndList) { - return cast(LRESULT) OS.CallWindowProc( ListProc, hwnd, msg, wParam, lParam); + return OS.CallWindowProc( ListProc, hwnd, msg, wParam, lParam); } - return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam); + return OS.DefWindowProc (hwnd, msg, wParam, lParam); } private static extern(Windows) int CBTFunc (int nCode, int wParam, int lParam) { @@ -2020,7 +2020,7 @@ auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); auto hwndList = OS.GetDlgItem (handle, CBID_LIST); if ((hwndText !is null && hwnd is hwndText) || (hwndList !is null && hwnd is hwndList)) { - LRESULT result = LRESULT.NULL; + LRESULT result = null; switch (msg) { /* Keyboard messages */ case OS.WM_CHAR: result = wmChar (hwnd, wParam, lParam); break; @@ -2069,7 +2069,7 @@ break; default: } - if (result !is LRESULT.NULL) return result; + if (result !is null) return result.value; return callWindowProc (hwnd, msg, wParam, lParam); } } @@ -2108,7 +2108,7 @@ override LRESULT WM_GETDLGCODE (int wParam, int lParam) { int code = callWindowProc (handle, OS.WM_GETDLGCODE, wParam, lParam); - return cast( LRESULT )(code | OS.DLGC_WANTARROWS); + return new LRESULT (code | OS.DLGC_WANTARROWS); } override LRESULT WM_KILLFOCUS (int wParam, int lParam) { @@ -2128,7 +2128,7 @@ * Return NULL - Focus notification is * done in WM_COMMAND by CBN_KILLFOCUS. */ - return LRESULT.NULL; + return null; } override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { @@ -2159,7 +2159,7 @@ * Return NULL - Focus notification is * done by WM_COMMAND with CBN_SETFOCUS. */ - return LRESULT.NULL; + return null; } override LRESULT WM_SIZE (int wParam, int lParam) { @@ -2192,7 +2192,7 @@ * match from the list. The fix is to remember the original * text and reset it after the widget is resized. */ - LRESULT result = LRESULT.NULL; + LRESULT result = null; if ((style & DWT.READ_ONLY) !is 0) { result = super.WM_SIZE (wParam, lParam); } else { @@ -2237,9 +2237,9 @@ } override LRESULT wmChar (HWND hwnd, int wParam, int lParam) { - if (ignoreCharacter) return LRESULT.NULL; + if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); - if (result !is LRESULT.NULL) return result; + if (result !is null) return result; /* * Feature in Windows. For some reason, when the * widget is a single line text widget, when the @@ -2268,8 +2268,8 @@ } LRESULT wmClipboard (HWND hwndText, int msg, int wParam, int lParam) { - if ((style & DWT.READ_ONLY) !is 0) return LRESULT.NULL; - if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return LRESULT.NULL; + if ((style & DWT.READ_ONLY) !is 0) return null; + if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return null; bool call = false; int start, end; char[] newText = null; @@ -2333,7 +2333,7 @@ OS.MoveMemory (pszText, buffer.ptr, byteCount); int code = OS.CallWindowProc (EditProc, hwndText, msg, wParam, cast(int) pszText); OS.HeapFree (hHeap, 0, pszText); - return cast( LRESULT )(code); + return new LRESULT (code); } else { TCHAR* buffer = StrToTCHARz( newText ); OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer); @@ -2341,7 +2341,7 @@ } } } - return LRESULT.NULL; + return null; } override LRESULT wmCommandChild (int wParam, int lParam) { @@ -2441,13 +2441,13 @@ sendKeyEvent (DWT.KeyUp, OS.WM_IME_CHAR, wParam, lParam); // widget could be disposed at this point display.lastKey = display.lastAscii = 0; - return cast( LRESULT )(result); + return new LRESULT (result); } override LRESULT wmKeyDown (HWND hwnd, int wParam, int lParam) { - if (ignoreCharacter) return LRESULT.NULL; + if (ignoreCharacter) return null; LRESULT result = super.wmKeyDown (hwnd, wParam, lParam); - if (result !is LRESULT.NULL) return result; + if (result !is null) return result; ignoreDefaultSelection = false; if (wParam is OS.VK_RETURN) { if ((style & DWT.DROP_DOWN) !is 0) { @@ -2469,7 +2469,7 @@ */ int oldSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0); LRESULT result = super.wmSysKeyDown (hwnd, wParam, lParam); - if (result !is LRESULT.NULL) return result; + if (result !is null) return result; if ((style & DWT.READ_ONLY) is 0) { if (wParam is OS.VK_DOWN) { int code = callWindowProc (hwnd, OS.WM_SYSKEYDOWN, wParam, lParam); @@ -2480,7 +2480,7 @@ sendEvent (DWT.Selection); if (isDisposed ()) return LRESULT.ZERO; } - return cast( LRESULT )(code); + return new LRESULT (code); } } return result;