- Timestamp:
- Jun 20, 2008, 12:57:17 AM (17 years ago)
- Location:
- trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Control.java
r103 r105 472 472 473 473 //@@TODO (dmik): debug code, remove when no more necessary 474 System.out.println (475 "Control.createHandle(): Window has been created:\n" +476 " hwnd = " + Integer.toHexString (handle) + "\n" +477 " hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" +478 " class = " + windowClass() + "\n" +479 " style = " + Integer.toHexString (widgetStyle())480 );474 //System.out.println ( 475 // "Control.createHandle(): Window has been created:\n" + 476 // " hwnd = " + Integer.toHexString (handle) + "\n" + 477 // " hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" + 478 // " class = " + windowClass() + "\n" + 479 // " style = " + Integer.toHexString (widgetStyle()) 480 //); 481 481 482 482 //@@TODO(dmik): DBCS handling? … … 3041 3041 boolean keyUp = (OS.SHORT1FROMMP (mp1) & OS.KC_KEYUP) != 0; 3042 3042 //@@TODO (dmik): debug, remove 3043 System.out.println("WM_CHAR ("+this+"): vk="+OS.SHORT2FROMMP (mp2)+" keyup="+keyUp);3043 //System.out.println("WM_CHAR ("+this+"): vk="+OS.SHORT2FROMMP (mp2)+" keyup="+keyUp); 3044 3044 sendKeyEvent (keyUp ? SWT.KeyUp : SWT.KeyDown, OS.WM_CHAR, mp1, mp2); 3045 3045 return null; … … 3058 3058 switch (OS.SHORT1FROMMP (mp2)) { 3059 3059 case OS.CMDSRC_MENU: 3060 // System.out.println("Control:WM_COMMAND - CMDSRC_MENU"); 3060 3061 Decorations shell = menuShell (); 3061 3062 if (shell.isEnabled ()) { … … 3072 3073 break; 3073 3074 case OS.CMDSRC_PUSHBUTTON: 3075 System.out.println("Control:WM_COMMAND - CMDSRC_PUSHBUTTON"); 3076 break; 3074 3077 //@@TODO(lpino) 3075 3078 case OS.CMDSRC_FONTDLG: 3079 System.out.println("Control:WM_COMMAND - CMDSRC_FONTDLG"); 3080 break; 3076 3081 case OS.CMDSRC_FILEDLG: 3077 case OS.CMDSRC_COLORDLG: 3082 System.out.println("Control:WM_COMMAND - CMDSRC_FILEDLG"); 3083 break; 3084 case OS.CMDSRC_OTHER: 3085 System.out.println("Control:WM_COMMAND - CMDSRC_OTHER"); 3086 break; 3078 3087 //case OS.CMDSRC_PRINTDLG: 3079 3088 } … … 3092 3101 * have been destroyed but not removed from the control. 3093 3102 */ 3103 //@@TODO(lpino) First check if this validation applies to OS/2 implementation and then validate using the coordinates of the mouse 3094 3104 // if (mp2 != handle) return null; 3095 int parentHandle = OS.WinQueryWindow(menu.handle, OS.QW_PARENT); 3096 int hab = parent.getDisplay ().hab; 3097 //@@TODO(lpino) Remove debug msg 3098 // System.out.println("Control:WM_CONTEXTMENU - PARENT HANDLE = " + Integer.toHexString (parentHandle)); 3099 // System.out.println("Control:WM_CONTEXTMENU - MENU HANDLE = " + Integer.toHexString (menu.handle)); 3105 // int parentHandle = OS.WinQueryWindow(menu.handle, OS.QW_PARENT); 3106 // System.out.println("Control:WM_CONTEXTMENU - PARENTHANDLE = " + Integer.toHexString(parentHandle)); 3107 // System.out.println("Control:WM_CONTEXTMENU - PARENTHANDLE = " + Integer.toHexString(handle)); 3100 3108 short flOptions = OS.PU_HCONSTRAIN | OS.PU_VCONSTRAIN | OS.PU_KEYBOARD | OS.PU_MOUSEBUTTON1; 3101 boolean rc = OS.WinPopupMenu( parentHandle, parentHandle, menu.handle, 0, OS.SHORT1FROMMP(mp1), OS.SHORT2FROMMP(mp1), flOptions);3109 boolean rc = OS.WinPopupMenu(handle, handle, menu.handle, 0, OS.SHORT1FROMMP(mp1), OS.SHORT2FROMMP(mp1), flOptions); 3102 3110 // if (menu != null && !menu.isDisposed ()) { 3103 3111 // menu.setVisible (true); … … 3234 3242 3235 3243 /* Ignore WM_INITMENU for an accelerator */ 3236 System.out.println("Control:WM_INITMENU - MENU HANDLE = " + Integer.toHexString (mp2));3237 3244 Display display = getDisplay (); 3238 3245 if (display.accelKeyHit) return null; 3239 // /*3240 // * If the high order word of LPARAM is non-zero,3241 // * the menu is the system menu and we can ignore3242 // * WPARAM. Otherwise, use WPARAM to find the menu.3243 // */3244 3246 Shell shell = getShell (); 3245 3247 Menu oldMenu = shell.activeMenu; 3246 3248 Menu newMenu = null; 3247 // if ((lParam >> 16) == 0) { 3248 newMenu = menuShell ().findMenu (mp2); 3249 // } 3249 newMenu = menuShell ().findMenu (mp2); 3250 3250 Menu menu = newMenu; 3251 3251 while (menu != null && menu != oldMenu) { … … 3253 3253 } 3254 3254 if (menu == null) { 3255 menu = shell.activeMenu;3255 menu = shell.activeMenu; 3256 3256 while (menu != null) { 3257 3257 /* … … 3272 3272 } 3273 3273 } 3274 if(menu == null) 3275 System.out.println("Control:WM_INITMENU " + menu); 3276 else 3277 System.out.println("Control:WM_INITMENU " + Integer.toHexString (menu.handle)); 3278 // 3279 // /* 3280 // * The shell and the new menu may be disposed because of 3281 // * sending the hide event to the ancestor menus but setting 3282 // * a field to null in a disposed shell is not harmful. 3283 // */ 3274 3275 /* 3276 * The shell and the new menu may be disposed because of 3277 * sending the hide event to the ancestor menus but setting 3278 * a field to null in a disposed shell is not harmful. 3279 */ 3284 3280 if (newMenu != null && newMenu.isDisposed ()) 3285 3281 newMenu = null; 3286 3282 shell.activeMenu = newMenu; 3287 // 3288 ///*3289 //* Send the show event3290 //*/3283 3284 /* 3285 * Send the show event 3286 */ 3291 3287 if (newMenu != null && newMenu != oldMenu) { 3292 3288 /* … … 3472 3468 // 3473 3469 MRESULT WM_MENUSELECT (int mp1, int mp2) { 3474 System.out.println("Control:WM_MENUSELECT - MP1 SHORT 1= " + OS.SHORT1FROMMP(mp1)); 3475 System.out.println("Control:WM_MENUSELECT - MP1 SHORT 2= " + OS.SHORT2FROMMP(mp1)); 3470 // System.out.println("Control:WM_MENUSELECT - MP1 SHORT 1= " + OS.SHORT1FROMMP(mp1)); 3476 3471 if(OS.SHORT2FROMMP(mp1) == 0) return MRESULT.FALSE; 3477 3472 // int code = wParam >> 16; … … 3500 3495 // } 3501 3496 // if ((code & OS.MF_SYSMENU) != 0) return null; 3502 // if ((code & OS.MF_HILITE) != 0) { 3503 // MenuItem item = null; 3504 // Decorations menuShell = menuShell (); 3505 // if ((code & OS.MF_POPUP) != 0) { 3497 int sState = OS.WinSendMsg(mp2, OS.MM_QUERYITEMATTR, OS.MPFROM2SHORT(OS.SHORT1FROMMP(mp1), (short)OS.TRUE), OS.MIA_HILITED); 3498 if ((sState & OS.MIA_HILITED) != 0) { 3499 MenuItem item = null; 3500 Decorations menuShell = menuShell (); 3501 MENUITEM info = new MENUITEM (); 3502 OS.WinSendMsg (mp2, OS.MM_QUERYITEM, OS.MPFROM2SHORT (OS.SHORT1FROMMP(mp1), (short)OS.TRUE), info); 3503 if ((info.afStyle & OS.MIS_SUBMENU) != 0) { 3506 3504 // int index = wParam & 0xFFFF; 3507 3505 // MENUITEMINFO info = new MENUITEMINFO (); … … 3509 3507 // info.fMask = OS.MIIM_SUBMENU; 3510 3508 // if (OS.GetMenuItemInfo (lParam, index, true, info)) { 3511 // Menu newMenu = menuShell.findMenu (info.hSubMenu);3512 //if (newMenu != null) item = newMenu.cascade;3509 Menu newMenu = menuShell.findMenu (info.hwndSubMenu); 3510 if (newMenu != null) item = newMenu.cascade; 3513 3511 // } 3514 // } else { 3515 // Menu newMenu = menuShell.findMenu (lParam); 3516 // if (newMenu != null) { 3517 // int id = wParam & 0xFFFF; 3518 // item = menuShell.findMenuItem (id); 3519 // } 3520 // Menu oldMenu = shell.activeMenu; 3521 // if (oldMenu != null) { 3522 // Menu ancestor = oldMenu; 3523 // while (ancestor != null && ancestor != newMenu) { 3524 // ancestor = ancestor.getParentMenu (); 3525 // } 3526 // if (ancestor == newMenu) { 3527 // ancestor = oldMenu; 3528 // while (ancestor != newMenu) { 3529 // /* 3530 // * It is possible (but unlikely), that application 3531 // * code could have disposed the widget in the hide 3532 // * event or the item about to be armed. If this 3533 // * happens, stop searching up the ancestor list 3534 // * because there is no longer a link to follow. 3535 // */ 3536 // ancestor.sendEvent (SWT.Hide); 3537 // if (ancestor.isDisposed ()) break; 3538 // ancestor = ancestor.getParentMenu (); 3539 // } 3540 // /* 3541 // * The shell and/or the item could be disposed when 3542 // * processing hide events from above. If this happens, 3543 // * ensure that the shell is not accessed and that no 3544 // * arm event is sent to the item. 3545 // */ 3546 // if (!shell.isDisposed ()) { 3547 // if (newMenu != null && newMenu.isDisposed ()) { 3548 // newMenu = null; 3549 // } 3550 // shell.activeMenu = newMenu; 3551 // } 3552 // if (item != null && item.isDisposed ()) item = null; 3553 // } 3554 // } 3555 // } 3556 // if (item != null) item.sendEvent (SWT.Arm); 3557 // } 3558 // int parentHandle = OS.WinQueryWindow(menu.handle, OS.QW_PARENT); 3559 // boolean bIsWaiting = true; 3560 // int hab = 0; 3561 // if(parent == null) 3562 // hab = getDisplay().hab; 3563 // else 3564 // hab = parent.getDisplay ().hab; 3565 // while(bIsWaiting){ 3566 // QMSG qmsg = new QMSG (); 3567 // 3568 // OS.WinGetMsg(hab,qmsg, 0, 0, 0); 3569 // if (qmsg.msg == OS.WM_COMMAND || qmsg.msg == OS.WM_MENUSELECT) 3570 // bIsWaiting = false; 3571 // OS.WinDispatchMsg(hab, qmsg); 3572 // System.out.println("Control:WM_CONTEXTMENU"); 3573 // } 3512 } else { 3513 Menu newMenu = menuShell.findMenu (mp2); 3514 if (newMenu != null) { 3515 int id = OS.SHORT1FROMMP(mp1); 3516 item = menuShell.findMenuItem (id); 3517 } 3518 Menu oldMenu = shell.activeMenu; 3519 if (oldMenu != null) { 3520 Menu ancestor = oldMenu; 3521 while (ancestor != null && ancestor != newMenu) { 3522 ancestor = ancestor.getParentMenu (); 3523 } 3524 if (ancestor == newMenu) { 3525 ancestor = oldMenu; 3526 while (ancestor != newMenu) { 3527 /* 3528 * It is possible (but unlikely), that application 3529 * code could have disposed the widget in the hide 3530 * event or the item about to be armed. If this 3531 * happens, stop searching up the ancestor list 3532 * because there is no longer a link to follow. 3533 */ 3534 ancestor.sendEvent (SWT.Hide); 3535 if (ancestor.isDisposed ()) break; 3536 ancestor = ancestor.getParentMenu (); 3537 } 3538 /* 3539 * The shell and/or the item could be disposed when 3540 * processing hide events from above. If this happens, 3541 * ensure that the shell is not accessed and that no 3542 * arm event is sent to the item. 3543 */ 3544 if (!shell.isDisposed ()) { 3545 if (newMenu != null && newMenu.isDisposed ()) { 3546 newMenu = null; 3547 } 3548 shell.activeMenu = newMenu; 3549 } 3550 if (item != null && item.isDisposed ()) item = null; 3551 } 3552 } 3553 } 3554 if (item != null) item.sendEvent (SWT.Arm); 3555 } 3574 3556 return MRESULT.TRUE; 3575 3557 } … … 3830 3812 3831 3813 MRESULT WM_MENUEND (int mp1, int mp2) { 3832 System.out.println("Control:WM_MENUEND - HANDLE = " + Integer.toHexString (mp2));3833 3814 return null; 3834 3815 } … … 4040 4021 } 4041 4022 MRESULT WM_FOCUSCHANGE (int mp1, int mp2) { 4042 System.out.println("Control:WM_FOCUSCHANGE - HANDLE = " + Integer.toHexString (mp1));4043 4023 callWindowProc (OS.WM_FOCUSCHANGE, mp1, mp2); 4044 4024 return MRESULT.ZERO; -
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Decorations.java
r98 r105 393 393 if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES); 394 394 //@@TODO (dmik): debug code, remove when no more necessary 395 System.out.println (396 "Decorations.createHandle(): WC_FRAME has been created:\n" +397 " hwnd = " + Integer.toHexString (frameHandle) + "\n" +398 " hwnd.parent = " + Integer.toHexString (hwndParent) + "\n" +399 " hwnd.owner = " + Integer.toHexString (hwndOwner) + "\n" +400 " class = " + windowFrameClass() + "\n" +401 " style = " + Integer.toHexString (widgetFrameStyle())402 );395 //System.out.println ( 396 // "Decorations.createHandle(): WC_FRAME has been created:\n" + 397 // " hwnd = " + Integer.toHexString (frameHandle) + "\n" + 398 // " hwnd.parent = " + Integer.toHexString (hwndParent) + "\n" + 399 // " hwnd.owner = " + Integer.toHexString (hwndOwner) + "\n" + 400 // " class = " + windowFrameClass() + "\n" + 401 // " style = " + Integer.toHexString (widgetFrameStyle()) 402 //); 403 403 FRAMECDATA fcdata = new FRAMECDATA (); 404 404 fcdata.flCreateFlags = widgetFrameFlags (); … … 423 423 state |= CANVAS; 424 424 //@@TODO (dmik): debug code, remove when no more necessary 425 System.out.println (426 "Decorations.createHandle(): FID_CLIENT window has been created:\n" +427 " hwnd = " + Integer.toHexString (handle) + "\n" +428 " hwnd.parent = hwnd.owner = " + Integer.toHexString (frameHandle) + "\n" +429 " class = " + windowClass() + "\n" +430 " style = " + Integer.toHexString (widgetStyle())431 );425 //System.out.println ( 426 // "Decorations.createHandle(): FID_CLIENT window has been created:\n" + 427 // " hwnd = " + Integer.toHexString (handle) + "\n" + 428 // " hwnd.parent = hwnd.owner = " + Integer.toHexString (frameHandle) + "\n" + 429 // " class = " + windowClass() + "\n" + 430 // " style = " + Integer.toHexString (widgetStyle()) 431 //); 432 432 //@@TODO(dmik): do something for MDI windows if needed 433 433 // if (parent == null) return; … … 466 466 for (int i=0; i<menus.length; i++) { 467 467 Menu menu = menus [i]; 468 if ((menu != null)) 468 469 if ((menu != null) && (hMenu == menu.handle)) return menu; 469 470 } … … 1071 1072 // OS.SetMenu (handle, hMenu); 1072 1073 OS.WinSendMsg (frameHandle, OS.WM_UPDATEFRAME, OS.FCF_MENU, 0); 1073 System.out.println("Decorations:setMenuBar");1074 1074 destroyAcceleratorTable (); 1075 1075 } -
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Menu.java
r103 r105 233 233 0 /* presentation parameters */ 234 234 ); 235 System.out.println ( 236 "Menu.createHandle(): FID_MENU window has been created:\n" + 237 " hwnd = " + Integer.toHexString (handle) + "\n" + 238 " hwnd.parent = hwnd.owner = " + Integer.toHexString (handle) + "\n" + 239 " class = WC_MENU\n" + 240 " style = MS_ACTIONBAR" 241 ); 235 //@@TODO (lpino): debug code, remove when no more necessary 236 //System.out.println ( 237 // "Menu.createHandle(): FID_MENU window has been created:\n" + 238 // " hwnd = " + Integer.toHexString (handle) + "\n" + 239 // " hwnd.parent = hwnd.owner = " + Integer.toHexString (handle) + "\n" + 240 // " class = WC_MENU\n" + 241 // " style = MS_ACTIONBAR" 242 //); 242 243 } else if ((style & SWT.POP_UP) != 0) { 243 244 handle = OS.WinCreateWindow (parent.handle, /* parent window */ … … 252 253 0 /* presentation parameters */ 253 254 ); 254 System.out.println ( 255 "Menu.createHandle(): POPUP menu window has been created:\n" + 256 " hwnd = " + Integer.toHexString (handle) + "\n" + 257 " hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" + 258 " class = WC_MENU\n" + 259 " style = 0" 260 ); 255 //@@TODO (lpino): debug code, remove when no more necessary 256 //System.out.println ( 257 // "Menu.createHandle(): POPUP menu window has been created:\n" + 258 // " hwnd = " + Integer.toHexString (handle) + "\n" + 259 // " hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" + 260 // " class = WC_MENU\n" + 261 // " style = 0" 262 //); 261 263 262 264 } else if ((style & SWT.DROP_DOWN) != 0) { … … 273 275 0 /* presentation parameters */ 274 276 ); 277 //@@TODO (lpino): debug code, remove when no more necessary 275 278 //System.out.println ( 276 279 // "Menu.createHandle(): A menu has been created:\n" + … … 875 878 * the menu is zero and issue a fake WM_MENUSELECT. 876 879 */ 877 System.out.println("Menu:setVisible - HANDLE = " + Integer.toHexString (handle));878 short flOptions = OS.PU_MOUSEBUTTON1DOWN | OS.PU_KEYBOARD | OS.PU_MOUSEBUTTON1;879 boolean success = OS.WinPopupMenu(OS.HWND_DESKTOP, parent.handle, handle, 0, 0, 0, flOptions);880 880 // boolean success = OS.TrackPopupMenu (handle, flags, nX, nY, 0, hwndParent, null); 881 881 // if (!success && GetMenuItemCount (handle) == 0) { -
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/MenuItem.java
r103 r105 2 2 /* 3 3 * OS/2 version. 4 * Copyright (c) 2002, 200 7EclipseOS2 Team.4 * Copyright (c) 2002, 2008 EclipseOS2 Team. 5 5 */ 6 6
Note:
See TracChangeset
for help on using the changeset viewer.