Top Description Inners Fields Methods
com.jogamp.newt.event

public Interface GestureHandler

Known Direct Implementers
com.jogamp.newt.event.PinchToZoomGesture, com.jogamp.newt.event.DoubleTapScrollGesture
Imports
jogamp.newt.Debug

Generic gesture handler interface designed to allow pass-through filtering of InputEvents.

To avoid negative impact on event processing, implementation shall restrict computation as much as possible and only within it's appropriate gesture states.

To allow custom user events, other than the normal InputEvents, a user may return a GestureEvent in it's implementation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
GestureHandler.GestureEvent

A custom gesture event

public static interface

Field Summary

Modifier and TypeField and Description
public static final boolean

Method Summary

Modifier and TypeMethod and Description
public void
clear(boolean
if true, also clears started state, otherwise stay within gesture - if appropriate. Staying within a gesture allows fluent continuous gesture sequence, e.g. for scrolling.
clearStarted
)

Clears state of handler, i.e. resets all states incl.

public InputEvent
getGestureEvent()

Returns the corresponding InputEvent for the gesture as detected by a previous process(InputEvent), which has not been cleared.

public boolean
hasGesture()

Returns true if a previous process(InputEvent) command produced a gesture, which has not been cleared.

public boolean
isWithinGesture()

Returns true if within a gesture as detected by a previous process(InputEvent) command, which has not been cleared.

public boolean
process(InputEvent e)

Process the given InputEvent and returns true if it produced the gesture.

Field Detail

DEBUGback to summary
public static final boolean DEBUG

Method Detail

clearback to summary
public void clear(boolean clearStarted)

Clears state of handler, i.e. resets all states incl. previous detected gesture.

Parameters
clearStarted:boolean

if true, also clears started state, otherwise stay within gesture - if appropriate. Staying within a gesture allows fluent continuous gesture sequence, e.g. for scrolling.

getGestureEventback to summary
public InputEvent getGestureEvent()

Returns the corresponding InputEvent for the gesture as detected by a previous process(InputEvent), which has not been cleared. Otherwise returns null.

Only implemented for gestures mapping to InputEvents.

hasGestureback to summary
public boolean hasGesture()

Returns true if a previous process(InputEvent) command produced a gesture, which has not been cleared. Otherwise returns false.

isWithinGestureback to summary
public boolean isWithinGesture()

Returns true if within a gesture as detected by a previous process(InputEvent) command, which has not been cleared. Otherwise returns false.

processback to summary
public boolean process(InputEvent e)

Process the given InputEvent and returns true if it produced the gesture. Otherwise returns false.

If a gesture was already detected previously and has not been cleared, method does not process the event and returns true.

Besides validation of the event's details, the handler may also validate the InputEvent.InputClass and/or InputEvent.InputType.

com.jogamp.newt.event back to summary

public Class GestureHandler.GestureEvent

extends InputEvent
Class Inheritance
Known Direct Subclasses
com.jogamp.newt.event.PinchToZoomGesture.ZoomEvent
Annotations
@SuppressWarnings:serial

A custom gesture event

Field Summary

Modifier and TypeField and Description
public static final short
EVENT_GESTURE_DETECTED

A gesture has been detected.

private final GestureHandler
private final InputEvent
Inherited from com.jogamp.newt.event.InputEvent:
ALT_GRAPH_MASKALT_MASKAUTOREPEAT_MASKBUTTON1_MASKBUTTON2_MASKBUTTON3_MASKBUTTON4_MASKBUTTON5_MASKBUTTON6_MASKBUTTON7_MASKBUTTON8_MASKBUTTON9_MASKBUTTONALL_MASKBUTTONLAST_MASKCONFINED_MASKCTRL_MASKINVISIBLE_MASKMETA_MASKSHIFT_MASK

Constructor Summary

AccessConstructor and Description
public
GestureEvent(final Object source, final long when, final int modifiers, final GestureHandler handler, final InputEvent
TODO
trigger
)

Creates a gesture event with default type EVENT_GESTURE_DETECTED.

public
GestureEvent(final short
must lie within [400..599]
event_type
,
final Object source, final long when, final int modifiers, final GestureHandler handler, final InputEvent
TODO
trigger
)

Creates a gesture event with custom event_type !

Method Summary

Modifier and TypeMethod and Description
public final GestureHandler
getHandler()

Return the GestureHandler, which produced the event.

public final InputEvent
getTrigger()

Triggering InputEvent

public String
toString()

Overrides com.jogamp.newt.event.InputEvent.toString.

Returns a String representation of this EventObject.
Inherited from com.jogamp.newt.event.InputEvent:
getButtonDownCountgetButtonMaskgetButtonsDowngetModifiersgetModifiersStringisAltDownisAltGraphDownisAnyButtonDownisAutoRepeatisButtonDownisConfinedisControlDownisInvisibleisMetaDownisShiftDowntoString

Field Detail

EVENT_GESTURE_DETECTEDback to summary
public static final short EVENT_GESTURE_DETECTED

A gesture has been detected.

handlerback to summary
private final GestureHandler handler
ieback to summary
private final InputEvent ie

Constructor Detail

GestureEventback to summary
public GestureEvent(final Object source, final long when, final int modifiers, final GestureHandler handler, final InputEvent trigger)

Creates a gesture event with default type EVENT_GESTURE_DETECTED.

Parameters
trigger:InputEvent

TODO

GestureEventback to summary
public GestureEvent(final short event_type, final Object source, final long when, final int modifiers, final GestureHandler handler, final InputEvent trigger)

Creates a gesture event with custom event_type !

Parameters
event_type:short

must lie within [400..599]

trigger:InputEvent

TODO

Method Detail

getHandlerback to summary
public final GestureHandler getHandler()

Return the GestureHandler, which produced the event.

getTriggerback to summary
public final InputEvent getTrigger()

Triggering InputEvent

toStringback to summary
public String toString()

Overrides com.jogamp.newt.event.InputEvent.toString.

Doc from java.util.EventObject.toString.

Returns a String representation of this EventObject.

Returns:String

a String representation of this EventObject

com.jogamp.newt.event back to summary

public Interface GestureHandler.GestureListener

extends NEWTEventListener

Listener for GestureEvents.
See Also
GestureEvent

Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

gestureDetectedback to summary
public void gestureDetected(GestureHandler.GestureEvent gh)

GestureHandler has detected the gesture.