2010-01-18 19:16:07 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 19:16:07 +03:00
|
|
|
|
|
|
|
#ifndef _nsEventShell_H_
|
|
|
|
#define _nsEventShell_H_
|
|
|
|
|
2010-08-25 06:08:28 +04:00
|
|
|
#include "AccEvent.h"
|
2010-01-18 19:16:07 +03:00
|
|
|
|
2013-05-21 20:03:33 +04:00
|
|
|
namespace mozilla {
|
|
|
|
template<typename T> class StaticRefPtr;
|
|
|
|
}
|
2010-03-17 10:10:52 +03:00
|
|
|
class nsIPersistentProperties;
|
|
|
|
|
2010-01-27 14:42:08 +03:00
|
|
|
/**
|
|
|
|
* Used for everything about events.
|
|
|
|
*/
|
2010-01-18 19:16:07 +03:00
|
|
|
class nsEventShell
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-01-18 19:17:01 +03:00
|
|
|
/**
|
|
|
|
* Fire the accessible event.
|
|
|
|
*/
|
2012-11-18 06:01:44 +04:00
|
|
|
static void FireEvent(mozilla::a11y::AccEvent* aEvent);
|
2010-01-18 19:17:01 +03:00
|
|
|
|
2010-01-18 19:16:07 +03: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-18 06:01:44 +04:00
|
|
|
static void FireEvent(uint32_t aEventType,
|
|
|
|
mozilla::a11y::Accessible* aAccessible,
|
|
|
|
mozilla::a11y::EIsFromUserInput aIsFromUserInput = mozilla::a11y::eAutoDetect);
|
2010-01-20 14:16:32 +03:00
|
|
|
|
2013-07-28 22:33:57 +04:00
|
|
|
/**
|
|
|
|
* Fire state change event.
|
|
|
|
*/
|
|
|
|
static void FireEvent(mozilla::a11y::Accessible* aTarget, uint64_t aState,
|
|
|
|
bool aIsEnabled, bool aIsFromUserInput)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::a11y::AccStateChangeEvent> stateChangeEvent =
|
2013-07-28 22:33:57 +04:00
|
|
|
new mozilla::a11y::AccStateChangeEvent(aTarget, aState, aIsEnabled,
|
|
|
|
(aIsFromUserInput ?
|
|
|
|
mozilla::a11y::eFromUserInput :
|
|
|
|
mozilla::a11y::eNoUserInput));
|
|
|
|
FireEvent(stateChangeEvent);
|
|
|
|
}
|
|
|
|
|
2010-01-20 14:16:32 +03: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 12:23:18 +04:00
|
|
|
static void GetEventAttributes(nsINode *aNode,
|
2010-01-20 14:16:32 +03:00
|
|
|
nsIPersistentProperties *aAttributes);
|
|
|
|
|
|
|
|
private:
|
2013-05-21 20:03:33 +04:00
|
|
|
static mozilla::StaticRefPtr<nsINode> sEventTargetNode;
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sEventFromUserInput;
|
2010-01-18 19:16:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|