2010-01-18 08:16:07 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2010-01-18 08:16:07 -08:00
|
|
|
|
|
|
|
#ifndef _nsEventShell_H_
|
|
|
|
#define _nsEventShell_H_
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
#include "AccEvent.h"
|
2010-01-18 08:16:07 -08:00
|
|
|
|
2013-05-21 09:03:33 -07:00
|
|
|
namespace mozilla {
|
|
|
|
template<typename T> class StaticRefPtr;
|
|
|
|
}
|
2010-03-17 00:10:52 -07:00
|
|
|
class nsIPersistentProperties;
|
|
|
|
|
2010-01-27 03:42:08 -08:00
|
|
|
/**
|
|
|
|
* Used for everything about events.
|
|
|
|
*/
|
2010-01-18 08:16:07 -08:00
|
|
|
class nsEventShell
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-01-18 08:17:01 -08:00
|
|
|
/**
|
|
|
|
* Fire the accessible event.
|
|
|
|
*/
|
2012-11-17 18:01:44 -08:00
|
|
|
static void FireEvent(mozilla::a11y::AccEvent* aEvent);
|
2010-01-18 08:17:01 -08:00
|
|
|
|
2010-01-18 08:16:07 -08:00
|
|
|
/**
|
|
|
|
* Fire accessible event of the given type for the given accessible.
|
|
|
|
*
|
|
|
|
* @param aEventType [in] the event type
|
|
|
|
* @param aAccessible [in] the event target
|
|
|
|
*/
|
2012-11-17 18:01:44 -08:00
|
|
|
static void FireEvent(uint32_t aEventType,
|
|
|
|
mozilla::a11y::Accessible* aAccessible,
|
|
|
|
mozilla::a11y::EIsFromUserInput aIsFromUserInput = mozilla::a11y::eAutoDetect);
|
2010-01-20 03:16:32 -08:00
|
|
|
|
2013-07-28 11:33:57 -07:00
|
|
|
/**
|
|
|
|
* Fire state change event.
|
|
|
|
*/
|
|
|
|
static void FireEvent(mozilla::a11y::Accessible* aTarget, uint64_t aState,
|
|
|
|
bool aIsEnabled, bool aIsFromUserInput)
|
|
|
|
{
|
|
|
|
nsRefPtr<mozilla::a11y::AccStateChangeEvent> stateChangeEvent =
|
|
|
|
new mozilla::a11y::AccStateChangeEvent(aTarget, aState, aIsEnabled,
|
|
|
|
(aIsFromUserInput ?
|
|
|
|
mozilla::a11y::eFromUserInput :
|
|
|
|
mozilla::a11y::eNoUserInput));
|
|
|
|
FireEvent(stateChangeEvent);
|
|
|
|
}
|
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
/**
|
|
|
|
* Append 'event-from-input' object attribute if the accessible event has
|
|
|
|
* been fired just now for the given node.
|
|
|
|
*
|
|
|
|
* @param aNode [in] the DOM node
|
|
|
|
* @param aAttributes [in, out] the attributes
|
|
|
|
*/
|
2010-06-11 01:23:18 -07:00
|
|
|
static void GetEventAttributes(nsINode *aNode,
|
2010-01-20 03:16:32 -08:00
|
|
|
nsIPersistentProperties *aAttributes);
|
|
|
|
|
|
|
|
private:
|
2013-05-21 09:03:33 -07:00
|
|
|
static mozilla::StaticRefPtr<nsINode> sEventTargetNode;
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool sEventFromUserInput;
|
2010-01-18 08:16:07 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|