comparison dwt/widgets/Composite.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
comparison
equal deleted inserted replaced
106:e4a62cdcd2e0 108:6f75fdfa1bcd
1063 return super.widgetStyle () | OS.WS_CLIPCHILDREN; 1063 return super.widgetStyle () | OS.WS_CLIPCHILDREN;
1064 } 1064 }
1065 1065
1066 override LRESULT WM_ERASEBKGND (int wParam, int lParam) { 1066 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
1067 LRESULT result = super.WM_ERASEBKGND (wParam, lParam); 1067 LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
1068 if (result !is LRESULT.NULL) return result; 1068 if (result !is null) return result;
1069 if ((state & CANVAS) !is 0) { 1069 if ((state & CANVAS) !is 0) {
1070 /* Return zero to indicate that the background was not erased */ 1070 /* Return zero to indicate that the background was not erased */
1071 if ((style & DWT.NO_BACKGROUND) !is 0) return LRESULT.ZERO; 1071 if ((style & DWT.NO_BACKGROUND) !is 0) return LRESULT.ZERO;
1072 } 1072 }
1073 return result; 1073 return result;
1074 } 1074 }
1075 1075
1076 override LRESULT WM_GETDLGCODE (int wParam, int lParam) { 1076 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
1077 LRESULT result = super.WM_GETDLGCODE (wParam, lParam); 1077 LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
1078 if (result !is LRESULT.NULL) return result; 1078 if (result !is null) return result;
1079 if ((state & CANVAS) !is 0) { 1079 if ((state & CANVAS) !is 0) {
1080 int flags = 0; 1080 int flags = 0;
1081 if (hooksKeys ()) { 1081 if (hooksKeys ()) {
1082 flags |= OS.DLGC_WANTALLKEYS | OS.DLGC_WANTARROWS | OS.DLGC_WANTTAB; 1082 flags |= OS.DLGC_WANTALLKEYS | OS.DLGC_WANTARROWS | OS.DLGC_WANTTAB;
1083 } 1083 }
1084 if ((style & DWT.NO_FOCUS) !is 0) flags |= OS.DLGC_STATIC; 1084 if ((style & DWT.NO_FOCUS) !is 0) flags |= OS.DLGC_STATIC;
1085 if (OS.GetWindow (handle, OS.GW_CHILD) !is null) flags |= OS.DLGC_STATIC; 1085 if (OS.GetWindow (handle, OS.GW_CHILD) !is null) flags |= OS.DLGC_STATIC;
1086 if (flags !is 0) return cast(LRESULT)flags; 1086 if (flags !is 0) return new LRESULT (flags);
1087 } 1087 }
1088 return result; 1088 return result;
1089 } 1089 }
1090 1090
1091 override LRESULT WM_GETFONT (int wParam, int lParam) { 1091 override LRESULT WM_GETFONT (int wParam, int lParam) {
1092 LRESULT result = super.WM_GETFONT (wParam, lParam); 1092 LRESULT result = super.WM_GETFONT (wParam, lParam);
1093 if (result !is LRESULT.NULL) return result; 1093 if (result !is null) return result;
1094 int code = callWindowProc (handle, OS.WM_GETFONT, wParam, lParam); 1094 int code = callWindowProc (handle, OS.WM_GETFONT, wParam, lParam);
1095 if (code !is 0) return cast( LRESULT )(code); 1095 if (code !is 0) return new LRESULT (code);
1096 if (font is null) font = defaultFont (); 1096 if (font is null) font = defaultFont ();
1097 return cast( LRESULT )(font); 1097 return new LRESULT (cast(int) font);
1098 } 1098 }
1099 1099
1100 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { 1100 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
1101 LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam); 1101 LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
1102 if (result is LRESULT.ZERO) return result; 1102 if (result is LRESULT.ZERO) return result;
1110 return result; 1110 return result;
1111 } 1111 }
1112 1112
1113 override LRESULT WM_NCPAINT (int wParam, int lParam) { 1113 override LRESULT WM_NCPAINT (int wParam, int lParam) {
1114 LRESULT result = super.WM_NCPAINT (wParam, lParam); 1114 LRESULT result = super.WM_NCPAINT (wParam, lParam);
1115 if (result !is LRESULT.NULL) return result; 1115 if (result !is null) return result;
1116 if ((state & CANVAS) !is 0) { 1116 if ((state & CANVAS) !is 0) {
1117 result = wmNCPaint (handle, wParam, lParam); 1117 result = wmNCPaint (handle, wParam, lParam);
1118 } 1118 }
1119 return result; 1119 return result;
1120 } 1120 }
1333 return LRESULT.ZERO; 1333 return LRESULT.ZERO;
1334 } 1334 }
1335 1335
1336 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) { 1336 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
1337 LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); 1337 LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
1338 if (result !is LRESULT.NULL) return result; 1338 if (result !is null) return result;
1339 if ((state & CANVAS) !is 0) { 1339 if ((state & CANVAS) !is 0) {
1340 forceResize (); 1340 forceResize ();
1341 auto nSavedDC = OS.SaveDC (cast(HDC)wParam); 1341 auto nSavedDC = OS.SaveDC (cast(HDC)wParam);
1342 RECT rect; 1342 RECT rect;
1343 OS.GetClientRect (handle, &rect); 1343 OS.GetClientRect (handle, &rect);
1419 return result; 1419 return result;
1420 } 1420 }
1421 1421
1422 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { 1422 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
1423 LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam); 1423 LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam);
1424 if (result !is LRESULT.NULL) return result; 1424 if (result !is null) return result;
1425 auto hwndChild = OS.GetWindow (handle, OS.GW_CHILD); 1425 auto hwndChild = OS.GetWindow (handle, OS.GW_CHILD);
1426 while (hwndChild !is null) { 1426 while (hwndChild !is null) {
1427 OS.SendMessage (hwndChild, OS.WM_SYSCOLORCHANGE, 0, 0); 1427 OS.SendMessage (hwndChild, OS.WM_SYSCOLORCHANGE, 0, 0);
1428 hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT); 1428 hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT);
1429 } 1429 }
1430 return result; 1430 return result;
1431 } 1431 }
1432 1432
1433 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) { 1433 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
1434 LRESULT result = super.WM_SYSCOMMAND (wParam, lParam); 1434 LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
1435 if (result !is LRESULT.NULL) return result; 1435 if (result !is null) return result;
1436 1436
1437 /* 1437 /*
1438 * Check to see if the command is a system command or 1438 * Check to see if the command is a system command or
1439 * a user menu item that was added to the system menu. 1439 * a user menu item that was added to the system menu.
1440 */ 1440 */
1459 (showVBar !is (verticalBar !is null && verticalBar.getVisible ()))) { 1459 (showVBar !is (verticalBar !is null && verticalBar.getVisible ()))) {
1460 int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_UPDATENOW; 1460 int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_UPDATENOW;
1461 OS.RedrawWindow (handle, null, null, flags); 1461 OS.RedrawWindow (handle, null, null, flags);
1462 } 1462 }
1463 if (code is 0) return LRESULT.ZERO; 1463 if (code is 0) return LRESULT.ZERO;
1464 return cast( LRESULT )(code); 1464 return new LRESULT (code);
1465 default: 1465 default:
1466 } 1466 }
1467 } 1467 }
1468 /* Return the result */ 1468 /* Return the result */
1469 return result; 1469 return result;
1470 } 1470 }
1471 1471
1472 override LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { 1472 override LRESULT WM_UPDATEUISTATE (int wParam, int lParam) {
1473 LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam); 1473 LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam);
1474 if (result !is LRESULT.NULL) return result; 1474 if (result !is null) return result;
1475 if ((state & CANVAS) !is 0) OS.InvalidateRect (handle, null, false); 1475 if ((state & CANVAS) !is 0) OS.InvalidateRect (handle, null, false);
1476 return result; 1476 return result;
1477 } 1477 }
1478 1478
1479 LRESULT wmNCPaint (HWND hwnd, int wParam, int lParam) { 1479 LRESULT wmNCPaint (HWND hwnd, int wParam, int lParam) {
1493 rect.left = rect.top = 0; 1493 rect.left = rect.top = 0;
1494 int border = OS.GetSystemMetrics (OS.SM_CXEDGE); 1494 int border = OS.GetSystemMetrics (OS.SM_CXEDGE);
1495 OS.ExcludeClipRect (hDC, border, border, rect.right - border, rect.bottom - border); 1495 OS.ExcludeClipRect (hDC, border, border, rect.right - border, rect.bottom - border);
1496 OS.DrawThemeBackground (display.hEditTheme (), hDC, OS.EP_EDITTEXT, OS.ETS_NORMAL, &rect, null); 1496 OS.DrawThemeBackground (display.hEditTheme (), hDC, OS.EP_EDITTEXT, OS.ETS_NORMAL, &rect, null);
1497 OS.ReleaseDC (hwnd, hDC); 1497 OS.ReleaseDC (hwnd, hDC);
1498 return cast(LRESULT )(code); 1498 return new LRESULT (code);
1499 } 1499 }
1500 } 1500 }
1501 return LRESULT.NULL; 1501 return null;
1502 } 1502 }
1503 1503
1504 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) { 1504 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
1505 if (!OS.IsWinCE) { 1505 if (!OS.IsWinCE) {
1506 switch (hdr.code) { 1506 switch (hdr.code) {