/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2003
 * the Initial Developer. All Rights Reserved.
 *
 * Original Author: Aaron Leventhal (aaronl@netscape.com)
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

interface nsIAccessible;
interface nsIAccessibleDocument;
interface nsIDOMNode;

%{C++
#define NS_ACCESSIBLE_EVENT_TOPIC "accessible-event"
%}

/**
 * An interface for accessibility events listened to
 * by in-process accessibility clients, which can be used
 * to find out how to get accessibility and DOM interfaces for
 * the event and its target. To listen to in-process accessibility invents,
 * make your object an nsIObserver, and listen for accessible-event by 
 * using code something like this:
 *   nsCOMPtr<nsIObserverService> observerService = 
 *     do_GetService("@mozilla.org/observer-service;1", &rv);
 *   if (NS_SUCCEEDED(rv)) 
 *     rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
 *
 * @status UNDER_REVIEW
 */
[scriptable, uuid(87F29033-C4A6-40a3-AC7A-3BA391F9992D)]
interface nsIAccessibleEvent : nsISupports
{
  /**
   * The type of event, based on the enumerated event values
   * defined in this interface.
   */
  readonly attribute unsigned long eventType;
  
  /**
   * The nsIAccessible associated with the event.
   * May return null if no accessible is available
   */
  readonly attribute nsIAccessible accessible;
  
  /**
   * The nsIAccessibleDocument that the event target nsIAccessible
   * resides in. This can be used to get the DOM window,
   * the DOM document and the window handler, among other things.
   */
  readonly attribute nsIAccessibleDocument accessibleDocument;

  /**
   * The nsIDOMNode associated with the event
   * May return null if accessible for event has been shut down
   */
  readonly attribute nsIDOMNode DOMNode;

  // these are set to the values given by MSAA
  const unsigned long EVENT_CREATE             = 0x8000;
  const unsigned long EVENT_DESTROY            = 0x8001;
  const unsigned long EVENT_SHOW               = 0x8002;
  const unsigned long EVENT_HIDE               = 0x8003;
  const unsigned long EVENT_REORDER            = 0x8004;
  const unsigned long EVENT_FOCUS              = 0x8005;
  const unsigned long EVENT_STATE_CHANGE       = 0x800A;
  const unsigned long EVENT_LOCATION_CHANGE    = 0x800B;
  const unsigned long EVENT_NAME_CHANGE        = 0x800C;
  const unsigned long EVENT_DESCRIPTIONCHANGE  = 0x800D;
  const unsigned long EVENT_VALUE_CHANGE       = 0x800E;
  const unsigned long EVENT_PARENTCHANGE       = 0x800F;
  const unsigned long EVENT_HELPCHANGE         = 0x8010;
  const unsigned long EVENT_DEFACTIONCHANGE    = 0x8011;
  const unsigned long EVENT_ACCELERATORCHANGE  = 0x8012;
  const unsigned long EVENT_SELECTION          = 0x8006;
  const unsigned long EVENT_SELECTION_ADD      = 0x8007;
  const unsigned long EVENT_SELECTION_REMOVE   = 0x8008;
  const unsigned long EVENT_SELECTION_WITHIN   = 0x8009;
  const unsigned long EVENT_ALERT              = 0x0002;
  const unsigned long EVENT_FOREGROUND         = 0x0003;
  const unsigned long EVENT_MENUSTART          = 0x0004;
  const unsigned long EVENT_MENUEND            = 0x0005;
  const unsigned long EVENT_MENUPOPUPSTART     = 0x0006;
  const unsigned long EVENT_MENUPOPUPEND       = 0x0007;
  const unsigned long EVENT_CAPTURESTART       = 0x0008;
  const unsigned long EVENT_CAPTUREEND         = 0x0009;
  const unsigned long EVENT_MOVESIZESTART      = 0x000A;
  const unsigned long EVENT_MOVESIZEEND        = 0x000B;
  const unsigned long EVENT_CONTEXTHELPSTART   = 0x000C;
  const unsigned long EVENT_CONTEXTHELPEND     = 0x000D;
  const unsigned long EVENT_DRAGDROPSTART      = 0x000E;
  const unsigned long EVENT_DRAGDROPEND        = 0x000F;
  const unsigned long EVENT_DIALOGSTART        = 0x0010;
  const unsigned long EVENT_DIALOGEND          = 0x0011;
  const unsigned long EVENT_SCROLLINGSTART     = 0x0012;
  const unsigned long EVENT_SCROLLINGEND       = 0x0013;
  const unsigned long EVENT_MINIMIZESTART      = 0x0016;
  const unsigned long EVENT_MINIMIZEEND        = 0x0017;

  // the additional events for ATK
  const unsigned long EVENT_ATK_PROPERTY_CHANGE        = 0x0100;
  const unsigned long EVENT_ATK_SELECTION_CHANGE       = 0x0101;
  const unsigned long EVENT_ATK_TEXT_CHANGE            = 0x0102;
  const unsigned long EVENT_ATK_TEXT_SELECTION_CHANGE  = 0x0103;
  const unsigned long EVENT_ATK_TEXT_CARET_MOVE        = 0x0104;
  const unsigned long EVENT_ATK_VISIBLE_DATA_CHANGE    = 0x0105;
  const unsigned long EVENT_ATK_TABLE_MODEL_CHANGE     = 0x0110;
  const unsigned long EVENT_ATK_TABLE_ROW_INSERT       = 0x0111;
  const unsigned long EVENT_ATK_TABLE_ROW_DELETE       = 0x0112;
  const unsigned long EVENT_ATK_TABLE_ROW_REORDER      = 0x0113;
  const unsigned long EVENT_ATK_TABLE_COLUMN_INSERT    = 0x0114;
  const unsigned long EVENT_ATK_TABLE_COLUMN_DELETE    = 0x0115;
  const unsigned long EVENT_ATK_TABLE_COLUMN_REORDER   = 0x0116;
  const unsigned long EVENT_ATK_LINK_SELECTED          = 0x0117;
  const unsigned long EVENT_ATK_WINDOW_ACTIVATE        = 0x0118;
  const unsigned long EVENT_ATK_WINDOW_CREATE          = 0x0119;
  const unsigned long EVENT_ATK_WINDOW_DEACTIVATE      = 0x0120;
  const unsigned long EVENT_ATK_WINDOW_DESTROY         = 0x0121;
  const unsigned long EVENT_ATK_WINDOW_MAXIMIZE        = 0x0122;
  const unsigned long EVENT_ATK_WINDOW_MINIMIZE        = 0x0123;
  const unsigned long EVENT_ATK_WINDOW_RESIZE          = 0x0124;
  const unsigned long EVENT_ATK_WINDOW_RESTORE         = 0x0125;
};
