|
Lines 58-64
Link Here
|
| 58 |
= new JSListenerInfo( "mouseup", |
58 |
= new JSListenerInfo( "mouseup", |
| 59 |
"org.eclipse.swt.EventUtil.mouseUp", |
59 |
"org.eclipse.swt.EventUtil.mouseUp", |
| 60 |
JSListenerType.ACTION ); |
60 |
JSListenerType.ACTION ); |
| 61 |
|
61 |
private static final JSListenerInfo MENU_DETECT_LISTENER_INFO_MOUSE |
|
|
62 |
= new JSListenerInfo( "keydown", |
| 63 |
"org.eclipse.swt.EventUtil.menuDetectedByKey", |
| 64 |
JSListenerType.ACTION ); |
| 65 |
private static final JSListenerInfo MENU_DETECT_LISTENER_INFO_KEY |
| 66 |
= new JSListenerInfo( "mouseup", |
| 67 |
"org.eclipse.swt.EventUtil.menuDetectedByMouse", |
| 68 |
JSListenerType.ACTION ); |
| 69 |
|
| 62 |
private static final String JS_FUNC_ADD_ACTIVATE_LISTENER_WIDGET |
70 |
private static final String JS_FUNC_ADD_ACTIVATE_LISTENER_WIDGET |
| 63 |
= "addActivateListenerWidget"; |
71 |
= "addActivateListenerWidget"; |
| 64 |
private static final String JS_FUNC_REMOVE_ACTIVATE_LISTENER_WIDGET |
72 |
private static final String JS_FUNC_REMOVE_ACTIVATE_LISTENER_WIDGET |
|
Lines 70-75
Link Here
|
| 70 |
private static final String PROP_MOUSE_LISTENER = "mouseListener"; |
78 |
private static final String PROP_MOUSE_LISTENER = "mouseListener"; |
| 71 |
private static final String PROP_KEY_LISTENER = "keyListener"; |
79 |
private static final String PROP_KEY_LISTENER = "keyListener"; |
| 72 |
private static final String PROP_TRAVERSE_LISTENER = "traverseListener"; |
80 |
private static final String PROP_TRAVERSE_LISTENER = "traverseListener"; |
|
|
81 |
private static final String PROP_MENU_DETECT_LISTENER = "menuDetectListener"; |
| 73 |
private static final String PROP_TAB_INDEX = "tabIndex"; |
82 |
private static final String PROP_TAB_INDEX = "tabIndex"; |
| 74 |
private static final String PROP_CURSOR = "cursor"; |
83 |
private static final String PROP_CURSOR = "cursor"; |
| 75 |
private static final String PROP_BACKGROUND_IMAGE = "backgroundImage"; |
84 |
private static final String PROP_BACKGROUND_IMAGE = "backgroundImage"; |
|
Lines 113-118
Link Here
|
| 113 |
* <li>whether KeyListeners are registered</li> |
122 |
* <li>whether KeyListeners are registered</li> |
| 114 |
* <li>whether TraverseListeners are registered</li> |
123 |
* <li>whether TraverseListeners are registered</li> |
| 115 |
* <li>whether HelpListeners are registered</li> |
124 |
* <li>whether HelpListeners are registered</li> |
|
|
125 |
* <li>whether MenuDetectListeners are registered</li> |
| 116 |
* </ul> |
126 |
* </ul> |
| 117 |
* |
127 |
* |
| 118 |
* @param control the control whose parameters to preserve |
128 |
* @param control the control whose parameters to preserve |
|
Lines 155-160
Link Here
|
| 155 |
adapter.preserve( PROP_TRAVERSE_LISTENER, |
165 |
adapter.preserve( PROP_TRAVERSE_LISTENER, |
| 156 |
Boolean.valueOf( TraverseEvent.hasListener( control ) ) ); |
166 |
Boolean.valueOf( TraverseEvent.hasListener( control ) ) ); |
| 157 |
WidgetLCAUtil.preserveHelpListener( control ); |
167 |
WidgetLCAUtil.preserveHelpListener( control ); |
|
|
168 |
preserveMenuDetectListener( control ); |
| 158 |
} |
169 |
} |
| 159 |
|
170 |
|
| 160 |
/** |
171 |
/** |
|
Lines 294-299
Link Here
|
| 294 |
writeKeyListener( control ); |
305 |
writeKeyListener( control ); |
| 295 |
writeTraverseListener( control ); |
306 |
writeTraverseListener( control ); |
| 296 |
writeKeyEventResponse( control ); |
307 |
writeKeyEventResponse( control ); |
|
|
308 |
writeMenuDetectListener( control ); |
| 297 |
WidgetLCAUtil.writeHelpListener( control ); |
309 |
WidgetLCAUtil.writeHelpListener( control ); |
| 298 |
} |
310 |
} |
| 299 |
|
311 |
|
|
Lines 589-594
Link Here
|
| 589 |
} |
601 |
} |
| 590 |
} |
602 |
} |
| 591 |
|
603 |
|
|
|
604 |
/////////////////////// |
| 605 |
// Menu Detect Listener |
| 606 |
|
| 607 |
/** |
| 608 |
* Preserves whether the given <code>widget</code> has one or more |
| 609 |
* <code>MenuDetect</code>s attached. |
| 610 |
* |
| 611 |
* @param control the widget to preserve |
| 612 |
* @since 1.3 |
| 613 |
*/ |
| 614 |
public static void preserveMenuDetectListener( final Control control ) { |
| 615 |
IWidgetAdapter adapter = WidgetUtil.getAdapter( control ); |
| 616 |
boolean hasListener = MenuDetectEvent.hasListener( control ); |
| 617 |
adapter.preserve( PROP_MENU_DETECT_LISTENER, |
| 618 |
Boolean.valueOf( hasListener ) ); |
| 619 |
} |
| 620 |
|
| 621 |
|
| 622 |
/** |
| 623 |
* Adds or removes client-side menu detect listeners for the the given |
| 624 |
* <code>control</code> as necessary. |
| 625 |
* |
| 626 |
* @param control |
| 627 |
* @since 1.3 |
| 628 |
*/ |
| 629 |
public static void writeMenuDetectListener( final Control control ) |
| 630 |
throws IOException |
| 631 |
{ |
| 632 |
boolean hasListener = MenuDetectEvent.hasListener( control ); |
| 633 |
JSWriter writer = JSWriter.getWriterFor( control ); |
| 634 |
writer.updateListener( MENU_DETECT_LISTENER_INFO_MOUSE, |
| 635 |
PROP_MENU_DETECT_LISTENER, |
| 636 |
hasListener ); |
| 637 |
writer.updateListener( MENU_DETECT_LISTENER_INFO_KEY, |
| 638 |
PROP_MENU_DETECT_LISTENER, |
| 639 |
hasListener ); |
| 640 |
} |
| 641 |
|
| 642 |
/** |
| 643 |
* Process a <code>HelpEvent</code> if the current request specifies that |
| 644 |
* there occured a help event for the given <code>widget</code>. |
| 645 |
* |
| 646 |
* @param control the control to process |
| 647 |
* @since 1.3 |
| 648 |
*/ |
| 649 |
public static void processMenuDetect( final Control control ) { |
| 650 |
if( WidgetLCAUtil.wasEventSent( control, JSConst.EVENT_MENU_DETECT ) ) { |
| 651 |
MenuDetectEvent event = new MenuDetectEvent( control ); |
| 652 |
Point point = readXYParams( control, |
| 653 |
JSConst.EVENT_MENU_DETECT_X, |
| 654 |
JSConst.EVENT_MENU_DETECT_Y ); |
| 655 |
point = control.getDisplay().map( control, null, point ); |
| 656 |
event.x = point.x; |
| 657 |
event.y = point.y; |
| 658 |
event.processEvent(); |
| 659 |
} |
| 660 |
} |
| 661 |
|
| 592 |
////////// |
662 |
////////// |
| 593 |
// Z-Index |
663 |
// Z-Index |
| 594 |
|
664 |
|