Changeset 193 for trunk/src/plugins
- Timestamp:
- Oct 10, 2009, 6:56:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Control.java
r190 r193 555 555 hps = this.hps; 556 556 } 557 // System.out.println("Control::drawBackground -> xLeft = " + rcl.xLeft);558 // System.out.println("Control::drawBackground -> xRight = " + rcl.xRight);559 // System.out.println("Control::drawBackground -> yBottom = " + rcl.yBottom);560 // System.out.println("Control::drawBackground -> yTop = " + rcl.yTop);561 557 OS.WinFillRect (hps, rcl, getBackgroundPixel ()); 562 558 } … … 863 859 */ 864 860 //@@TODO(dmik) 865 //public Menu getMenu () {866 //checkWidget ();867 //return menu;868 //}861 public Menu getMenu () { 862 checkWidget (); 863 return menu; 864 } 869 865 870 866 /** … … 2953 2949 switch (msg) { 2954 2950 // case OS.WM_ADJUSTWINDOWPOS: result = WM_ADJUSTWINDOWPOS (mp1, mp2); break; 2955 // case OS.WM_BUTTON2DBLCLK: result = WM_BUTTON2DBLCLK (mp1, mp2); break;2956 2951 case OS.WM_BUTTON1DOWN: result = WM_BUTTON1DOWN (mp1, mp2); break; 2957 2952 case OS.WM_BUTTON1UP: result = WM_BUTTON1UP (mp1, mp2); break; 2953 case OS.WM_BUTTON2DBLCLK: result = WM_BUTTON2DBLCLK (mp1, mp2); break; 2954 case OS.WM_BUTTON2DOWN: result = WM_BUTTON2DOWN (mp1, mp2); break; 2955 case OS.WM_BUTTON2UP: result = WM_BUTTON2UP (mp1, mp2); break; 2956 case OS.WM_BUTTON3DBLCLK: result = WM_BUTTON3DBLCLK (mp1, mp2); break; 2957 case OS.WM_BUTTON3DOWN: result = WM_BUTTON3DOWN (mp1, mp2); break; 2958 case OS.WM_BUTTON3UP: result = WM_BUTTON3UP (mp1, mp2); break; 2958 2959 // case OS.WM_BUTTON1CLICK: result = WM_BUTTON1CLICK (mp1, mp2); break; 2959 2960 case OS.WM_CALCVALIDRECTS: result = WM_CALCVALIDRECTS (mp1, mp2); break; … … 2991 2992 // case OS.WM_KEYUP: result = WM_KEYUP (wParam, lParam); break; 2992 2993 case OS.WM_BUTTON1DBLCLK: result = WM_BUTTON1DBLCLK (mp1, mp2); break; 2993 // case OS.WM_LBUTTONDOWN: result = WM_LBUTTONDOWN (wParam, lParam); break;2994 // case OS.WM_LBUTTONUP: result = WM_LBUTTONUP (wParam, lParam); break;2995 // case OS.WM_MBUTTONDBLCLK: result = WM_MBUTTONDBLCLK (wParam, lParam); break;2996 // case OS.WM_MBUTTONDOWN: result = WM_MBUTTONDOWN (wParam, lParam); break;2997 // case OS.WM_MBUTTONUP: result = WM_MBUTTONUP (wParam, lParam); break;2998 2994 case OS.WM_MEASUREITEM: result = WM_MEASUREITEM (mp1, mp2); break; 2999 2995 // case OS.WM_MENUCHAR: result = WM_MENUCHAR (wParam, lParam); break; … … 3014 3010 // case OS.WM_PRINTCLIENT: result = WM_PRINTCLIENT (wParam, lParam); break; 3015 3011 // case OS.WM_QUERYENDSESSION: result = WM_QUERYENDSESSION (wParam, lParam); break; 3016 // case OS.WM_RBUTTONDBLCLK: result = WM_RBUTTONDBLCLK (wParam, lParam); break;3017 // case OS.WM_RBUTTONDOWN: result = WM_RBUTTONDOWN (wParam, lParam); break;3018 // case OS.WM_RBUTTONUP: result = WM_RBUTTONUP (wParam, lParam); break;3019 3012 // case OS.WM_SETCURSOR: result = WM_SETCURSOR (wParam, lParam); break; 3020 3013 case OS.WM_SETFOCUS: result = WM_SETFOCUS (mp1, mp2); break; … … 3334 3327 MRESULT WM_BUTTON1DBLCLK (int mp1, int mp2) { 3335 3328 /* 3336 * Feature in Windows. Windowssends the following3329 * Feature in OS/2. OS/2 sends the following 3337 3330 * messages when the user double clicks the mouse: 3338 3331 * 3339 * WM_ LBUTTONDOWN - mouse down3340 * WM_ LBUTTONUP - mouse up3341 * WM_ LBUTTONDBLCLK - double click3342 * WM_ LBUTTONUP - mouse up3332 * WM_BUTTON1DOWN - mouse down 3333 * WM_BUTTON1UP - mouse up 3334 * WM_BUTTON1DBLCLK - double click 3335 * WM_BUTTON1UP - mouse up 3343 3336 * 3344 3337 * Applications that expect matching mouse down/up … … 3346 3339 * fix is to send a mouse down event. 3347 3340 */ 3341 sendMouseEvent (SWT.MouseDown, 1, OS.WM_BUTTON1DOWN, mp1, mp2); 3348 3342 sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_BUTTON1DBLCLK, mp1, mp2); 3349 3343 int result = callWindowProc (OS.WM_BUTTON1DBLCLK, mp1, mp2); 3344 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3345 return new MRESULT (result); 3346 } 3347 // 3348 MRESULT WM_BUTTON2DBLCLK (int mp1, int mp2) { 3349 /* 3350 * Feature in OS/2. OS/2 sends the following 3351 * messages when the user double clicks the mouse: 3352 * 3353 * WM_BUTTON2DOWN - mouse down 3354 * WM_BUTTON2UP - mouse up 3355 * WM_BUTTON2DBLCLK - double click 3356 * WM_BUTTON2UP - mouse up 3357 * 3358 * Applications that expect matching mouse down/up 3359 * pairs will not see the second mouse down. The 3360 * fix is to send a mouse down event. 3361 */ 3362 sendMouseEvent (SWT.MouseDown, 3, OS.WM_BUTTON2DOWN, mp1, mp2); 3363 sendMouseEvent (SWT.MouseDoubleClick, 3, OS.WM_BUTTON2DBLCLK, mp1, mp2); 3364 int result = callWindowProc (OS.WM_BUTTON2DBLCLK, mp1, mp2); 3365 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3366 return new MRESULT (result); 3367 } 3368 3369 MRESULT WM_BUTTON3DBLCLK (int mp1, int mp2) { 3370 /* 3371 * Feature in OS/2. OS/2 sends the following 3372 * messages when the user double clicks the mouse: 3373 * 3374 * WM_BUTTON3DOWN - mouse down 3375 * WM_BUTTON3UP - mouse up 3376 * WM_BUTTON3DBLCLK - double click 3377 * WM_BUTTON3UP - mouse up 3378 * 3379 * Applications that expect matching mouse down/up 3380 * pairs will not see the second mouse down. The 3381 * fix is to send a mouse down event. 3382 */ 3383 sendMouseEvent (SWT.MouseDown, 2, OS.WM_BUTTON3DOWN, mp1, mp2); 3384 sendMouseEvent (SWT.MouseDoubleClick, 2, OS.WM_BUTTON3DBLCLK, mp1, mp2); 3385 int result = callWindowProc (OS.WM_BUTTON3DBLCLK, mp1, mp2); 3350 3386 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3351 3387 return new MRESULT (result); … … 3375 3411 // int result = 0; 3376 3412 if (mouseDown) { 3377 int hwnd = OS.WinQueryCapture (OS.HWND_DESKTOP);3378 int hwnd2 = OS.WinQueryWindow(handle, OS.QW_PARENT);3379 int hwnd3 = OS.WinQueryActiveWindow(OS.HWND_DESKTOP);3413 // int hwnd = OS.WinQueryCapture (OS.HWND_DESKTOP); 3414 // int hwnd2 = OS.WinQueryWindow(handle, OS.QW_PARENT); 3415 // int hwnd3 = OS.WinQueryActiveWindow(OS.HWND_DESKTOP); 3380 3416 // System.out.println("Control::WM_BUTTON1DOWN -> Window = " + Integer.toHexString(handle) + " Window Activa = " + Integer.toHexString(hwnd) + " Padre = " + Integer.toHexString(hwnd2)); 3381 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) {3417 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) 3382 3418 OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3383 } 3384 if(OS.WinQueryWindow(handle, OS.QW_PARENT) == OS.WinQueryActiveWindow(OS.HWND_DESKTOP)){ 3419 // if(OS.WinQueryWindow(handle, OS.QW_PARENT) == OS.WinQueryActiveWindow(OS.HWND_DESKTOP)){ 3385 3420 // System.out.println("Control::WM_BUTTON1DOWN"); 3386 }3387 OS.WinSetActiveWindow (OS.HWND_DESKTOP, handle);3421 // } 3422 // OS.WinSetActiveWindow (OS.HWND_DESKTOP, handle); 3388 3423 } 3389 3424 // if (dragging) { … … 3419 3454 } 3420 3455 3456 MRESULT WM_BUTTON2DOWN (int mp1, int mp2) { 3457 sendMouseEvent (SWT.MouseDown, 3, OS.WM_BUTTON2DOWN, mp1, mp2); 3458 int result = callWindowProc (OS.WM_BUTTON2DOWN, mp1, mp2); 3459 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3460 return new MRESULT (result); 3461 } 3462 3463 MRESULT WM_BUTTON3DOWN (int mp1, int mp2) { 3464 sendMouseEvent (SWT.MouseDown, 2, OS.WM_BUTTON3DOWN, mp1, mp2); 3465 int result = callWindowProc (OS.WM_BUTTON3DOWN, mp1, mp2); 3466 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3467 return new MRESULT (result); 3468 } 3469 3421 3470 MRESULT WM_BUTTON1UP (int mp1, int mp2) { 3422 3471 sendMouseEvent (SWT.MouseUp, 1, OS.WM_BUTTON1UP, mp1, mp2); … … 3428 3477 } 3429 3478 3430 //LRESULT WM_MBUTTONDBLCLK (int wParam, int lParam) { 3431 // /* 3432 // * Feature in Windows. Windows sends the following 3433 // * messages when the user double clicks the mouse: 3434 // * 3435 // * WM_MBUTTONDOWN - mouse down 3436 // * WM_MBUTTONUP - mouse up 3437 // * WM_MLBUTTONDBLCLK - double click 3438 // * WM_MBUTTONUP - mouse up 3439 // * 3440 // * Applications that expect matching mouse down/up 3441 // * pairs will not see the second mouse down. The 3442 // * fix is to send a mouse down event. 3443 // */ 3444 // sendMouseEvent (SWT.MouseDown, 2, OS.WM_MBUTTONDOWN, wParam, lParam); 3445 // sendMouseEvent (SWT.MouseDoubleClick, 2, OS.WM_MBUTTONDBLCLK, wParam, lParam); 3446 // int result = callWindowProc (OS.WM_MBUTTONDBLCLK, wParam, lParam); 3447 // if (OS.GetCapture () != handle) OS.SetCapture (handle); 3448 // return new LRESULT (result); 3449 //} 3450 // 3451 //LRESULT WM_MBUTTONDOWN (int wParam, int lParam) { 3452 // sendMouseEvent (SWT.MouseDown, 2, OS.WM_MBUTTONDOWN, wParam, lParam); 3453 // int result = callWindowProc (OS.WM_MBUTTONDOWN, wParam, lParam); 3454 // if (OS.GetCapture () != handle) OS.SetCapture(handle); 3455 // return new LRESULT (result); 3456 //} 3457 // 3458 //LRESULT WM_MBUTTONUP (int wParam, int lParam) { 3459 // sendMouseEvent (SWT.MouseUp, 2, OS.WM_MBUTTONUP, wParam, lParam); 3460 // int result = callWindowProc (OS.WM_MBUTTONUP, wParam, lParam); 3479 MRESULT WM_BUTTON2UP (int mp1, int mp2) { 3480 sendMouseEvent (SWT.MouseUp, 3, OS.WM_BUTTON2UP, mp1, mp2); 3481 int result = callWindowProc (OS.WM_BUTTON2UP, mp1, mp2); 3461 3482 // if ((wParam & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0) { 3462 // if (OS.GetCapture () == handle) OS.ReleaseCapture ();3483 if (OS.WinQueryCapture (OS.HWND_DESKTOP) == handle) OS.WinSetCapture (OS.HWND_DESKTOP, OS.NULLHANDLE); 3463 3484 // } 3464 // return new LRESULT (result); 3465 //} 3485 return new MRESULT (result); 3486 } 3487 3488 MRESULT WM_BUTTON3UP (int mp1, int mp2) { 3489 sendMouseEvent (SWT.MouseUp, 2, OS.WM_BUTTON3UP, mp1, mp2); 3490 int result = callWindowProc (OS.WM_BUTTON3UP, mp1, mp2); 3491 if (OS.WinQueryCapture (OS.HWND_DESKTOP) == handle) OS.WinSetCapture (OS.HWND_DESKTOP, OS.NULLHANDLE); 3492 return new MRESULT (result); 3493 } 3466 3494 3467 3495 MRESULT WM_MEASUREITEM (int mp1, int mp2) { 3468 System.out.println("Control:WM_MEASUREITEM ");3496 System.out.println("Control:WM_MEASUREITEM -> sListBox" + mp1); 3469 3497 // MEASUREITEMSTRUCT struct = new MEASUREITEMSTRUCT (); 3470 3498 // OS.MoveMemory (struct, lParam, MEASUREITEMSTRUCT.sizeof); … … 3476 3504 // } 3477 3505 // int hwnd = OS.GetDlgItem (handle, struct.CtlID); 3478 // Control control = WidgetTable.get (hwnd);3479 //if (control == null) return null;3480 // return control.wmMeasureChild (wParam, lParam);3481 return null;3482 } 3483 // 3506 Control control = WidgetTable.get (mp1); 3507 if (control == null) return null; 3508 return control.wmMeasureChild (mp1, mp2); 3509 // return null; 3510 } 3511 3484 3512 //LRESULT WM_MENUCHAR (int wParam, int lParam) { 3485 3513 // Display display = getDisplay (); … … 3499 3527 // return null; 3500 3528 //} 3501 // 3529 3502 3530 MRESULT WM_MENUSELECT (int mp1, int mp2) { 3503 // System.out.println("Control:WM_MENUSELECT - MP1 SHORT 1= " + OS.SHORT1FROMMP(mp1)); 3504 if(OS.SHORT2FROMMP(mp1) == 0) return MRESULT.FALSE; 3531 if(OS.SHORT2FROMMP(mp1) == 0) return MRESULT.TRUE; 3505 3532 // int code = wParam >> 16; 3506 3533 Shell shell = getShell (); … … 3527 3554 // return null; 3528 3555 // } 3529 // if ((code & OS.MF_SYSMENU) != 0) return null;3556 if ((OS.SHORT1FROMMP(mp1) & OS.FID_SYSMENU) != 0) return MRESULT.TRUE; 3530 3557 int sState = OS.WinSendMsg(mp2, OS.MM_QUERYITEMATTR, OS.MPFROM2SHORT(OS.SHORT1FROMMP(mp1), (short)OS.TRUE), OS.MIA_HILITED); 3531 3558 if ((sState & OS.MIA_HILITED) != 0) { … … 3619 3646 // return null; 3620 3647 //} 3621 // 3622 //MRESULT WM_MOUSEMOVE (int mp1, int mp2) { 3623 // if (!OS.IsWinCE) { 3624 // boolean hooksEnter = hooks (SWT.MouseEnter); 3625 // if (hooksEnter || hooks (SWT.MouseExit) || hooks (SWT.MouseHover)) { 3626 // TRACKMOUSEEVENT lpEventTrack = new TRACKMOUSEEVENT (); 3627 // lpEventTrack.cbSize = TRACKMOUSEEVENT.sizeof; 3628 // lpEventTrack.dwFlags = OS.TME_QUERY; 3629 // lpEventTrack.hwndTrack = handle; 3630 // OS.TrackMouseEvent (lpEventTrack); 3631 // if (lpEventTrack.dwFlags == 0) { 3632 // lpEventTrack.dwFlags = OS.TME_LEAVE | OS.TME_HOVER; 3633 // lpEventTrack.hwndTrack = handle; 3634 // OS.TrackMouseEvent (lpEventTrack); 3635 // if (hooksEnter) { 3636 // Event event = new Event (); 3637 // event.x = (short) (lParam & 0xFFFF); 3638 // event.y = (short) (lParam >> 16); 3639 // postEvent (SWT.MouseEnter, event); 3640 // } 3641 // } else { 3642 // lpEventTrack.dwFlags = OS.TME_HOVER; 3643 // OS.TrackMouseEvent (lpEventTrack); 3644 // } 3645 // } 3646 // } 3647 // Display display = getDisplay (); 3648 // int pos = OS.GetMessagePos (); 3649 // if (pos != display.lastMouse) { 3650 // display.lastMouse = pos; 3651 // sendMouseEvent (SWT.MouseMove, 0, OS.WM_MOUSEMOVE, wParam, lParam); 3652 // } 3653 // return null; 3654 //} 3655 // 3648 3649 MRESULT WM_MOUSEMOVE (int mp1, int mp2) { 3650 Display display = getDisplay (); 3651 int[] pnt = new int [] {0, 0}; 3652 OS.WinQueryMsgPos (0, pnt); 3653 //@@TODO(dmik): Mapping coordinates to use lastMouse variable (x low order, y high order like windows) 3654 int pos = (pnt[1] << 16) + pnt[0]; 3655 if (pos != display.lastMouse) { 3656 display.lastMouse = pos; 3657 sendMouseEvent (SWT.MouseMove, 0, OS.WM_MOUSEMOVE, mp1, mp2); 3658 } 3659 return MRESULT.FALSE; 3660 } 3661 3656 3662 //LRESULT WM_MOUSEWHEEL (int wParam, int lParam) { 3657 3663 // return null; … … 3687 3693 return null; 3688 3694 } 3689 // System.out.println("Control::WM_PAINT -> HANDLE = " + Integer.toHexString(handle));3690 3695 /* lazily obtain a long-term cached micro presentation space */ 3691 3696 GCData data = new GCData (); … … 3752 3757 //LRESULT WM_QUERYENDSESSION (int wParam, int lParam) { 3753 3758 // return null; 3754 //}3755 //3756 //LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {3757 // /*3758 // * Feature in Windows. Windows sends the following3759 // * messages when the user double clicks the mouse:3760 // *3761 // * WM_RBUTTONDOWN - mouse down3762 // * WM_RBUTTONUP - mouse up3763 // * WM_RBUTTONDBLCLK - double click3764 // * WM_LBUTTONUP - mouse up3765 // *3766 // * Applications that expect matching mouse down/up3767 // * pairs will not see the second mouse down. The3768 // * fix is to send a mouse down event.3769 // */3770 // sendMouseEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam);3771 // sendMouseEvent (SWT.MouseDoubleClick, 3, OS.WM_RBUTTONDBLCLK, wParam, lParam);3772 // int result = callWindowProc (OS.WM_RBUTTONDBLCLK, wParam, lParam);3773 // if (OS.GetCapture () != handle) OS.SetCapture (handle);3774 // return new LRESULT (result);3775 //}3776 //3777 //LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {3778 // sendMouseEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam);3779 // int result = callWindowProc (OS.WM_RBUTTONDOWN, wParam, lParam);3780 // if (OS.GetCapture () != handle) OS.SetCapture (handle);3781 // return new LRESULT (result);3782 //}3783 //3784 //LRESULT WM_RBUTTONUP (int wParam, int lParam) {3785 // sendMouseEvent (SWT.MouseUp, 3, OS.WM_RBUTTONUP, wParam, lParam);3786 // int result = callWindowProc (OS.WM_RBUTTONUP, wParam, lParam);3787 // if ((wParam & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0) {3788 // if (OS.GetCapture () == handle) OS.ReleaseCapture ();3789 // }3790 // return new LRESULT (result);3791 3759 //} 3792 3760 … … 4023 3991 return control.wmScrollChild (mp1, mp2); 4024 3992 } 4025 //4026 //LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {4027 // return null;4028 //}4029 3993 4030 3994 MRESULT WM_WINDOWPOSCHANGED (int mp1, int mp2) { … … 4096 4060 4097 4061 //@@TODO (dmik): 4098 //LRESULT wmMeasureChild (int wParam, int lParam) { 4099 // return null; 4100 //} 4062 MRESULT wmMeasureChild (int mp1, int mp2) { 4063 System.out.println("Control:wmMeasureChild"); 4064 return null; 4065 } 4101 4066 // 4102 4067 //LRESULT wmNotifyChild (int wParam, int lParam) {
Note:
See TracChangeset
for help on using the changeset viewer.