Changeset 35:99d8b02576c3
- Timestamp:
- 01/28/08 18:16:12 (1 year ago)
- Files:
-
- dwt/accessibility/Accessible.d (modified) (1 diff)
- dwt/internal/win32/OS.d (modified) (1 diff)
- dwt/widgets/Composite.d (modified) (4 diffs)
- dwt/widgets/Control.d (modified) (97 diffs)
- dwt/widgets/Decorations.d (modified) (1 diff)
- dwt/widgets/Display.d (modified) (1 diff)
- dwt/widgets/Menu.d (modified) (2 diffs)
- dwt/widgets/MenuItem.d (modified) (1 diff)
- dwt/widgets/Shell.d (modified) (2 diffs)
- dwt/widgets/Widget.d (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/accessibility/Accessible.d
r34 r35 13 13 module dwt.accessibility.Accessible; 14 14 15 import dwt.widgets.Control; 15 16 //PORTING_TYPE 16 17 public class Accessible { 18 public static Accessible internal_new_Accessible(Control control) ; 19 public void internal_dispose_Accessible() ; 20 public int /*long*/ internal_WM_GETOBJECT (int /*long*/ wParam, int /*long*/ lParam) ; 17 21 } 18 22 dwt/internal/win32/OS.d
r33 r35 4475 4475 alias WINAPI.SetBkColor SetBkColor; 4476 4476 alias WINAPI.SetBkMode SetBkMode; 4477 alias STDWIN.SetBrushOrgEx SetBrushOrgEx; 4477 4478 alias WINAPI.SetCapture SetCapture; 4478 4479 alias WINAPI.SetCaretPos SetCaretPos; dwt/widgets/Composite.d
r33 r35 15 15 import dwt.widgets.Scrollable; 16 16 import dwt.widgets.Control; 17 import dwt.widgets.Layout; 17 18 import dwt.graphics.Font; 19 import dwt.internal.win32.OS; 18 20 19 21 class Composite : Scrollable { 22 Layout layout_; 23 int font; 24 WINDOWPOS* [] lpwp; 25 Control [] tabList; 26 int layoutCount, backgroundMode; 27 20 28 public Control [] getChildren () ; 21 29 void updateFont (Font oldFont, Font newFont) ; … … 24 32 public void layout (bool , bool ) ; 25 33 public void layout (Control[]) ; 34 Control [] _getTabList () ; 35 void removeControl (Control control) ; 36 Control [] _getChildren () ; 26 37 } 27 38 /++ … … 34 45 import dwt.graphics.Point; 35 46 import dwt.graphics.Rectangle; 36 import dwt.internal.Callback;37 import dwt.internal.win32.LRESULT;38 import dwt.internal.win32.MSG;39 import dwt.internal.win32.NMHDR;40 import dwt.internal.win32.NMTTDISPINFO;41 import dwt.internal.win32.NMTTDISPINFOA;42 import dwt.internal.win32.NMTTDISPINFOW;43 47 import dwt.internal.win32.OS; 44 import dwt.internal.win32.PAINTSTRUCT;45 import dwt.internal.win32.POINT;46 import dwt.internal.win32.RECT;47 import dwt.internal.win32.WINDOWPOS;48 48 49 49 /** … … 80 80 Layout layout; 81 81 int font; 82 WINDOWPOS [] lpwp;82 WINDOWPOS* [] lpwp; 83 83 Control [] tabList; 84 84 int layoutCount, backgroundMode; dwt/widgets/Control.d
r34 r35 83 83 import dwt.widgets.Event; 84 84 import dwt.widgets.Shell; 85 import dwt.widgets.Menu; 86 import dwt.widgets.MenuItem; 87 import dwt.widgets.Decorations; 88 import dwt.widgets.TypedListener; 89 import dwt.widgets.Listener; 90 import dwt.widgets.Display; 91 92 import dwt.dwthelper.utils; 93 import dwt.dwthelper.System; 85 94 86 95 /** … … 104 113 105 114 public abstract class Control : Widget, Drawable { 115 116 alias Widget.dragDetect dragDetect; 117 106 118 /** 107 119 * the handle to the OS resource … … 500 512 } 501 513 502 intborderHandle () {514 HANDLE borderHandle () { 503 515 return handle; 504 516 } … … 510 522 Composite composite = parent; 511 523 do { 512 intmode = composite.backgroundMode;524 auto mode = composite.backgroundMode; 513 525 if (mode !is 0) { 514 526 if (mode is DWT.INHERIT_DEFAULT) { … … 537 549 } 538 550 539 bool checkHandle ( inthwnd) {551 bool checkHandle (HWND hwnd) { 540 552 return hwnd is handle; 541 553 } … … 669 681 int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); 670 682 if ((bits & OS.WS_CHILD) !is 0) { 671 OS.SetWindowLong (handle, OS.GWL_ID, handle);672 } 673 if (OS.IsDBLocale && hwndParent !is 0) {683 OS.SetWindowLong (handle, OS.GWL_ID, cast(int)handle); 684 } 685 if (OS.IsDBLocale && hwndParent !is null) { 674 686 auto hIMC = OS.ImmGetContext (hwndParent); 675 687 OS.ImmAssociateContext (handle, hIMC); … … 849 861 } 850 862 851 void drawBackground ( inthDC) {852 RECT rect = new RECT ();853 OS.GetClientRect (handle, rect);854 drawBackground (hDC, rect);855 } 856 857 void drawBackground ( int hDC, RECTrect) {863 void drawBackground (HDC hDC) { 864 RECT rect; 865 OS.GetClientRect (handle, &rect); 866 drawBackground (hDC, &rect); 867 } 868 869 void drawBackground (HDC hDC, RECT* rect) { 858 870 drawBackground (hDC, rect, -1); 859 871 } 860 872 861 void drawBackground ( int hDC, RECTrect, int pixel) {873 void drawBackground (HDC hDC, RECT* rect, int pixel) { 862 874 Control control = findBackgroundControl (); 863 875 if (control !is null) { … … 883 895 } 884 896 885 void drawImageBackground ( int hDC, int hwnd, int hBitmap, RECTrect) {886 RECT rect2 = new RECT ();887 OS.GetClientRect (hwnd, rect2);888 OS.MapWindowPoints (hwnd, handle, rect2, 2);889 int hBrush = findBrush (hBitmap, OS.BS_PATTERN);890 POINT lpPoint = new POINT ();891 OS.GetWindowOrgEx (hDC, lpPoint);892 OS.SetBrushOrgEx (hDC, -rect2.left - lpPoint.x, -rect2.top - lpPoint.y, lpPoint);893 inthOldBrush = OS.SelectObject (hDC, hBrush);897 void drawImageBackground (HDC hDC, HWND hwnd, HBITMAP hBitmap, RECT* rect) { 898 RECT rect2; 899 OS.GetClientRect (hwnd, &rect2); 900 OS.MapWindowPoints (hwnd, handle, cast(POINT*)&rect2, 2); 901 auto hBrush = findBrush ( cast(int)hBitmap, OS.BS_PATTERN); 902 POINT lpPoint; 903 OS.GetWindowOrgEx (hDC, &lpPoint); 904 OS.SetBrushOrgEx (hDC, -rect2.left - lpPoint.x, -rect2.top - lpPoint.y, &lpPoint); 905 auto hOldBrush = OS.SelectObject (hDC, hBrush); 894 906 OS.PatBlt (hDC, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, OS.PATCOPY); 895 907 OS.SetBrushOrgEx (hDC, lpPoint.x, lpPoint.y, null); … … 897 909 } 898 910 899 void drawThemeBackground ( int hDC, int hwnd, RECTrect) {911 void drawThemeBackground (HDC hDC, HWND hwnd, RECT* rect) { 900 912 /* Do nothing */ 901 913 } … … 909 921 } 910 922 911 void fillBackground ( int hDC, int pixel, RECTrect) {923 void fillBackground (HDC hDC, int pixel, RECT* rect) { 912 924 if (rect.left > rect.right || rect.top > rect.bottom) return; 913 inthPalette = display.hPalette;914 if (hPalette !is 0) {925 auto hPalette = display.hPalette; 926 if (hPalette !is null) { 915 927 OS.SelectPalette (hDC, hPalette, false); 916 928 OS.RealizePalette (hDC); … … 919 931 } 920 932 921 void fillImageBackground ( int hDC, Control control, RECTrect) {933 void fillImageBackground (HDC hDC, Control control, RECT* rect) { 922 934 if (rect.left > rect.right || rect.top > rect.bottom) return; 923 935 if (control !is null) { … … 929 941 } 930 942 931 void fillThemeBackground ( int hDC, Control control, RECTrect) {943 void fillThemeBackground (HDC hDC, Control control, RECT* rect) { 932 944 if (rect.left > rect.right || rect.top > rect.bottom) return; 933 945 if (control !is null) { … … 941 953 } 942 954 943 intfindBrush (int value, int lbStyle) {955 HBRUSH findBrush (int value, int lbStyle) { 944 956 return parent.findBrush (value, lbStyle); 945 957 } … … 966 978 char findMnemonic (char[] string) { 967 979 int index = 0; 968 int length = string.length;980 int length_ = string.length; 969 981 do { 970 while (index < length && string.charAt (index) !is '&') index++;971 if (++index >= length ) return '\0';982 while (index < length_ && string.charAt (index) !is '&') index++; 983 if (++index >= length_) return '\0'; 972 984 if (string.charAt (index) !is '&') return string.charAt (index); 973 985 index++; 974 } while (index < length );986 } while (index < length_); 975 987 return '\0'; 976 988 } … … 988 1000 } 989 1001 shell.setSavedFocus (focusControl); 990 OS.SetFocus ( 0);1002 OS.SetFocus (null); 991 1003 } 992 1004 … … 1157 1169 checkWidget (); 1158 1170 forceResize (); 1159 RECT rect = new RECT ();1160 OS.GetWindowRect (topHandle (), rect);1161 auto hwndParent = parent is null ? 0: parent.handle;1162 OS.MapWindowPoints ( 0, hwndParent,rect, 2);1171 RECT rect; 1172 OS.GetWindowRect (topHandle (), &rect); 1173 auto hwndParent = parent is null ? null : parent.handle; 1174 OS.MapWindowPoints (null, hwndParent, cast(POINT*)&rect, 2); 1163 1175 int width = rect.right - rect.left; 1164 1176 int height = rect.bottom - rect.top; … … 1168 1180 int getCodePage () { 1169 1181 if (OS.IsUnicode) return OS.CP_ACP; 1170 auto hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);1182 auto hFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 1171 1183 LOGFONT logFont; 1172 1184 OS.GetObject (hFont, LOGFONT.sizeof, &logFont); 1173 1185 int cs = logFont.lfCharSet & 0xFF; 1174 1186 int [] lpCs = new int [8]; 1175 if (OS.TranslateCharsetInfo (c s, lpCs, OS.TCI_SRCCHARSET)) {1187 if (OS.TranslateCharsetInfo (cast(uint*)cs, cast(CHARSETINFO*)lpCs.ptr, OS.TCI_SRCCHARSET)) { 1176 1188 return lpCs [1]; 1177 1189 } … … 1181 1193 char[] getClipboardText () { 1182 1194 char[] string = ""; 1183 if (OS.OpenClipboard ( 0)) {1184 inthMem = OS.GetClipboardData (OS.IsUnicode ? OS.CF_UNICODETEXT : OS.CF_TEXT);1185 if (hMem !is 0) {1195 if (OS.OpenClipboard (null)) { 1196 auto hMem = OS.GetClipboardData (OS.IsUnicode ? OS.CF_UNICODETEXT : OS.CF_TEXT); 1197 if (hMem !is null) { 1186 1198 /* Ensure byteCount is a multiple of 2 bytes on UNICODE platforms */ 1187 1199 int byteCount = OS.GlobalSize (hMem) / TCHAR.sizeof * TCHAR.sizeof; 1188 intptr = OS.GlobalLock (hMem);1189 if (ptr !is 0) {1200 auto ptr = OS.GlobalLock (hMem); 1201 if (ptr !is null) { 1190 1202 /* Use the character encoding for the default locale */ 1191 TCHAR buffer = new TCHAR (0, byteCount / TCHAR.sizeof); 1192 OS.MoveMemory (buffer, ptr, byteCount); 1193 string = buffer.toString (0, buffer.strlen ()); 1203 string = TCHARzToStr( cast(TCHAR*)ptr ); 1194 1204 OS.GlobalUnlock (hMem); 1195 1205 } … … 1254 1264 public bool getEnabled () { 1255 1265 checkWidget (); 1256 return OS.IsWindowEnabled (handle);1266 return cast(bool)OS.IsWindowEnabled (handle); 1257 1267 } 1258 1268 … … 1269 1279 public Font getFont () { 1270 1280 checkWidget (); 1271 auto hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);1281 auto hFont = cast(HFONT)OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 1272 1282 if (hFont is null) hFont = defaultFont (); 1273 1283 return Font.win32_new (display, hFont); … … 1326 1336 RECT rect; 1327 1337 OS.GetWindowRect (topHandle (), &rect); 1328 int hwndParent = parent is null ? 0: parent.handle;1329 OS.MapWindowPoints ( 0, hwndParent,&rect, 2);1338 auto hwndParent = parent is null ? null : parent.handle; 1339 OS.MapWindowPoints (null, hwndParent, cast(POINT*)&rect, 2); 1330 1340 return new Point (rect.left, rect.top); 1331 1341 } … … 1358 1368 * @since 3.0 1359 1369 */ 1360 public Monitor getMonitor () {1370 public dwt.widgets.Monitor.Monitor getMonitor () { 1361 1371 checkWidget (); 1362 1372 if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) { … … 1375 1385 monitor.clientX = lpmi.rcWork.left; 1376 1386 monitor.clientY = lpmi.rcWork.top; 1377 monitor.clientWidth = lpmi.rcWork _right - lpmi.rcWork.left;1378 monitor.clientHeight = lpmi.rcWork _bottom - lpmi.rcWork.top;1387 monitor.clientWidth = lpmi.rcWork.right - lpmi.rcWork.left; 1388 monitor.clientHeight = lpmi.rcWork.bottom - lpmi.rcWork.top; 1379 1389 return monitor; 1380 1390 } … … 1500 1510 RECT rect; 1501 1511 if (!OS.GetClientRect (handle, &rect)) return false; 1502 OS.MapWindowPoints (handle, 0,&rect, 2);1512 OS.MapWindowPoints (handle, null, cast(POINT*)&rect, 2); 1503 1513 POINT pt; 1504 return OS.GetCursorPos ( pt) && OS.PtInRect (&rect, pt);1514 return OS.GetCursorPos (&pt) && OS.PtInRect (&rect, pt); 1505 1515 } 1506 1516 … … 1570 1580 auto background = control.getBackgroundPixel (); 1571 1581 if (background !is OS.GetBkColor (hDC)) data.background = background; 1572 data.hFont = OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0);1582 data.hFont = cast(HFONT) OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); 1573 1583 data.uiState = OS.SendMessage (hwnd, OS.WM_QUERYUISTATE, 0, 0); 1574 1584 } … … 1773 1783 } 1774 1784 1775 void mapEvent ( inthwnd, Event event) {1785 void mapEvent (HWND hwnd, Event event) { 1776 1786 if (hwnd !is handle) { 1777 POINT point = new POINT ();1787 POINT point; 1778 1788 point.x = event.x; 1779 1789 point.y = event.y; 1780 OS.MapWindowPoints (hwnd, handle, point, 1);1790 OS.MapWindowPoints (hwnd, handle, &point, 1); 1781 1791 event.x = point.x; 1782 1792 event.y = point.y; … … 1822 1832 public void moveAbove (Control control) { 1823 1833 checkWidget (); 1824 int topHandle = topHandle (), hwndAbove = OS.HWND_TOP; 1834 auto topHandle_ = topHandle (); 1835 HWND hwndAbove = cast(HWND) OS.HWND_TOP; 1825 1836 if (control !is null) { 1826 1837 if (control.isDisposed ()) error(DWT.ERROR_INVALID_ARGUMENT); 1827 1838 if (parent !is control.parent) return; 1828 inthwnd = control.topHandle ();1829 if (hwnd is null || hwnd is topHandle ) return;1839 auto hwnd = control.topHandle (); 1840 if (hwnd is null || hwnd is topHandle_) return; 1830 1841 hwndAbove = OS.GetWindow (hwnd, OS.GW_HWNDPREV); 1831 1842 /* … … 1837 1848 */ 1838 1849 if (hwndAbove is null || hwndAbove is hwnd) { 1839 hwndAbove = OS.HWND_TOP;1850 hwndAbove = cast(HWND) OS.HWND_TOP; 1840 1851 } 1841 1852 } 1842 1853 int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; 1843 SetWindowPos (topHandle , hwndAbove, 0, 0, 0, 0, flags);1854 SetWindowPos (topHandle_, hwndAbove, 0, 0, 0, 0, flags); 1844 1855 } 1845 1856 … … 1866 1877 public void moveBelow (Control control) { 1867 1878 checkWidget (); 1868 auto topHandle = topHandle ();1869 int hwndAbove =OS.HWND_BOTTOM;1879 auto topHandle_ = topHandle (); 1880 HWND hwndAbove = cast(HWND)OS.HWND_BOTTOM; 1870 1881 if (control !is null) { 1871 1882 if (control.isDisposed ()) error(DWT.ERROR_INVALID_ARGUMENT); … … 1891 1902 * at the bottom. 1892 1903 */ 1893 int hwndParent = parent.handle, hwnd = hwndParent; 1904 auto hwndParent = parent.handle; 1905 auto hwnd = hwndParent; 1894 1906 hwndAbove = OS.GetWindow (hwnd, OS.GW_HWNDPREV); 1895 while (hwndAbove !is 0&& hwndAbove !is hwnd) {1907 while (hwndAbove !is null && hwndAbove !is hwnd) { 1896 1908 if (OS.GetWindow (hwndAbove, OS.GW_OWNER) is hwndParent) break; 1897 1909 hwndAbove = OS.GetWindow (hwnd = hwndAbove, OS.GW_HWNDPREV); … … 1900 1912 } 1901 1913 } 1902 if (hwndAbove is 0 || hwndAbove is topHandle) return;1914 if (hwndAbove is null || hwndAbove is topHandle_) return; 1903 1915 int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; 1904 SetWindowPos (topHandle , hwndAbove, 0, 0, 0, 0, flags);1916 SetWindowPos (topHandle_, hwndAbove, 0, 0, 0, 0, flags); 1905 1917 } 1906 1918 … … 1988 2000 int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 1989 2001 if (all) flags |= OS.RDW_ALLCHILDREN; 1990 OS.RedrawWindow (handle, null, 0, flags);2002 OS.RedrawWindow (handle, null, null, flags); 1991 2003 } 1992 2004 } … … 2025 2037 if (width <= 0 || height <= 0) return; 2026 2038 if (!OS.IsWindowVisible (handle)) return; 2027 RECT rect = new RECT ();2028 OS.SetRect ( rect, x, y, x + width, y + height);2039 RECT rect; 2040 OS.SetRect (&rect, x, y, x + width, y + height); 2029 2041 if (OS.IsWinCE) { 2030 OS.InvalidateRect (handle, rect, true);2042 OS.InvalidateRect (handle, &rect, true); 2031 2043 } else { 2032 2044 int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 2033 2045 if (all) flags |= OS.RDW_ALLCHILDREN; 2034 OS.RedrawWindow (handle, rect, 0, flags);2046 OS.RedrawWindow (handle, &rect, null, flags); 2035 2047 } 2036 2048 } … … 2061 2073 void releaseHandle () { 2062 2074 super.releaseHandle (); 2063 handle = 0;2075 handle = null; 2064 2076 parent = null; 2065 2077 } … … 2072 2084 super.releaseWidget (); 2073 2085 if (OS.IsDBLocale) { 2074 OS.ImmAssociateContext (handle, 0);2086 OS.ImmAssociateContext (handle, null); 2075 2087 } 2076 2088 if (toolTipText_ !is null) { … … 2396 2408 2397 2409 void showWidget (bool visible) { 2398 int topHandle= topHandle ();2399 OS.ShowWindow (topHandle , visible ? OS.SW_SHOW : OS.SW_HIDE);2400 if (handle !is topHandle ) OS.ShowWindow (handle, visible ? OS.SW_SHOW : OS.SW_HIDE);2410 auto topHandle_ = topHandle (); 2411 OS.ShowWindow (topHandle_, visible ? OS.SW_SHOW : OS.SW_HIDE); 2412 if (handle !is topHandle_) OS.ShowWindow (handle, visible ? OS.SW_SHOW : OS.SW_HIDE); 2401 2413 } 2402 2414 … … 2520 2532 } 2521 2533 2522 void setBackgroundImage ( inthBitmap) {2534 void setBackgroundImage (HBITMAP hBitmap) { 2523 2535 if (OS.IsWinCE) { 2524 2536 OS.InvalidateRect (handle, null, true); 2525 2537 } else { 2526 2538 int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 2527 OS.RedrawWindow (handle, null, 0, flags);2539 OS.RedrawWindow (handle, null, null, flags); 2528 2540 } 2529 2541 } … … 2534 2546 } else { 2535 2547 int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 2536 OS.RedrawWindow (handle, null, 0, flags);2548 OS.RedrawWindow (handle, null, null, flags); 2537 2549 } 2538 2550 } … … 2572 2584 2573 2585 void setBounds (int x, int y, int width, int height, int flags, bool defer) { 2574 int topHandle= topHandle ();2586 auto topHandle_ = topHandle (); 2575 2587 if (defer && parent !is null) { 2576 2588 forceResize (); 2577 if (OS.GetWindow (handle, OS.GW_CHILD) is 0) {2589 if (OS.GetWindow (handle, OS.GW_CHILD) is null) { 2578 2590 if (findImageControl () !is null) { 2579 2591 flags |= OS.SWP_NOCOPYBITS; … … 2584 2596 } 2585 2597 } 2586 WINDOWPOS [] lpwp = parent.lpwp;2598 WINDOWPOS* [] lpwp = parent.lpwp; 2587 2599 if (lpwp is null) { 2588 SetWindowPos (topHandle , 0, x, y, width, height, flags);2600 SetWindowPos (topHandle_, null, x, y, width, height, flags); 2589 2601 } else { 2590 2602 int index = 0; … … 2594 2606 } 2595 2607 if (index is lpwp.length) { 2596 WINDOWPOS [] newLpwp = new WINDOWPOS[lpwp.length + 4];2597 S ystem.arraycopy (lpwp, 0, newLpwp, 0, lpwp.length);2608 WINDOWPOS* [] newLpwp = new WINDOWPOS* [lpwp.length + 4]; 2609 SimpleType!(WINDOWPOS*).arraycopy (lpwp, 0, newLpwp, 0, lpwp.length); 2598 2610 parent.lpwp = lpwp = newLpwp; 2599 2611 } 2600 WINDOWPOS wp = new WINDOWPOS ();2601 wp.hwnd = topHandle ;2612 WINDOWPOS* wp = new WINDOWPOS; 2613 wp.hwnd = topHandle_; 2602 2614 wp.x = x; 2603 2615 wp.y = y; … … 2608 2620 } 2609 2621 } else { 2610 SetWindowPos (topHandle , 0, x, y, width, height, flags);2622 SetWindowPos (topHandle_, null, x, y, width, height, flags); 2611 2623 } 2612 2624 } … … 2687 2699 if (cursor !is null && cursor.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 2688 2700 this.cursor = cursor; 2689 if (OS.IsWinCE) {2701 static if (OS.IsWinCE) { 2690 2702 int hCursor = cursor !is null ? cursor.handle : 0; 2691 2703 OS.SetCursor (hCursor); 2692 2704 return; 2693 2705 } 2694 inthwndCursor = OS.GetCapture ();2695 if (hwndCursor is 0) {2696 POINT pt = new POINT ();2697 if (!OS.GetCursorPos ( pt)) return;2698 inthwnd = hwndCursor = OS.WindowFromPoint (pt);2699 while (hwnd !is 0&& hwnd !is handle) {2706 auto hwndCursor = OS.GetCapture (); 2707 if (hwndCursor is null) { 2708 POINT pt; 2709 if (!OS.GetCursorPos (&pt)) return; 2710 auto hwnd = hwndCursor = OS.WindowFromPoint (pt); 2711 while (hwnd !is null && hwnd !is handle) { 2700 2712 hwnd = OS.GetParent (hwnd); 2701 2713 } 2702 if (hwnd is 0) return;2714 if (hwnd is null) return; 2703 2715 } 2704 2716 Control control = display.getControl (hwndCursor); … … 2708 2720 2709 2721 void setDefaultFont () { 2710 inthFont = display.getSystemFont ().handle;2722 auto hFont = display.getSystemFont ().handle; 2711 2723 OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0); 2712 2724 } … … 2759 2771 */ 2760 2772 Control control = null; 2761 bool fixFocus = false;2773 bool fixFocus_ = false; 2762 2774 if (!enabled) { 2763 2775 if (display.focusEvent !is DWT.FocusOut) { 2764 2776 control = display.getFocusControl (); 2765 fixFocus = isFocusAncestor (control);2777 fixFocus_ = isFocusAncestor (control); 2766 2778 } 2767 2779 } 2768 2780 enableWidget (enabled); 2769 if (fixFocus ) fixFocus (control);2781 if (fixFocus_) fixFocus (control); 2770 2782 } 2771 2783 … … 2812 2824 public void setFont (Font font) { 2813 2825 checkWidget (); 2814 int hFont = 0;2826 HFONT hFont; 2815 2827 if (font !is null) { 2816 2828 if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 2817 2829 hFont = font.handle; 2818 2830 } 2819 if (hFont is 0) hFont = defaultFont ();2831 if (hFont is null) hFont = defaultFont (); 2820 2832 OS.SendMessage (handle, OS.WM_SETFONT, hFont, 1); 2821 2833 } … … 3004 3016 if (redraw) { 3005 3017 if (--drawCount is 0) { 3006 int topHandle= topHandle ();3007 OS.SendMessage (topHandle , OS.WM_SETREDRAW, 1, 0);3008 if (handle !is topHandle ) OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);3018 auto topHandle_ = topHandle (); 3019 OS.SendMessage (topHandle_, OS.WM_SETREDRAW, 1, 0); 3020 if (handle !is topHandle_) OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); 3009 3021 if ((state & HIDDEN) !is 0) { 3010 3022 state &= ~HIDDEN; 3011 OS.ShowWindow (topHandle , OS.SW_HIDE);3012 if (handle !is topHandle ) OS.ShowWindow (handle, OS.SW_HIDE);3023 OS.ShowWindow (topHandle_, OS.SW_HIDE); 3024 if (handle !is topHandle_) OS.ShowWindow (handle, OS.SW_HIDE); 3013 3025 } else { 3014 3026 if (OS.IsWinCE) { 3015 OS.InvalidateRect (topHandle , null, true);3016 if (handle !is topHandle ) OS.InvalidateRect (handle, null, true);3027 OS.InvalidateRect (topHandle_, null, true); 3028 if (handle !is topHandle_) OS.InvalidateRect (handle, null, true); 3017 3029 } else { 3018 3030 int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; 3019 OS.RedrawWindow (topHandle , null, 0, flags);3031 OS.RedrawWindow (topHandle_, null, null, flags); 3020 3032 } 3021 3033 } … … 3023 3035 } else { 3024 3036 if (drawCount++ is 0) { 3025 int topHandle= topHandle ();3026 OS.SendMessage (topHandle , OS.WM_SETREDRAW, 0, 0);3027 if (handle !is topHandle ) OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);3037 auto topHandle_ = topHandle (); 3038 OS.SendMessage (topHandle_, OS.WM_SETREDRAW, 0, 0); 3039 if (handle !is topHandle_) OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); 3028 3040 } 3029 3041 } … … 3147 3159 */ 3148 3160 Control control = null; 3149 bool fixFocus = false;3161 bool fixFocus_ = false; 3150 3162 if (!visible) { 3151 3163 if (display.focusEvent !is DWT.FocusOut) { 3152 3164 control = display.getFocusControl (); 3153 fixFocus = isFocusAncestor (control);3165 fixFocus_ = isFocusAncestor (control); 3154 3166 } 3155 3167 } … … 3164 3176 if (isDisposed ()) return; 3165 3177 } 3166 if (fixFocus ) fixFocus (control);3178 if (fixFocus_) fixFocus (control); 3167 3179 } 3168 3180 … … 3185 3197 void subclass () { 3186 3198 int oldProc = windowProc (); 3187 int newProc = display.windowProc ;3199 int newProc = display.windowProc(); 3188 3200 if (oldProc is newProc) return; 3189 3201 OS.SetWindowLong (handle, OS.GWL_WNDPROC, newProc); … … 3208 3220 public Point toControl (int x, int y) { 3209 3221 checkWidget (); 3210 POINT pt = new POINT ();3222 POINT pt; 3211 3223 pt.x = x; pt.y = y; 3212 OS.ScreenToClient (handle, pt);3224 OS.ScreenToClient (handle, &pt); 3213 3225 return new Point (pt.x, pt.y); 3214 3226 } … … 3254 3266 public Point toDisplay (int x, int y) { 3255 3267 checkWidget (); 3256 POINT pt = new POINT ();3268 POINT pt; 3257 3269 pt.x = x; pt.y = y; 3258 OS.ClientToScreen (handle, pt);3270 OS.ClientToScreen (handle, &pt); 3259 3271 return new Point (pt.x, pt.y); 3260 3272 } … … 3282 3294 } 3283 3295 3284 inttopHandle () {3296 HANDLE topHandle () { 3285 3297 return handle; 3286 3298 } … … 3299 3311 bool translateMnemonic (MSG* msg) { 3300 3312 if (msg.wParam < 0x20) return false; 3301 inthwnd = msg.hwnd;3313 auto hwnd = msg.hwnd; 3302 3314 if (OS.GetKeyState (OS.VK_MENU) >= 0) { 3303 3315 int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0); … … 3319 3331 3320 3332 bool translateTraversal (MSG* msg) { 3321 inthwnd = msg.hwnd;3333 auto hwnd = msg.hwnd; 3322 3334 int key = msg.wParam; 3323 3335 if (key is OS.VK_MENU) { … … 3391 3403 * or VK_RIGHT. 3392 3404 */ 3393 if (OS.IsSP ) {3405 if (OS.IsSP_) { 3394 3406 if (key is OS.VK_LEFT || key is OS.VK_RIGHT) return false; 3395 3407 } … … 3602 3614 int flags = OS.RDW_UPDATENOW; 3603 3615 if (all) flags |= OS.RDW_ALLCHILDREN; 3604 OS.RedrawWindow (handle, null, 0, flags);3616 OS.RedrawWindow (handle, null, null, flags); 3605 3617 } 3606 3618 } … … 3615 3627 Control control = findBackgroundControl (); 3616 3628 Image image = control !is null ? control.backgroundImage : backgroundImage; 3617 setBackgroundImage (image !is null ? image.handle : 0);3629 setBackgroundImage (image !is null ? image.handle : null); 3618 3630 } 3619 3631 … … 3627 3639 3628 3640 void updateFont (Font oldFont, Font newFont) { 3629 if (getFont () .equals (oldFont)) setFont (newFont);3641 if (getFont () ==/*eq*/oldFont ) setFont (newFont); 3630 3642 } 3631 3643 … … 3638 3650 } 3639 3651 3640 CREATESTRUCT widgetCreateStruct () {3652 CREATESTRUCT* widgetCreateStruct () { 3641 3653 return null; 3642 3654 } … … 3644 3656 int widgetExtStyle () { 3645 3657 int bits = 0; 3646 if (!OS.IsPPC ) {3658 if (!OS.IsPPC_) { 3647 3659 if ((style & DWT.BORDER) !is 0) bits |= OS.WS_EX_CLIENTEDGE; 3648 3660 } … … 3673 3685 // if ((style & DWT.FLAT) !is 0) bits |= OS.WS_BORDER; 3674 3686 // } 3675 if (OS.IsPPC ) {3687 if (OS.IsPPC_) { 3676 3688 if ((style & DWT.BORDER) !is 0) bits |= OS.WS_BORDER; 3677 3689 } … … 3720 3732 fixChildren (newShell, oldShell, newDecorations, oldDecorations, menus); 3721 3733 } 3722 int topHandle= topHandle ();3723 if (OS.SetParent (topHandle , parent.handle) is 0) return false;3734 auto topHandle_ = topHandle (); 3735 if (OS.SetParent (topHandle_, parent.handle) is null) return false; 3724 3736 this.parent = parent; 3725 3737 int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; 3726 SetWindowPos (topHandle ,OS.HWND_BOTTOM, 0, 0, 0, 0, flags);3738 SetWindowPos (topHandle_, cast(HWND)OS.HWND_BOTTOM, 0, 0, 0, 0, flags); 3727 3739 return true; 3728 3740 } 3729 3741 3730 abstract TCHARwindowClass ();3742 abstract char[] windowClass (); 3731 3743 3732 3744 abstract int windowProc (); 3733 3745 3734 int windowProc ( inthwnd, int msg, int wParam, int lParam) {3735 LRESULT result = null;3746 int windowProc (HWND hwnd, int msg, int wParam, int lParam) { 3747 LRESULT result = LRESULT.NULL; 3736 3748 switch (msg) { 3737 3749 case OS.WM_ACTIVATE: result = WM_ACTIVATE (wParam, lParam); break; … … 3824 3836 case OS.WM_XBUTTONUP: result = WM_XBUTTONUP (wParam, lParam); break; 3825 3837 } 3826 if (result !is null) return result.value;3838 if (result !is LRESULT.NULL) return result; 3827 3839 return callWindowProc (hwnd, msg, wParam, lParam); 3828 3840 } 3829 3841 3830 3842 LRESULT WM_ACTIVATE (int wParam, int lParam) { 3831 return null;3843 return LRESULT.NULL; 3832 3844 } 3833 3845 … … 3841 3853 3842 3854 LRESULT WM_CLEAR (int wParam, int lParam) { 3843 return null;3855 return LRESULT.NULL; 3844 3856 } 3845 3857 3846 3858 LRESULT WM_CLOSE (int wParam, int lParam) { 3847 return null;3859 return LRESULT.NULL; 3848 3860 } 3849 3861 … … 3862 3874 } 3863 3875 } 3864 return null;3865 } 3866 Control control = display.getControl ( lParam);3867 if (control is null) return null;3876 return LRESULT.NULL; 3877 } 3878 Control control = display.getControl (cast(HANDLE)lParam); 3879 if (control is null) return LRESULT.NULL; 3868 3880 return control.wmCommandChild (wParam, lParam); 3869 3881 } … … 3874 3886 3875 3887 LRESULT WM_CTLCOLOR (int wParam, int lParam) { 3876 inthPalette = display.hPalette;3877 if (hPalette !is 0) {3878 OS.SelectPalette ( wParam, hPalette, false);3879 OS.RealizePalette ( wParam);3880 } 3881 Control control = display.getControl ( lParam);3882 if (control is null) return null;3888 auto hPalette = display.hPalette; 3889 if (hPalette !is null) { 3890 OS.SelectPalette ( cast(HPALETTE)wParam, hPalette, false); 3891 OS.RealizePalette (cast(HPALETTE)wParam); 3892 } 3893 Control control = display.getControl (cast(HANDLE)lParam); 3894 if (control is null) return LRESULT.NULL; 3883 3895 return control.wmColorChild (wParam, lParam); 3884 3896 } 3885 3897 3886 3898 LRESULT WM_CUT (int wParam, int lParam) { 3887 return null;3899 return LRESULT.NULL; 3888 3900 } 3889 3901 3890 3902 LRESULT WM_DESTROY (int wParam, int lParam) { 3891 return null;3903 return LRESULT.NULL; 3892 3904 } 3893 3905 … … 3896 3908 if (struct_.CtlType is OS.ODT_MENU) { 3897 3909 MenuItem item = display.getMenuItem (struct_.itemID); 3898 if (item is null) return null;3910 if (item is null) return LRESULT.NULL; 3899 3911 return item.wmDrawChild (wParam, lParam); 3900 3912 } 3901 3913 Control control = display.getControl (struct_.hwndItem); 3902 if (control is null) return null;3914 if (control is null) return LRESULT.NULL; 3903 3915 return control.wmDrawChild (wParam, lParam); 3904 3916 } 3905 3917 3906 3918 LRESULT WM_ENDSESSION (int wParam, int lParam) { 3907 return null;3919 return LRESULT.NULL; 3908 3920 } 3909 3921 3910 3922 LRESULT WM_ENTERIDLE (int wParam, int lParam) { 3911 return null;3923 return LRESULT.NULL; 3912 3924 } 3913 3925 … … 3921 3933 } 3922 3934 } 3923 return null;3935 return LRESULT.NULL; 3924 3936 } 3925 3937 3926 3938 LRESULT WM_GETDLGCODE (int wParam, int lParam) { 3927 return null;3939 return LRESULT.NULL; 3928 3940 } 3929 3941 3930 3942 LRESULT WM_GETFONT (int wParam, int lParam) { 3931 return null;3943 return LRESULT.NULL; 3932 3944 } 3933 3945 3934 3946 LRESULT WM_GETOBJECT (int wParam, int lParam) { 3935 3947 if (accessible !is null) { 3936 int result =accessible.internal_WM_GETOBJECT (wParam, lParam);3937 if (result !is 0) return new LRESULT (result);3938 } 3939 return null;3948 LRESULT result = cast(LRESULT) accessible.internal_WM_GETOBJECT (wParam, lParam); 3949 if (result !is 0) return result; 3950 } 3951 return LRESULT.NULL; 3940 3952 } 3941 3953 3942 3954 LRESULT WM_GETMINMAXINFO (int wParam, int lParam) { 3943 return null;3955 return LRESULT.NULL; 3944 3956 } 3945 3957 3946 3958 LRESULT WM_HOTKEY (int wParam, int lParam) { 3947 return null;3959 return LRESULT.NULL; 3948 3960 } 3949 3961 3950 3962 LRESULT WM_HELP (int wParam, int lParam) { 3951 if (OS.IsWinCE) return null; 3952 HELPINFO lphi = new HELPINFO (); 3953 OS.MoveMemory (lphi, lParam, HELPINFO.sizeof); 3963 if (OS.IsWinCE) return LRESULT.NULL; 3964 HELPINFO* lphi = cast(HELPINFO*)lParam; 3954 3965 Decorations shell = menuShell (); 3955 if (!shell.isEnabled ()) return null;3966 if (!shell.isEnabled ()) return LRESULT.NULL; 3956 3967 if (lphi.iContextType is OS.HELPINFO_MENUITEM) { 3957 3968 MenuItem item = display.getMenuItem (lphi.iCtrlId); … … 3965 3976 } 3966 3977 if (widget !is null) { 3967 inthwndShell = shell.handle;3978 auto hwndShell = shell.handle; 3968 3979 OS.SendMessage (hwndShell, OS.WM_CANCELMODE, 0, 0); 3969 3980 widget.postEvent (DWT.Help); … … 3971 3982 } 3972 3983 } 3973 return null;3984 return LRESULT.NULL; 3974 3985 } 3975 3986 if (hooks (DWT.Help)) { … … 3977 3988 return LRESULT.ONE; 3978 3989 } 3979 return null;3990 return LRESULT.NULL; 3980 3991 } 3981 3992 3982 3993 LRESULT WM_HSCROLL (int wParam, int lParam) { 3983 Control control = display.getControl ( lParam);3984 if (control is null) return null;3994 Control control = display.getControl (cast(HANDLE)lParam); 3995 if (control is null) return LRESULT.NULL; 3985 3996 return control.wmScrollChild (wParam, lParam); 3986 3997 } … … 3991 4002 3992 4003 LRESULT WM_IME_COMPOSITION (int wParam, int lParam) { 3993 return null;4004 return LRESUL
