Java 类org.eclipse.swt.events.GestureListener 实例源码

项目:pandionj    文件:GraphViewerZoomable.java   
GraphViewerZoomable(Composite composite, int style) {
    super(composite, style);
    getZoomManager().setZoom(1.0);
    Graph graph = getGraphControl();
    graph.setScrollBarVisibility(FigureCanvas.ALWAYS);
    graph.setTouchEnabled(false);
    graph.addGestureListener(new GestureListener() {
        public void gesture(GestureEvent e) {
            if(e.detail == SWT.GESTURE_MAGNIFY)
                zoom(e.magnification);
        }
    });
}
项目:gef-gwt    文件:Control.java   
/**
 * Adds the listener to the collection of listeners who will be notified
 * when gesture events are generated for the control, by sending it one of
 * the messages defined in the <code>GestureListener</code> interface.
 * <p>
 * NOTE: If <code>setTouchEnabled(true)</code> has previously been invoked
 * on the receiver then <code>setTouchEnabled(false)</code> must be invoked
 * on it to specify that gesture events should be sent instead of touch
 * events.
 * </p>
 * 
 * @param listener
 *            the listener which should be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see GestureListener
 * @see #removeGestureListener
 * @see #setTouchEnabled
 * 
 * @since 3.7
 */
public void addGestureListener(GestureListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Gesture, typedListener);
}
项目:gef-gwt    文件:Control.java   
/**
 * Removes the listener from the collection of listeners who will be
 * notified when gesture events are generated for the control.
 * 
 * @param listener
 *            the listener which should no longer be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see GestureListener
 * @see #addGestureListener
 * 
 * @since 3.7
 */
public void removeGestureListener(GestureListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    if (eventTable == null)
        return;
    eventTable.unhook(SWT.Gesture, listener);
}