- Timestamp:
- Jun 14, 2008, 12:44:45 AM (17 years ago)
- Location:
- trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Control.java
r98 r101 47 47 int drawCount, hCursor; 48 48 int foreground, background; 49 //@@TODO(dmik)50 49 Menu menu; 51 50 String toolTipText; … … 3265 3264 // * WPARAM. Otherwise, use WPARAM to find the menu. 3266 3265 // */ 3267 // Shell shell = getShell (); 3268 // Menu oldMenu = shell.activeMenu, newMenu = null; 3266 Shell shell = getShell (); 3267 Menu oldMenu = shell.activeMenu; 3268 Menu newMenu = null; 3269 3269 // if ((lParam >> 16) == 0) { 3270 // newMenu = menuShell ().findMenu (wParam);3270 newMenu = menuShell ().findMenu (mp2); 3271 3271 // } 3272 // Menu menu = newMenu; 3273 // while (menu != null && menu != oldMenu) { 3274 // menu = menu.getParentMenu (); 3275 // } 3276 // if (menu == null) { 3277 // menu = shell.activeMenu; 3278 // while (menu != null) { 3279 // /* 3280 // * It is possible (but unlikely), that application 3281 // * code could have disposed the widget in the hide 3282 // * event. If this happens, stop searching up the 3283 // * ancestor list because there is no longer a link 3284 // * to follow. 3285 // */ 3286 // menu.sendEvent (SWT.Hide); 3287 // if (menu.isDisposed ()) break; 3288 // menu = menu.getParentMenu (); 3289 // Menu ancestor = newMenu; 3290 // while (ancestor != null && ancestor != menu) { 3291 // ancestor = ancestor.getParentMenu (); 3292 // } 3293 // if (ancestor != null) break; 3294 // } 3295 // } 3272 Menu menu = newMenu; 3273 while (menu != null && menu != oldMenu) { 3274 menu = menu.getParentMenu (); 3275 } 3276 if (menu == null) { 3277 menu = shell.activeMenu; 3278 while (menu != null) { 3279 /* 3280 * It is possible (but unlikely), that application 3281 * code could have disposed the widget in the hide 3282 * event. If this happens, stop searching up the 3283 * ancestor list because there is no longer a link 3284 * to follow. 3285 */ 3286 menu.sendEvent (SWT.Hide); 3287 if (menu.isDisposed ()) break; 3288 menu = menu.getParentMenu (); 3289 Menu ancestor = newMenu; 3290 while (ancestor != null && ancestor != menu) { 3291 ancestor = ancestor.getParentMenu (); 3292 } 3293 if (ancestor != null) break; 3294 } 3295 } 3296 System.out.println("Control:WM_INITMENU " + menu); 3296 3297 // 3297 3298 // /* … … 3300 3301 // * a field to null in a disposed shell is not harmful. 3301 3302 // */ 3302 // if (newMenu != null && newMenu.isDisposed ()) newMenu = null; 3303 // shell.activeMenu = newMenu; 3303 if (newMenu != null && newMenu.isDisposed ()) 3304 newMenu = null; 3305 shell.activeMenu = newMenu; 3304 3306 // 3305 3307 // /* 3306 3308 // * Send the show event 3307 3309 // */ 3308 //if (newMenu != null && newMenu != oldMenu) {3309 ///*3310 //* SWT.Selection events are posted to allow stepping3311 //* in the VA/Java debugger. SWT.Show events are3312 //* sent to ensure that application event handler3313 //* code runs before the menu is displayed. This3314 //* means that SWT.Show events would normally occur3315 //* before SWT.Selection events. While this is not3316 //* strictly incorrect, applications often use the3317 //* SWT.Selection event to update the state of menu3318 //* items and would like the ordering of events to3319 //* be the other way around.3320 //*3321 //* The fix is to run the deferred events before3322 //* the menu is shown. This means that stepping3323 //* through a selection event that was caused by3324 //* a popup menu will fail in VA/Java.3325 //*/3326 //display.runDeferredEvents ();3327 //newMenu.sendEvent (SWT.Show);3328 //// widget could be disposed at this point3329 //}3310 if (newMenu != null && newMenu != oldMenu) { 3311 /* 3312 * SWT.Selection events are posted to allow stepping 3313 * in the VA/Java debugger. SWT.Show events are 3314 * sent to ensure that application event handler 3315 * code runs before the menu is displayed. This 3316 * means that SWT.Show events would normally occur 3317 * before SWT.Selection events. While this is not 3318 * strictly incorrect, applications often use the 3319 * SWT.Selection event to update the state of menu 3320 * items and would like the ordering of events to 3321 * be the other way around. 3322 * 3323 * The fix is to run the deferred events before 3324 * the menu is shown. This means that stepping 3325 * through a selection event that was caused by 3326 * a popup menu will fail in VA/Java. 3327 */ 3328 display.runDeferredEvents (); 3329 newMenu.sendEvent (SWT.Show); 3330 // widget could be disposed at this point 3331 } 3330 3332 return null; 3331 3333 } -
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Shell.java
r98 r101 680 680 releaseShells (); 681 681 super.releaseWidget (); 682 //@@TODO(dmik) 683 // activeMenu = null; 682 activeMenu = null; 684 683 // display.clearModal (this); 685 684 display = null; … … 1250 1249 // return result; 1251 1250 //} 1252 MRESULT WM_CONTEXTMENU (int mp1, int mp2) { 1253 System.out.println("Shell:WM_CONTEXTMENU - HANDLE = " + Integer.toHexString (handle)); 1254 return MRESULT.TRUE; 1255 } 1256 } 1251 //MRESULT WM_CONTEXTMENU (int mp1, int mp2) { 1252 // System.out.println("Shell:WM_CONTEXTMENU - PARENT HANDLE = " + Integer.toHexString (handle)); 1253 // System.out.println("Control:WM_CONTEXTMENU - MENU HANDLE = " + Integer.toHexString (activeMenu.handle)); 1254 // return MRESULT.TRUE; 1255 //} 1256 }
Note:
See TracChangeset
for help on using the changeset viewer.