gecko/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl

142 lines
5.7 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMMouseEvent.idl"
/**
* The nsIDOMSimpleGestureEvent interface is the datatype for all
* Mozilla-specific simple gesture events in the Document Object Model.
*
* The following events are generated:
*
* MozSwipeGesture - Generated when the user completes a swipe across
* across the input device.
*
* MozMagnifyGestureStart - Generated when the user begins the magnify
* ("pinch") gesture. The "delta" value represents the initial
* movement.
*
* MozMagnifyGestureUpdate - Generated periodically while the user is
* continuing the magnify ("pinch") gesture. The "delta" value
* represents the movement since the last MozMagnifyGestureStart or
* MozMagnifyGestureUpdate event.
*
* MozMagnifyGesture - Generated when the user has completed the
* magnify ("pinch") gesture. If you only want to receive a single
* event when the magnify gesture is complete, you only need to hook
* this event and can safely ignore the MozMagnifyGestureStart and the
* MozMagnifyGestureUpdate events. The "delta" value is the cumulative
* amount represented by the user's gesture.
*
* MozRotateGestureStart - Generated when the user begins the rotation
* gesture. The "delta" value represents the initial rotation.
*
* MozRotateGestureUpdate - Generated periodically while the user is
* continuing the rotation gesture. The "delta" value represents the
* rotation since the last MozRotateGestureStart or
* MozRotateGestureUpdate event.
*
* MozRotateGesture - Generated when the user has completed the
* rotation gesture. If you only want to receive a single event when
* the rotation gesture is complete, you only need to hook this event
* and can safely ignore the MozRotateGestureStart and the
* MozRotateGestureUpdate events. The "delta" value is the cumulative
* amount of rotation represented by the user's gesture.
*
* MozTapGesture - Generated when the user executes a two finger
* tap gesture on the input device. Client coordinates contain the
* center point of the tap.
* (XXX Not implemented on Mac)
*
* MozPressTapGesture - Generated when the user executes a press
* and tap two finger gesture (first finger down, second finger down,
* second finger up, first finger up) on the input device.
* Client coordinates contain the center pivot point of the action.
* (XXX Not implemented on Mac)
*
* MozEdgeUIGesture - Generated when the user swipes the display to
* invoke edge ui.
* (XXX Win8 only)
*
* Default behavior:
*
* Some operating systems support default behaviors for gesture events
* when they are not handled by the application. Consumers should
* use event.preventDefault() to prevent default behavior when
* consuming events.
*/
[scriptable, builtinclass, uuid(0748e618-6612-45d7-8d34-1f56d546e04a)]
interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent
{
/* Swipe direction constants */
const unsigned long DIRECTION_UP = 1;
const unsigned long DIRECTION_DOWN = 2;
const unsigned long DIRECTION_LEFT = 4;
const unsigned long DIRECTION_RIGHT = 8;
/* Rotational direction constants */
const unsigned long ROTATION_COUNTERCLOCKWISE = 1;
const unsigned long ROTATION_CLOCKWISE = 2;
/* Direction of a gesture. Diagonals are indicated by OR'ing the
* applicable constants together.
*
* Swipes gestures may occur in any direction.
*
* Magnify gestures do not have a direction.
*
* Rotation gestures will be either ROTATION_COUNTERCLOCKWISE or
* ROTATION_CLOCKWISE.
*/
readonly attribute unsigned long direction;
/* Delta value for magnify and rotate gestures.
*
* For rotation, the value is in degrees and is positive for
* clockwise rotation and negative for counterclockwise
* rotation.
*
* For magnification, the value will be positive for a "zoom in"
* (i.e, increased magnification) and negative for a "zoom out"
* (i.e., decreased magnification). The particular units
* represented by the "delta" are currently implementation specific.
*
* XXX - The units for measuring magnification are currently
* unspecified because the units used by Mac OS X are currently
* undocumented. The values are typically in the range of 0.0 to
* 100.0, but it is only safe currently to rely on the delta being
* positive or negative.
*
* Units on Windows represent the difference between the initial
* and current/final width between the two touch points on the input
* device and are measured in pixels.
*/
readonly attribute double delta;
/* Click count value for taps. */
readonly attribute unsigned long clickCount;
void initSimpleGestureEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in nsIDOMWindow viewArg,
in long detailArg,
in long screenXArg,
in long screenYArg,
in long clientXArg,
in long clientYArg,
in boolean ctrlKeyArg,
in boolean altKeyArg,
in boolean shiftKeyArg,
in boolean metaKeyArg,
in unsigned short buttonArg,
in nsIDOMEventTarget relatedTargetArg,
in unsigned long directionArg,
in double deltaArg,
in unsigned long clickCount);
};