/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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"

[scriptable, builtinclass, uuid(5b689c9c-ce82-4836-bb7b-f2fa0c3d2f32)]
interface nsIDOMWheelEvent : nsIDOMMouseEvent
{
  const unsigned long DOM_DELTA_PIXEL = 0x00;
  const unsigned long DOM_DELTA_LINE  = 0x01;
  const unsigned long DOM_DELTA_PAGE  = 0x02;

  // Note that DOM Level 3 Events defines the type of delta values as float.
  // However, we should use double for them.  Javascript engine always uses
  // double even if interface attributes are float.  If we defined them
  // as float, that would cause error at casting from float to double.
  // E.g., following function may return false if the deltaX is float:
  //
  // function () {
  //   var event = new WheelEvent("wheel", { deltaX: 0.1 });
  //   return (event.deltaX == 0.1);
  // }

  readonly attribute double        deltaX;
  readonly attribute double        deltaY;
  readonly attribute double        deltaZ;
  readonly attribute unsigned long deltaMode;

  [noscript] void initWheelEvent(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 unsigned short buttonArg,
                                 in nsIDOMEventTarget relatedTargetArg,
                                 in DOMString modifiersListArg,
                                 in double deltaXArg,
                                 in double deltaYArg,
                                 in double deltaZArg,
                                 in unsigned long deltaMode);
};

dictionary WheelEventInit : MouseEventInit
{
  double deltaX;
  double deltaY;
  double deltaZ;
  unsigned long deltaMode;
};
