Changeset 37:e3a5d61b33cd
- Timestamp:
- 02/01/08 08:26:47
(1 year ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Composite
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r35 |
r37 |
|
| 41 | 41 | |
|---|
| 42 | 42 | public class OS : C { |
|---|
| | 43 | |
|---|
| | 44 | public static HINSTANCE GetLibraryHandle(){ |
|---|
| | 45 | //PORTING_FIXME: GetLibraryHandle |
|---|
| | 46 | // is the hInstance of the DLL or null, if not a DLL. |
|---|
| | 47 | // At the moment DWT is statically linked but this needs to be fixed |
|---|
| | 48 | return null; |
|---|
| | 49 | } |
|---|
| | 50 | |
|---|
| 43 | 51 | |
|---|
| 44 | 52 | private static int getNOTIFYICONDATAA_V2_SIZE (){ |
|---|
| … | … | |
| 4041 | 4049 | alias WINAPI.AlphaBlend AlphaBlend; |
|---|
| 4042 | 4050 | alias WINAPI.Arc Arc; |
|---|
| | 4051 | alias WINAPI.BeginBufferedPaint BeginBufferedPaint; |
|---|
| 4043 | 4052 | alias WINAPI.BeginDeferWindowPos BeginDeferWindowPos; |
|---|
| 4044 | 4053 | alias WINAPI.BeginPaint BeginPaint; |
|---|
| … | … | |
| 4146 | 4155 | alias WINAPI.EnableWindow EnableWindow; |
|---|
| 4147 | 4156 | alias WINAPI.EndDeferWindowPos EndDeferWindowPos; |
|---|
| | 4157 | alias WINAPI.EndBufferedPaint EndBufferedPaint; |
|---|
| 4148 | 4158 | alias WINAPI.EndDoc EndDoc; |
|---|
| 4149 | 4159 | alias WINAPI.EndPage EndPage; |
|---|
| … | … | |
| 4287 | 4297 | alias WINAPI.GetVersionExW GetVersionExW; |
|---|
| 4288 | 4298 | alias WINAPI.GetWindow GetWindow; |
|---|
| | 4299 | alias STDWIN.GetWindowDC GetWindowDC; |
|---|
| 4289 | 4300 | alias STDWIN.GetWindowOrgEx GetWindowOrgEx; |
|---|
| 4290 | 4301 | alias WINAPI.GetWindowLongA GetWindowLongA; |
|---|
| r33 |
r37 |
|
| 10 | 10 | import tango_sys_win32.Types; |
|---|
| 11 | 11 | import STDWIN = tango_sys_win32.UserGdi; |
|---|
| | 12 | |
|---|
| | 13 | alias HANDLE HPAINTBUFFER; |
|---|
| 12 | 14 | |
|---|
| 13 | 15 | extern (Windows){ |
|---|
| … | … | |
| 120 | 122 | HWND hWnd |
|---|
| 121 | 123 | ); |
|---|
| | 124 | HPAINTBUFFER BeginBufferedPaint( |
|---|
| | 125 | HDC hdcTarget, |
|---|
| | 126 | RECT *prcTarget, |
|---|
| | 127 | uint/+BP_BUFFERFORMAT+/ dwFormat, |
|---|
| | 128 | void*/+BP_PAINTPARAMS+/ pPaintParams, |
|---|
| | 129 | HDC *phdc |
|---|
| | 130 | ); |
|---|
| | 131 | HRESULT EndBufferedPaint( |
|---|
| | 132 | HPAINTBUFFER hBufferedPaint, |
|---|
| | 133 | BOOL fUpdateTarget |
|---|
| | 134 | ); |
|---|
| 122 | 135 | } |
|---|
| 123 | | |
|---|
| | 136 | //-------------------------------------------------------------------------------------- |
|---|
| 124 | 137 | |
|---|
| 125 | 138 | // Windows API |
|---|
| r35 |
r37 |
|
| 13 | 13 | module dwt.widgets.Composite; |
|---|
| 14 | 14 | |
|---|
| 15 | | import dwt.widgets.Scrollable; |
|---|
| 16 | | import dwt.widgets.Control; |
|---|
| 17 | | import dwt.widgets.Layout; |
|---|
| 18 | | import dwt.graphics.Font; |
|---|
| 19 | | import dwt.internal.win32.OS; |
|---|
| 20 | | |
|---|
| 21 | | class Composite : Scrollable { |
|---|
| 22 | | Layout layout_; |
|---|
| 23 | | int font; |
|---|
| 24 | | WINDOWPOS* [] lpwp; |
|---|
| 25 | | Control [] tabList; |
|---|
| 26 | | int layoutCount, backgroundMode; |
|---|
| 27 | | |
|---|
| 28 | | public Control [] getChildren () ; |
|---|
| 29 | | void updateFont (Font oldFont, Font newFont) ; |
|---|
| 30 | | public void layout () ; |
|---|
| 31 | | public void layout (bool ) ; |
|---|
| 32 | | public void layout (bool , bool ) ; |
|---|
| 33 | | public void layout (Control[]) ; |
|---|
| 34 | | Control [] _getTabList () ; |
|---|
| 35 | | void removeControl (Control control) ; |
|---|
| 36 | | Control [] _getChildren () ; |
|---|
| 37 | | } |
|---|
| 38 | | /++ |
|---|
| | 15 | |
|---|
| 39 | 16 | import dwt.DWT; |
|---|
| 40 | 17 | import dwt.DWTException; |
|---|
| … | … | |
| 46 | 23 | import dwt.graphics.Rectangle; |
|---|
| 47 | 24 | import dwt.internal.win32.OS; |
|---|
| | 25 | import dwt.widgets.Scrollable; |
|---|
| | 26 | import dwt.widgets.Control; |
|---|
| | 27 | import dwt.widgets.Layout; |
|---|
| | 28 | import dwt.widgets.Menu; |
|---|
| | 29 | import dwt.widgets.Shell; |
|---|
| | 30 | import dwt.widgets.Decorations; |
|---|
| | 31 | import dwt.widgets.Event; |
|---|
| | 32 | import dwt.widgets.ToolTip; |
|---|
| | 33 | import dwt.widgets.Display; |
|---|
| | 34 | |
|---|
| | 35 | import dwt.dwthelper.System; |
|---|
| | 36 | import dwt.dwthelper.utils; |
|---|
| 48 | 37 | |
|---|
| 49 | 38 | /** |
|---|
| … | … | |
| 77 | 66 | */ |
|---|
| 78 | 67 | |
|---|
| 79 | | public class Composite extends Scrollable { |
|---|
| 80 | | Layout layout; |
|---|
| 81 | | int font; |
|---|
| | 68 | public class Composite : Scrollable { |
|---|
| | 69 | Layout layout_; |
|---|
| | 70 | HFONT font; |
|---|
| 82 | 71 | WINDOWPOS* [] lpwp; |
|---|
| 83 | 72 | Control [] tabList; |
|---|
| … | … | |
| 87 | 76 | * Prevents uninitialized instances from being created outside the package. |
|---|
| 88 | 77 | */ |
|---|
| 89 | | Composite () { |
|---|
| | 78 | this () { |
|---|
| 90 | 79 | } |
|---|
| 91 | 80 | |
|---|
| … | … | |
| 120 | 109 | * @see Widget#getStyle |
|---|
| 121 | 110 | */ |
|---|
| 122 | | public Composite (Composite parent, int style) { |
|---|
| | 111 | public this (Composite parent, int style) { |
|---|
| 123 | 112 | super (parent, style); |
|---|
| 124 | 113 | } |
|---|
| … | … | |
| 126 | 115 | Control [] _getChildren () { |
|---|
| 127 | 116 | int count = 0; |
|---|
| 128 | | int hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| 129 | | if (hwndChild is 0) return new Control [0]; |
|---|
| 130 | | while (hwndChild !is 0) { |
|---|
| | 117 | auto hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| | 118 | if (hwndChild is null) return new Control [0]; |
|---|
| | 119 | while (hwndChild !is null) { |
|---|
| 131 | 120 | count++; |
|---|
| 132 | 121 | hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT); |
|---|
| … | … | |
| 135 | 124 | int index = 0; |
|---|
| 136 | 125 | hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| 137 | | while (hwndChild !is 0) { |
|---|
| | 126 | while (hwndChild !is null) { |
|---|
| 138 | 127 | Control control = display.getControl (hwndChild); |
|---|
| 139 | 128 | if (control !is null && control !is this) { |
|---|
| … | … | |
| 204 | 193 | Composite composite = child.parent; |
|---|
| 205 | 194 | while (child !is this) { |
|---|
| 206 | | if (composite.layout is null || !composite.layout.flushCache (child)) { |
|---|
| | 195 | if (composite.layout_ is null || !composite.layout_.flushCache (child)) { |
|---|
| 207 | 196 | composite.state |= LAYOUT_CHANGED; |
|---|
| 208 | 197 | } |
|---|
| … | … | |
| 243 | 232 | checkWidget (); |
|---|
| 244 | 233 | Point size; |
|---|
| 245 | | if (layout !is null) { |
|---|
| | 234 | if (layout_ !is null) { |
|---|
| 246 | 235 | if (wHint is DWT.DEFAULT || hHint is DWT.DEFAULT) { |
|---|
| 247 | 236 | changed |= (state & LAYOUT_CHANGED) !is 0; |
|---|
| 248 | 237 | state &= ~LAYOUT_CHANGED; |
|---|
| 249 | | size = layout.computeSize (this, wHint, hHint, changed); |
|---|
| | 238 | size = layout_.computeSize (this, wHint, hHint, changed); |
|---|
| 250 | 239 | } else { |
|---|
| 251 | 240 | size = new Point (wHint, hHint); |
|---|
| … | … | |
| 375 | 364 | */ |
|---|
| 376 | 365 | int count = 0; |
|---|
| 377 | | int hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| 378 | | while (hwndChild !is 0) { |
|---|
| | 366 | auto hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| | 367 | while (hwndChild !is null) { |
|---|
| 379 | 368 | count++; |
|---|
| 380 | 369 | hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT); |
|---|
| … | … | |
| 396 | 385 | public Layout getLayout () { |
|---|
| 397 | 386 | checkWidget (); |
|---|
| 398 | | return layout; |
|---|
| | 387 | return layout_; |
|---|
| 399 | 388 | } |
|---|
| 400 | 389 | |
|---|
| … | … | |
| 536 | 525 | public void layout (bool changed) { |
|---|
| 537 | 526 | checkWidget (); |
|---|
| 538 | | if (layout is null) return; |
|---|
| | 527 | if (layout_ is null) return; |
|---|
| 539 | 528 | layout (changed, false); |
|---|
| 540 | 529 | } |
|---|
| … | … | |
| 577 | 566 | public void layout (bool changed, bool all) { |
|---|
| 578 | 567 | checkWidget (); |
|---|
| 579 | | if (layout is null && !all) return; |
|---|
| | 568 | if (layout_ is null && !all) return; |
|---|
| 580 | 569 | markLayout (changed, all); |
|---|
| 581 | 570 | updateLayout (true, all); |
|---|
| … | … | |
| 632 | 621 | Composite composite = child.parent; |
|---|
| 633 | 622 | while (child !is this) { |
|---|
| 634 | | if (composite.layout !is null) { |
|---|
| | 623 | if (composite.layout_ !is null) { |
|---|
| 635 | 624 | composite.state |= LAYOUT_NEEDED; |
|---|
| 636 | | if (!composite.layout.flushCache (child)) { |
|---|
| | 625 | if (!composite.layout_.flushCache (child)) { |
|---|
| 637 | 626 | composite.state |= LAYOUT_CHANGED; |
|---|
| 638 | 627 | } |
|---|
| … | … | |
| 653 | 642 | |
|---|
| 654 | 643 | void markLayout (bool changed, bool all) { |
|---|
| 655 | | if (layout !is null) { |
|---|
| | 644 | if (layout_ !is null) { |
|---|
| 656 | 645 | state |= LAYOUT_NEEDED; |
|---|
| 657 | 646 | if (changed) state |= LAYOUT_CHANGED; |
|---|
| … | … | |
| 699 | 688 | super.releaseWidget (); |
|---|
| 700 | 689 | if ((state & CANVAS) !is 0 && (style & DWT.EMBEDDED) !is 0) { |
|---|
| 701 | | int hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| 702 | | if (hwndChild !is 0) { |
|---|
| | 690 | auto hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| | 691 | if (hwndChild !is null) { |
|---|
| 703 | 692 | int threadId = OS.GetWindowThreadProcessId (hwndChild, null); |
|---|
| 704 | 693 | if (threadId !is OS.GetCurrentThreadId ()) { |
|---|
| 705 | 694 | OS.ShowWindow (hwndChild, OS.SW_HIDE); |
|---|
| 706 | | OS.SetParent (hwndChild, 0); |
|---|
| 707 | | } |
|---|
| 708 | | } |
|---|
| 709 | | } |
|---|
| 710 | | layout = null; |
|---|
| | 695 | OS.SetParent (hwndChild, null); |
|---|
| | 696 | } |
|---|
| | 697 | } |
|---|
| | 698 | } |
|---|
| | 699 | layout_ = null; |
|---|
| 711 | 700 | tabList = null; |
|---|
| 712 | 701 | lpwp = null; |
|---|
| … | … | |
| 721 | 710 | if (lpwp is null) return; |
|---|
| 722 | 711 | do { |
|---|
| 723 | | WINDOWPOS [] currentLpwp = lpwp; |
|---|
| | 712 | WINDOWPOS* [] currentLpwp = lpwp; |
|---|
| 724 | 713 | lpwp = null; |
|---|
| 725 | 714 | if (!resizeChildren (true, currentLpwp)) { |
|---|
| … | … | |
| 729 | 718 | } |
|---|
| 730 | 719 | |
|---|
| 731 | | bool resizeChildren (bool defer, WINDOWPOS [] pwp) { |
|---|
| | 720 | bool resizeChildren (bool defer, WINDOWPOS* [] pwp) { |
|---|
| 732 | 721 | if (pwp is null) return true; |
|---|
| 733 | | int hdwp = 0; |
|---|
| | 722 | HDWP hdwp; |
|---|
| 734 | 723 | if (defer) { |
|---|
| 735 | 724 | hdwp = OS.BeginDeferWindowPos (pwp.length); |
|---|
| 736 | | if (hdwp is 0) return false; |
|---|
| | 725 | if (hdwp is null) return false; |
|---|
| 737 | 726 | } |
|---|
| 738 | 727 | for (int i=0; i<pwp.length; i++) { |
|---|
| 739 | | WINDOWPOS wp = pwp [i]; |
|---|
| | 728 | WINDOWPOS* wp = pwp [i]; |
|---|
| 740 | 729 | if (wp !is null) { |
|---|
| 741 | 730 | /* |
|---|
| … | … | |
| 750 | 739 | // } |
|---|
| 751 | 740 | if (defer) { |
|---|
| 752 | | hdwp = DeferWindowPos (hdwp, wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| 753 | | if (hdwp is 0) return false; |
|---|
| | 741 | hdwp = DeferWindowPos (hdwp, wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| | 742 | if (hdwp is null) return false; |
|---|
| 754 | 743 | } else { |
|---|
| 755 | | SetWindowPos (wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| 756 | | } |
|---|
| 757 | | } |
|---|
| 758 | | } |
|---|
| 759 | | if (defer) return OS.EndDeferWindowPos (hdwp); |
|---|
| | 744 | SetWindowPos (wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| | 745 | } |
|---|
| | 746 | } |
|---|
| | 747 | } |
|---|
| | 748 | if (defer) return cast(bool)OS.EndDeferWindowPos (hdwp); |
|---|
| 760 | 749 | return true; |
|---|
| 761 | 750 | } |
|---|
| 762 | 751 | |
|---|
| 763 | | void resizeEmbeddedHandle(int embeddedHandle, int width, int height) { |
|---|
| 764 | | if (embeddedHandle is 0) return; |
|---|
| 765 | | int [] processID = new int [1]; |
|---|
| 766 | | int threadId = OS.GetWindowThreadProcessId (embeddedHandle, processID); |
|---|
| | 752 | void resizeEmbeddedHandle(HANDLE embeddedHandle, int width, int height) { |
|---|
| | 753 | if (embeddedHandle is null) return; |
|---|
| | 754 | uint processID; |
|---|
| | 755 | int threadId = OS.GetWindowThreadProcessId (embeddedHandle, &processID); |
|---|
| 767 | 756 | if (threadId !is OS.GetCurrentThreadId ()) { |
|---|
| 768 | | if (processID [0] is OS.GetCurrentProcessId ()) { |
|---|
| 769 | | if (display.msgHook is 0) { |
|---|
| | 757 | if (processID is OS.GetCurrentProcessId ()) { |
|---|
| | 758 | if (display.msgHook is null) { |
|---|
| 770 | 759 | if (!OS.IsWinCE) { |
|---|
| 771 | | display.getMsgCallback = new Callback (display, "getMsgProc", 3); |
|---|
| 772 | | display.getMsgProc = display.getMsgCallback.getAddress (); |
|---|
| 773 | | if (display.getMsgProc is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); |
|---|
| 774 | | display.msgHook = OS.SetWindowsHookEx (OS.WH_GETMESSAGE, display.getMsgProc, OS.GetLibraryHandle(), threadId); |
|---|
| | 760 | //display.getMsgCallback = new Callback (display, "getMsgProc", 3); |
|---|
| | 761 | //display.getMsgProc = display.getMsgCallback.getAddress (); |
|---|
| | 762 | //if (display.getMsgProc is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); |
|---|
| | 763 | display.msgHook = OS.SetWindowsHookEx (OS.WH_GETMESSAGE, &Display.getMsgFunc, OS.GetLibraryHandle(), threadId); |
|---|
| 775 | 764 | OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0); |
|---|
| 776 | 765 | } |
|---|
| … | … | |
| 778 | 767 | } |
|---|
| 779 | 768 | int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE | OS.SWP_ASYNCWINDOWPOS; |
|---|
| 780 | | OS.SetWindowPos (embeddedHandle, 0, 0, 0, width, height, flags); |
|---|
| | 769 | OS.SetWindowPos (embeddedHandle, null, 0, 0, width, height, flags); |
|---|
| 781 | 770 | } |
|---|
| 782 | 771 | } |
|---|
| … | … | |
| 786 | 775 | sendEvent (DWT.Resize); |
|---|
| 787 | 776 | if (isDisposed ()) return; |
|---|
| 788 | | if (layout !is null) { |
|---|
| | 777 | if (layout_ !is null) { |
|---|
| 789 | 778 | markLayout (false, false); |
|---|
| 790 | 779 | updateLayout (false, false); |
|---|
| … | … | |
| 858 | 847 | * </ul> |
|---|
| 859 | 848 | */ |
|---|
| 860 | | public void setLayout (Layout layout) { |
|---|
| | 849 | public void setLayout (Layout layout_) { |
|---|
| 861 | 850 | checkWidget (); |
|---|
| 862 | | this.layout = layout; |
|---|
| | 851 | this.layout_ = layout_; |
|---|
| 863 | 852 | } |
|---|
| 864 | 853 | |
|---|
| … | … | |
| 933 | 922 | int count = getChildrenCount (); |
|---|
| 934 | 923 | if (count > 1 && lpwp is null) { |
|---|
| 935 | | lpwp = new WINDOWPOS [count]; |
|---|
| | 924 | lpwp = new WINDOWPOS* [count]; |
|---|
| 936 | 925 | } |
|---|
| 937 | 926 | } |
|---|
| … | … | |
| 958 | 947 | } |
|---|
| 959 | 948 | |
|---|
| 960 | | String toolTipText (NMTTDISPINFO hdr) { |
|---|
| | 949 | char[] toolTipText (NMTTDISPINFO* hdr) { |
|---|
| 961 | 950 | Shell shell = getShell (); |
|---|
| 962 | 951 | if ((hdr.uFlags & OS.TTF_IDISHWND) is 0) { |
|---|
| 963 | | String string = null; |
|---|
| 964 | | ToolTip toolTip = shell.findToolTip (hdr.idFrom); |
|---|
| | 952 | char[] string = null; |
|---|
| | 953 | ToolTip toolTip = shell.findToolTip (hdr.hdr.idFrom); |
|---|
| 965 | 954 | if (toolTip !is null) { |
|---|
| 966 | 955 | string = toolTip.message; |
|---|
| 967 | | if (string is null || string.length () is 0) string = " "; |
|---|
| | 956 | if (string is null || string.length is 0) string = " "; |
|---|
| 968 | 957 | } |
|---|
| 969 | 958 | return string; |
|---|
| 970 | 959 | } |
|---|
| 971 | | shell.setToolTipTitle (hdr.hwndFrom, null, 0); |
|---|
| 972 | | OS.SendMessage (hdr.hwndFrom, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF); |
|---|
| 973 | | Control control = display.getControl (hdr.idFrom); |
|---|
| 974 | | return control !is null ? control.toolTipText : null; |
|---|
| | 960 | shell.setToolTipTitle (hdr.hdr.hwndFrom, null, null); |
|---|
| | 961 | OS.SendMessage (hdr.hdr.hwndFrom, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF); |
|---|
| | 962 | Control control = display.getControl ( cast(HANDLE) hdr.hdr.idFrom); |
|---|
| | 963 | return control !is null ? control.toolTipText_ : null; |
|---|
| 975 | 964 | } |
|---|
| 976 | 965 | |
|---|
| … | … | |
| 987 | 976 | } |
|---|
| 988 | 977 | |
|---|
| 989 | | bool translateTraversal (MSG msg) { |
|---|
| | 978 | bool translateTraversal (MSG* msg) { |
|---|
| 990 | 979 | if ((state & CANVAS) !is 0 ) { |
|---|
| 991 | 980 | if ((style & DWT.EMBEDDED) !is 0) return false; |
|---|
| … | … | |
| 1053 | 1042 | state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED); |
|---|
| 1054 | 1043 | if (resize) setResizeChildren (false); |
|---|
| 1055 | | layout.layout (this, changed); |
|---|
| | 1044 | layout_.layout (this, changed); |
|---|
| 1056 | 1045 | if (resize) setResizeChildren (true); |
|---|
| 1057 | 1046 | } |
|---|
| … | … | |
| 1072 | 1061 | LRESULT WM_ERASEBKGND (int wParam, int lParam) { |
|---|
| 1073 | 1062 | LRESULT result = super.WM_ERASEBKGND (wParam, lParam); |
|---|
| 1074 | | if (result !is null) return result; |
|---|
| | 1063 | if (result !is LRESULT.NULL) return result; |
|---|
| 1075 | 1064 | if ((state & CANVAS) !is 0) { |
|---|
| 1076 | 1065 | /* Return zero to indicate that the background was not erased */ |
|---|
| … | … | |
| 1082 | 1071 | LRESULT WM_GETDLGCODE (int wParam, int lParam) { |
|---|
| 1083 | 1072 | LRESULT result = super.WM_GETDLGCODE (wParam, lParam); |
|---|
| 1084 | | if (result !is null) return result; |
|---|
| | 1073 | if (result !is LRESULT.NULL) return result; |
|---|
| 1085 | 1074 | if ((state & CANVAS) !is 0) { |
|---|
| 1086 | 1075 | int flags = 0; |
|---|
| … | … | |
| 1089 | 1078 | } |
|---|
| 1090 | 1079 | if ((style & DWT.NO_FOCUS) !is 0) flags |= OS.DLGC_STATIC; |
|---|
| 1091 | | if (OS.GetWindow (handle, OS.GW_CHILD) !is 0) flags |= OS.DLGC_STATIC; |
|---|
| 1092 | | if (flags !is 0) return new LRESULT (flags); |
|---|
| | 1080 | if (OS.GetWindow (handle, OS.GW_CHILD) !is null) flags |= OS.DLGC_STATIC; |
|---|
| | 1081 | if (flags !is 0) return cast(LRESULT)flags; |
|---|
| 1093 | 1082 | } |
|---|
| 1094 | 1083 | return result; |
|---|
| … | … | |
| 1097 | 1086 | LRESULT WM_GETFONT (int wParam, int lParam) { |
|---|
| 1098 | 1087 | LRESULT result = super.WM_GETFONT (wParam, lParam); |
|---|
| 1099 | | if (result !is null) return result; |
|---|
| | 1088 | if (result !is LRESULT.NULL) return result; |
|---|
| 1100 | 1089 | int code = callWindowProc (handle, OS.WM_GETFONT, wParam, lParam); |
|---|
| 1101 | | if (code !is 0) return new LRESULT (code); |
|---|
| 1102 | | if (font is 0) font = defaultFont (); |
|---|
| 1103 | | return new LRESULT (font); |
|---|
| | 1090 | if (code !is 0) return cast( LRESULT )(code); |
|---|
| | 1091 | if (font is null) font = defaultFont (); |
|---|
| | 1092 | return cast( LRESULT )(font); |
|---|
| 1104 | 1093 | } |
|---|
| 1105 | 1094 | |
|---|
| … | … | |
| 1111 | 1100 | if ((state & CANVAS) !is 0) { |
|---|
| 1112 | 1101 | if ((style & DWT.NO_FOCUS) is 0 && hooksKeys ()) { |
|---|
| 1113 | | if (OS.GetWindow (handle, OS.GW_CHILD) is 0) setFocus (); |
|---|
| | 1102 | if (OS.GetWindow (handle, OS.GW_CHILD) is null) setFocus (); |
|---|
| 1114 | 1103 | } |
|---|
| 1115 | 1104 | } |
|---|
| … | … | |
| 1119 | 1108 | LRESULT WM_NCPAINT (int wParam, int lParam) { |
|---|
| 1120 | 1109 | LRESULT result = super.WM_NCPAINT (wParam, lParam); |
|---|
| 1121 | | if (result !is null) return result; |
|---|
| | 1110 | if (result !is LRESULT.NULL) return result; |
|---|
| 1122 | 1111 | if ((state & CANVAS) !is 0) { |
|---|
| 1123 | 1112 | result = wmNCPaint (handle, wParam, lParam); |
|---|
| … | … | |
| 1129 | 1118 | if ((state & CANVAS) !is 0 && (style & DWT.EMBEDDED) !is 0) { |
|---|
| 1130 | 1119 | if ((wParam & 0xFFFF) is OS.WM_CREATE) { |
|---|
| 1131 | | RECT rect = new RECT (); |
|---|
| 1132 | | OS.GetClientRect (handle, rect); |
|---|
| 1133 | | resizeEmbeddedHandle (lParam, rect.right - rect.left, rect.bottom - rect.top); |
|---|
| | 1120 | RECT rect; |
|---|
| | 1121 | OS.GetClientRect (handle, &rect); |
|---|
| | 1122 | resizeEmbeddedHandle ( cast(HANDLE)lParam, rect.right - rect.left, rect.bottom - rect.top); |
|---|
| 1134 | 1123 | } |
|---|
| 1135 | 1124 | } |
|---|
| … | … | |
| 1151 | 1140 | |
|---|
| 1152 | 1141 | /* Paint the control and the background */ |
|---|
| 1153 | | PAINTSTRUCT ps = new PAINTSTRUCT (); |
|---|
| | 1142 | PAINTSTRUCT ps; |
|---|
| 1154 | 1143 | if (hooks (DWT.Paint)) { |
|---|
| 1155 | 1144 | |
|---|
| … | … | |
| 1164 | 1153 | } |
|---|
| 1165 | 1154 | if (bufferedPaint) { |
|---|
| 1166 | | int hDC = OS.BeginPaint (handle, ps); |
|---|
| 1167 | | int width = ps.right - ps.left; |
|---|
| 1168 | | int height = ps.bottom - ps.top; |
|---|
| | 1155 | auto hDC = OS.BeginPaint (handle, &ps); |
|---|
| | 1156 | int width = ps.rcPaint.right - ps.rcPaint.left; |
|---|
| | 1157 | int height = ps.rcPaint.bottom - ps.rcPaint.top; |
|---|
| 1169 | 1158 | if (width !is 0 && height !is 0) { |
|---|
| 1170 | | int [] phdc = new int [1]; |
|---|
| | 1159 | HDC phdc; |
|---|
| 1171 | 1160 | int flags = OS.BPBF_COMPATIBLEBITMAP; |
|---|
| 1172 | | RECT prcTarget = new RECT (); |
|---|
| 1173 | | OS.SetRect (prcTarget, ps.left, ps.top, ps.right, ps.bottom); |
|---|
| 1174 | | int hBufferedPaint = OS.BeginBufferedPaint (hDC, prcTarget, flags, null, phdc); |
|---|
| | 1161 | RECT prcTarget; |
|---|
| | 1162 | OS.SetRect (&prcTarget, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); |
|---|
| | 1163 | auto hBufferedPaint = OS.BeginBufferedPaint (hDC, &prcTarget, flags, null, &phdc); |
|---|
| 1175 | 1164 | GCData data = new GCData (); |
|---|
| 1176 | 1165 | if ((OS.GetLayout (hDC) & OS.LAYOUT_RTL) !is 0) { |
|---|
| … | … | |
| 1184 | 1173 | if (control is null) control = this; |
|---|
| 1185 | 1174 | data.background = control.getBackgroundPixel (); |
|---|
| 1186 | | data.hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| | 1175 | data.hFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| 1187 | 1176 | data.uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); |
|---|
| 1188 | 1177 | if ((style & DWT.NO_BACKGROUND) !is 0) { |
|---|
| … | … | |
| 1190 | 1179 | //paintGC.copyArea (image, ps.left, ps.top); |
|---|
| 1191 | 1180 | } else { |
|---|
| 1192 | | RECT rect = new RECT (); |
|---|
| 1193 | | OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom); |
|---|
| 1194 | | drawBackground (phdc [0], rect); |
|---|
| | 1181 | RECT rect; |
|---|
| | 1182 | OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); |
|---|
| | 1183 | drawBackground (phdc, &rect); |
|---|
| 1195 | 1184 | } |
|---|
| 1196 | | GC gc = GC.win32_new (phdc [0], data); |
|---|
| | 1185 | GC gc = GC.win32_new (phdc, data); |
|---|
| 1197 | 1186 | Event event = new Event (); |
|---|
| 1198 | 1187 | event.gc = gc; |
|---|
| 1199 | | event.x = ps.left; |
|---|
| 1200 | | event.y = ps.top; |
|---|
| | 1188 | event.x = ps.rcPaint.left; |
|---|
| | 1189 | event.y = ps.rcPaint.top; |
|---|
| 1201 | 1190 | event.width = width; |
|---|
| 1202 | 1191 | event.height = height; |
|---|
| … | … | |
| 1205 | 1194 | OS.EndBufferedPaint (hBufferedPaint, true); |
|---|
| 1206 | 1195 | } |
|---|
| 1207 | | OS.EndPaint (handle, ps); |
|---|
| | 1196 | OS.EndPaint (handle, &ps); |
|---|
| 1208 | 1197 | } else { |
|---|
| 1209 | 1198 | |
|---|
| 1210 | 1199 | /* Create the paint GC */ |
|---|
| 1211 | 1200 | GCData data = new GCData (); |
|---|
| 1212 | | data.ps = ps; |
|---|
| | 1201 | data.ps = &ps; |
|---|
| 1213 | 1202 | data.hwnd = handle; |
|---|
| 1214 | 1203 | GC gc = GC.win32_new (this, data); |
|---|
| 1215 | 1204 | |
|---|
| 1216 | 1205 | /* Get the system region for the paint HDC */ |
|---|
| 1217 | | int sysRgn = 0; |
|---|
| | 1206 | HRGN sysRgn; |
|---|
| 1218 | 1207 | if ((style & (DWT.NO_MERGE_PAINTS | DWT.DOUBLE_BUFFERED)) !is 0) { |
|---|
| 1219 | 1208 | sysRgn = OS.CreateRectRgn (0, 0, 0, 0); |
|---|
| … | … | |
| 1223 | 1212 | int nBytes = OS.GetRegionData (sysRgn, 0, null); |
|---|
| 1224 | 1213 | int [] lpRgnData = new int [nBytes / 4]; |
|---|
| 1225 | | OS.GetRegionData (sysRgn, nBytes, lpRgnData); |
|---|
| 1226 | | int newSysRgn = OS.ExtCreateRegion (new float [] {-1, 0, 0, 1, 0, 0}, nBytes, lpRgnData); |
|---|
| | 1214 | OS.GetRegionData (sysRgn, nBytes, cast(RGNDATA*)lpRgnData.ptr); |
|---|
| | 1215 | HRGN newSysRgn = OS.ExtCreateRegion ( cast(XFORM*) [-1.0f, 0, 0, 1, 0, 0].ptr, nBytes, cast(RGNDATA*)lpRgnData.ptr); |
|---|
| 1227 | 1216 | OS.DeleteObject (sysRgn); |
|---|
| 1228 | 1217 | sysRgn = newSysRgn; |
|---|
| … | … | |
| 1230 | 1219 | } |
|---|
| 1231 | 1220 | if (OS.IsWinNT) { |
|---|
| 1232 | | POINT pt = new POINT(); |
|---|
| 1233 | | OS.MapWindowPoints (0, handle, pt, 1); |
|---|
| | 1221 | POINT pt; |
|---|
| | 1222 | OS.MapWindowPoints (null, handle, &pt, 1); |
|---|
| 1234 | 1223 | OS.OffsetRgn (sysRgn, pt.x, pt.y); |
|---|
| 1235 | 1224 | } |
|---|
| … | … | |
| 1238 | 1227 | |
|---|
| 1239 | 1228 | /* Send the paint event */ |
|---|
| 1240 | | int width = ps.right - ps.left; |
|---|
| 1241 | | int height = ps.bottom - ps.top; |
|---|
| | 1229 | int width = ps.rcPaint.right - ps.rcPaint.left; |
|---|
| | 1230 | int height = ps.rcPaint.bottom - ps.rcPaint.top; |
|---|
| 1242 | 1231 | if (width !is 0 && height !is 0) { |
|---|
| 1243 | 1232 | GC paintGC = null; |
|---|
| … | … | |
| 1252 | 1241 | gc.setBackground (getBackground ()); |
|---|
| 1253 | 1242 | gc.setFont (getFont ()); |
|---|
| 1254 | | OS.OffsetRgn (sysRgn, -ps.left, -ps.top); |
|---|
| | 1243 | OS.OffsetRgn (sysRgn, -ps.rcPaint.left, -ps.rcPaint.top); |
|---|
| 1255 | 1244 | OS.SelectClipRgn (gc.handle, sysRgn); |
|---|
| 1256 | | OS.OffsetRgn (sysRgn, ps.left, ps.top); |
|---|
| | 1245 | OS.OffsetRgn (sysRgn, ps.rcPaint.left, ps.rcPaint.top); |
|---|
| 1257 | 1246 | OS.SetMetaRgn (gc.handle); |
|---|
| 1258 | | OS.SetWindowOrgEx (gc.handle, ps.left, ps.top, null); |
|---|
| 1259 | | OS.SetBrushOrgEx (gc.handle, ps.left, ps.top, null); |
|---|
| | 1247 | OS.SetWindowOrgEx (gc.handle, ps.rcPaint.left, ps.rcPaint.top, null); |
|---|
| | 1248 | OS.SetBrushOrgEx (gc.handle, ps.rcPaint.left, ps.rcPaint.top, null); |
|---|
| 1260 | 1249 | if ((style & DWT.NO_BACKGROUND) !is 0) { |
|---|
| 1261 | 1250 | /* This code is intentionally commented because it may be slow to copy bits from the screen */ |
|---|
| 1262 | 1251 | //paintGC.copyArea (image, ps.left, ps.top); |
|---|
| 1263 | 1252 | } else { |
|---|
| 1264 | | RECT rect = new RECT (); |
|---|
| 1265 | | OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom); |
|---|
| 1266 | | drawBackground (gc.handle, rect); |
|---|
| | 1253 | RECT rect; |
|---|
| | 1254 | OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); |
|---|
| | 1255 | drawBackground (gc.handle, &rect); |
|---|
| 1267 | 1256 | } |
|---|
| 1268 | 1257 | } |
|---|
| 1269 | 1258 | Event event = new Event (); |
|---|
| 1270 | 1259 | event.gc = gc; |
|---|
| 1271 | | RECT rect = null; |
|---|
| 1272 | | if ((style & DWT.NO_MERGE_PAINTS) !is 0 && OS.GetRgnBox (sysRgn, rect = new RECT ()) is OS.COMPLEXREGION) { |
|---|
| | 1260 | RECT rect; |
|---|
| | 1261 | if ((style & DWT.NO_MERGE_PAINTS) !is 0 && OS.GetRgnBox (sysRgn, &rect) is OS.COMPLEXREGION) { |
|---|
| 1273 | 1262 | int nBytes = OS.GetRegionData (sysRgn, 0, null); |
|---|
| 1274 | 1263 | int [] lpRgnData = new int [nBytes / 4]; |
|---|
| 1275 | | OS.GetRegionData (sysRgn, nBytes, lpRgnData); |
|---|
| | 1264 | OS.GetRegionData (sysRgn, nBytes, cast(RGNDATA*)lpRgnData.ptr); |
|---|
| 1276 | 1265 | int count = lpRgnData [2]; |
|---|
| 1277 | 1266 | for (int i=0; i<count; i++) { |
|---|
| 1278 | 1267 | int offset = 8 + (i << 2); |
|---|
| 1279 | | OS.SetRect (rect, lpRgnData [offset], lpRgnData [offset + 1], lpRgnData [offset + 2], lpRgnData [offset + 3]); |
|---|
| | 1268 | OS.SetRect (&rect, lpRgnData [offset], lpRgnData [offset + 1], lpRgnData [offset + 2], lpRgnData [offset + 3]); |
|---|
| 1280 | 1269 | if ((style & (DWT.DOUBLE_BUFFERED | DWT.NO_BACKGROUND)) is 0) { |
|---|
| 1281 | | drawBackground (gc.handle, rect); |
|---|
| | 1270 | drawBackground (gc.handle, &rect); |
|---|
| 1282 | 1271 | } |
|---|
| 1283 | 1272 | event.x = rect.left; |
|---|
| … | … | |
| 1290 | 1279 | } else { |
|---|
| 1291 | 1280 | if ((style & (DWT.DOUBLE_BUFFERED | DWT.NO_BACKGROUND)) is 0) { |
|---|
| 1292 | | if (rect is null) rect = new RECT (); |
|---|
| 1293 | | OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom); |
|---|
| 1294 | | drawBackground (gc.handle, rect); |
|---|
| | 1281 | OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); |
|---|
| | 1282 | drawBackground (gc.handle, &rect); |
|---|
| 1295 | 1283 | } |
|---|
| 1296 | | event.x = ps.left; |
|---|
| 1297 | | event.y = ps.top; |
|---|
| | 1284 | event.x = ps.rcPaint.left; |
|---|
| | 1285 | event.y = ps.rcPaint.top; |
|---|
| 1298 | 1286 | event.width = width; |
|---|
| 1299 | 1287 | event.height = height; |
|---|
| … | … | |
| 1304 | 1292 | if ((style & DWT.DOUBLE_BUFFERED) !is 0) { |
|---|
| 1305 | 1293 | gc.dispose(); |
|---|
| 1306 | | if (!isDisposed ()) paintGC.drawImage (image, ps.left, ps.top); |
|---|
| | 1294 | if (!isDisposed ()) paintGC.drawImage (image, ps.rcPaint.left, ps.rcPaint.top); |
|---|
| 1307 | 1295 | image.dispose (); |
|---|
| 1308 | 1296 | gc = paintGC; |
|---|
| 1309 | 1297 | } |
|---|
| 1310 | 1298 | } |
|---|
| 1311 | | if (sysRgn !is 0) OS.DeleteObject (sysRgn); |
|---|
| | 1299 | if (sysRgn !is null) OS.DeleteObject (sysRgn); |
|---|
| 1312 | 1300 | |
|---|
| 1313 | 1301 | /* Dispose the paint GC */ |
|---|
| … | … | |
| 1315 | 1303 | } |
|---|
| 1316 | 1304 | } else { |
|---|
| 1317 | | int hDC = OS.BeginPaint (handle, ps); |
|---|
| | 1305 | auto hDC = OS.BeginPaint (handle, &ps); |
|---|
| 1318 | 1306 | if ((style & DWT.NO_BACKGROUND) is 0) { |
|---|
| 1319 | | RECT rect = new RECT (); |
|---|
| 1320 | | OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom); |
|---|
| 1321 | | drawBackground (hDC, rect); |
|---|
| 1322 | | } |
|---|
| 1323 | | OS.EndPaint (handle, ps); |
|---|
| | 1307 | RECT rect; |
|---|
| | 1308 | OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); |
|---|
| | 1309 | drawBackground (hDC, &rect); |
|---|
| | 1310 | } |
|---|
| | 1311 | OS.EndPaint (handle, &ps); |
|---|
| 1324 | 1312 | } |
|---|
| 1325 | 1313 | |
|---|
| … | … | |
| 1343 | 1331 | LRESULT WM_PRINTCLIENT (int wParam, int lParam) { |
|---|
| 1344 | 1332 | LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); |
|---|
| 1345 | | if (result !is null) return result; |
|---|
| | 1333 | if (result !is LRESULT.NULL) return result; |
|---|
| 1346 | 1334 | if ((state & CANVAS) !is 0) { |
|---|
| 1347 | 1335 | forceResize (); |
|---|
| 1348 | | int nSavedDC = OS.SaveDC (wParam); |
|---|
| 1349 | | RECT rect = new RECT (); |
|---|
| 1350 | | OS.GetClientRect (handle, rect); |
|---|
| | 1336 | auto nSavedDC = OS.SaveDC (cast(HDC)wParam); |
|---|
| | 1337 | RECT rect; |
|---|
| | 1338 | OS.GetClientRect (handle, &rect); |
|---|
| 1351 | 1339 | if ((style & DWT.NO_BACKGROUND) is 0) { |
|---|
| 1352 | | drawBackground (wParam, rect); |
|---|
| | 1340 | drawBackground ( cast(HDC)wParam, &rect); |
|---|
| 1353 | 1341 | } |
|---|
| 1354 | 1342 | if (hooks (DWT.Paint) || filters (DWT.Paint)) { |
|---|
| … | … | |
| 1359 | 1347 | if (control is null) control = this; |
|---|
| 1360 | 1348 | data.background = control.getBackgroundPixel (); |
|---|
| 1361 | | data.hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| | 1349 | data.hFont = cast(HFONT)OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| 1362 | 1350 | data.uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); |
|---|
| 1363 | | GC gc = GC.win32_new (wParam, data); |
|---|
| | 1351 | GC gc = GC.win32_new (cast(HDC)wParam, data); |
|---|
| 1364 | 1352 | Event event = new Event (); |
|---|
| 1365 | 1353 | event.gc = gc; |
|---|
| … | … | |
| 1372 | 1360 | gc.dispose (); |
|---|
| 1373 | 1361 | } |
|---|
| 1374 | | OS.RestoreDC (wParam, nSavedDC); |
|---|
| | 1362 | OS.RestoreDC (cast(HDC)wParam, nSavedDC); |
|---|
| 1375 | 1363 | } |
|---|
| 1376 | 1364 | return result; |
|---|
| … | … | |
| 1379 | 1367 | LRESULT WM_SETFONT (int wParam, int lParam) { |
|---|
| 1380 | 1368 | if (lParam !is 0) OS.InvalidateRect (handle, null, true); |
|---|
| 1381 | | return super.WM_SETFONT (font = wParam, lParam); |
|---|
| | 1369 | font = cast(HFONT)wParam; |
|---|
| | 1370 | return super.WM_SETFONT (wParam, lParam); |
|---|
| 1382 | 1371 | } |
|---|
| 1383 | 1372 | |
|---|
| … | … | |
| 1397 | 1386 | */ |
|---|
| 1398 | 1387 | if (isDisposed ()) return result; |
|---|
| 1399 | | if (layout !is null) { |
|---|
| | 1388 | if (layout_ !is null) { |
|---|
| 1400 | 1389 | markLayout (false, false); |
|---|
| 1401 | 1390 | updateLayout (false, false); |
|---|
| … | … | |
| 1428 | 1417 | LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { |
|---|
| 1429 | 1418 | LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam); |
|---|
| 1430 | | if (result !is null) return result; |
|---|
| 1431 | | int hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| 1432 | | while (hwndChild !is 0) { |
|---|
| | 1419 | if (result !is LRESULT.NULL) return result; |
|---|
| | 1420 | auto hwndChild = OS.GetWindow (handle, OS.GW_CHILD); |
|---|
| | 1421 | while (hwndChild !is null) { |
|---|
| 1433 | 1422 | OS.SendMessage (hwndChild, OS.WM_SYSCOLORCHANGE, 0, 0); |
|---|
| 1434 | 1423 | hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT); |
|---|
| … | … | |
| 1439 | 1428 | LRESULT WM_SYSCOMMAND (int wParam, int lParam) { |
|---|
| 1440 | 1429 | LRESULT result = super.WM_SYSCOMMAND (wParam, lParam); |
|---|
| 1441 | | if (result !is null) return result; |
|---|
| | 1430 | if (result !is LRESULT.NULL) return result; |
|---|
| 1442 | 1431 | |
|---|
| 1443 | 1432 | /* |
|---|
| … | … | |
| 1465 | 1454 | (showVBar !is (verticalBar !is null && verticalBar.getVisible ()))) { |
|---|
| 1466 | 1455 | int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_UPDATENOW; |
|---|
| 1467 | | OS.RedrawWindow (handle, null, 0, flags); |
|---|
| | 1456 | OS.RedrawWindow (handle, null, null, flags); |
|---|
| 1468 | 1457 | } |
|---|
| 1469 | 1458 | if (code is 0) return LRESULT.ZERO; |
|---|
| 1470 | | return new LRESULT (code); |
|---|
| | 1459 | return cast( LRESULT )(code); |
|---|
| 1471 | 1460 | } |
|---|
| 1472 | 1461 | } |
|---|
| … | … | |
| 1477 | 1466 | LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { |
|---|
| 1478 | 1467 | LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam); |
|---|
| 1479 | | if (result !is null) return result; |
|---|
| | 1468 | if (result !is LRESULT.NULL) return result; |
|---|
| 1480 | 1469 | if ((state & CANVAS) !is 0) OS.InvalidateRect (handle, null, false); |
|---|
| 1481 | 1470 | return result; |
|---|
| 1482 | 1471 | } |
|---|
| 1483 | 1472 | |
|---|
| 1484 | | LRESULT wmNCPaint (int hwnd, int wParam, int lParam) { |
|---|
| | 1473 | LRESULT wmNCPaint (HWND hwnd, int wParam, int lParam) { |
|---|
| 1485 | 1474 | if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { |
|---|
| 1486 | 1475 | int bits1 = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE); |
|---|
| … | … | |
| 1491 | 1480 | code = callWindowProc (hwnd, OS.WM_NCPAINT, wParam, lParam); |
|---|
| 1492 | 1481 | } |
|---|
| 1493 | | int hDC = OS.GetWindowDC (hwnd); |
|---|
| 1494 | | RECT rect = new RECT (); |
|---|
| 1495 | | OS.GetWindowRect (hwnd, rect); |
|---|
| | 1482 | auto hDC = OS.GetWindowDC (hwnd); |
|---|
| | 1483 | RECT rect; |
|---|
| | 1484 | OS.GetWindowRect (hwnd, &rect); |
|---|
| 1496 | 1485 | rect.right -= rect.left; |
|---|
| 1497 | 1486 | rect.bottom -= rect.top; |
|---|
| … | … | |
| 1499 | 1488 | int border = OS.GetSystemMetrics (OS.SM_CXEDGE); |
|---|
| 1500 | 1489 | OS.ExcludeClipRect (hDC, border, border, rect.right - border, rect.bottom - border); |
|---|
| 1501 | | OS.DrawThemeBackground (display.hEditTheme (), hDC, OS.EP_EDITTEXT, OS.ETS_NORMAL, rect, null); |
|---|
| | 1490 | OS.DrawThemeBackground (display.hEditTheme (), hDC, OS.EP_EDITTEXT, OS.ETS_NORMAL, &rect, null); |
|---|
| 1502 | 1491 | OS.ReleaseDC (hwnd, hDC); |
|---|
| 1503 | | return new LRESULT (code); |
|---|
| 1504 | | } |
|---|
| 1505 | | } |
|---|
| 1506 | | return null; |
|---|
| 1507 | | } |
|---|
| 1508 | | |
|---|
| 1509 | | LRESULT wmNotify (NMHDR hdr, int wParam, int lParam) { |
|---|
| | 1492 | return cast(LRESULT )(code); |
|---|
| | 1493 | } |
|---|
| | 1494 | } |
|---|
| | 1495 | return LRESULT.NULL; |
|---|
| | 1496 | } |
|---|
| | 1497 | |
|---|
| | 1498 | LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) { |
|---|
| 1510 | 1499 | if (!OS.IsWinCE) { |
|---|
| 1511 | 1500 | switch (hdr.code) { |
|---|
| … | … | |
| 1533 | 1522 | * the topmost status of the tool tip. |
|---|
| 1534 | 1523 | */ |
|---|
| 1535 | | int hwndParent = hdr.hwndFrom; |
|---|
| | 1524 | auto hwndParent = hdr.hwndFrom; |
|---|
| 1536 | 1525 | do { |
|---|
| 1537 | 1526 | hwndParent = OS.GetParent (hwndParent); |
|---|
| 1538 | | if (hwndParent is 0) break; |
|---|
| | 1527 | if (hwndParent is null) break; |
|---|
| 1539 | 1528 | int bits = OS.GetWindowLong (hwndParent, OS.GWL_EXSTYLE); |
|---|
| 1540 | 1529 | if ((bits & OS.WS_EX_TOPMOST) !is 0) break; |
|---|
| 1541 | 1530 | } while (true); |
|---|
| 1542 | | if (hwndParent !is 0) break; |
|---|
| | 1531 | if (hwndParent !is null) break; |
|---|
| 1543 | 1532 | display.lockActiveWindow = true; |
|---|
| 1544 | 1533 | int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOSIZE; |
|---|
| 1545 | | int hwndInsertAfter = hdr.code is OS.TTN_SHOW ? OS.HWND_TOPMOST : OS.HWND_NOTOPMOST; |
|---|
| | 1534 | HWND hwndInsertAfter = cast(HWND)( hdr.code is OS.TTN_SHOW ? OS.HWND_TOPMOST : OS.HWND_NOTOPMOST); |
|---|
| 1546 | 1535 | SetWindowPos (hdr.hwndFrom, hwndInsertAfter, 0, 0, 0, 0, flags); |
|---|
| 1547 | 1536 | display.lockActiveWindow = false; |
|---|
| … | … | |
| 1562 | 1551 | case OS.TTN_GETDISPINFOA: |
|---|
| 1563 | 1552 | case OS.TTN_GETDISPINFOW: { |
|---|
| 1564 | | NMTTDISPINFO lpnmtdi; |
|---|
| 1565 | | if (hdr.code is OS.TTN_GETDISPINFOA) { |
|---|
| 1566 | | lpnmtdi = new NMTTDISPINFOA (); |
|---|
| 1567 | | OS.MoveMemory ((NMTTDISPINFOA)lpnmtdi, lParam, NMTTDISPINFOA.sizeof); |
|---|
| 1568 | | } else { |
|---|
| 1569 | | lpnmtdi = new NMTTDISPINFOW (); |
|---|
| 1570 | | OS.MoveMemory ((NMTTDISPINFOW)lpnmtdi, lParam, NMTTDISPINFOW.sizeof); |
|---|
| 1571 | | } |
|---|
| 1572 | | String string = toolTipText (lpnmtdi); |
|---|
| | 1553 | NMTTDISPINFO* lpnmtdi = cast(NMTTDISPINFO*)lParam; |
|---|
| | 1554 | // if (hdr.code is OS.TTN_GETDISPINFOA) { |
|---|
| | 1555 | // lpnmtdi = new NMTTDISPINFOA (); |
|---|
| | 1556 | // OS.MoveMemory (cast(NMTTDISPINFOA)lpnmtdi, lParam, NMTTDISPINFOA.sizeof); |
|---|
| | 1557 | // } else { |
|---|
| | 1558 | // lpnmtdi = new NMTTDISPINFOW (); |
|---|
| | 1559 | // OS.MoveMemory (cast(NMTTDISPINFOW)lpnmtdi, lParam, NMTTDISPINFOW.sizeof); |
|---|
| | 1560 | // } |
|---|
| | 1561 | char[] string = toolTipText (lpnmtdi); |
|---|
| 1573 | 1562 | if (string !is null) { |
|---|
| 1574 | 1563 | Shell shell = getShell (); |
|---|
| 1575 | 1564 | string = Display.withCrLf (string); |
|---|
| 1576 | | int length = string.length (); |
|---|
| 1577 | | char [] chars = new char [length + 1]; |
|---|
| 1578 | | string.getChars (0, length, chars, 0); |
|---|
| | 1565 | int length_ = string.length; |
|---|
| | 1566 | char [] chars = new char [length_ + 1]; |
|---|
| | 1567 | string.getChars (0, length_, chars, 0); |
|---|
| 1579 | 1568 | |
|---|
| 1580 | 1569 | /* |
|---|
| … | … | |
| 1582 | 1571 | * the orientation of the control. |
|---|
| 1583 | 1572 | */ |
|---|
| 1584 | | int hwnd = hdr.idFrom; |
|---|
| 1585 | | if (hwnd !is 0 && ((lpnmtdi.uFlags & OS.TTF_IDISHWND) !is 0)) { |
|---|
| | 1573 | HWND hwnd = cast(HWND)hdr.idFrom; |
|---|
| | 1574 | if (hwnd !is null && ((lpnmtdi.uFlags & OS.TTF_IDISHWND) !is 0)) { |
|---|
| 1586 | 1575 | Control control = display.getControl (hwnd); |
|---|
| 1587 | 1576 | if (control !is null) { |
|---|
| … | … | |
| 1595 | 1584 | |
|---|
| 1596 | 1585 | if (hdr.code is OS.TTN_GETDISPINFOA) { |
|---|
| 1597 | | byte [] bytes = new byte [chars.length * 2]; |
|---|
| 1598 | | OS.WideCharToMultiByte (getCodePage (), 0, chars, chars.length, bytes, bytes.length, null, null); |
|---|
| | 1586 | auto bytes = MBCSsToStr( chars, getCodePage () ); |
|---|
| | 1587 | //byte [] bytes = new byte [chars.length * 2]; |
|---|
| | 1588 | //OS.WideCharToMultiByte (getCodePage (), 0, chars.ptr, chars.length, bytes, bytes.length, null, null); |
|---|
| 1599 | 1589 | shell.setToolTipText (lpnmtdi, bytes); |
|---|
| 1600 | | OS.MoveMemory (lParam, (NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); |
|---|
| | 1590 | //OS.MoveMemory (lParam, cast(NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); |
|---|
| 1601 | 1591 | } else { |
|---|
| 1602 | 1592 | shell.setToolTipText (lpnmtdi, chars); |
|---|