michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _nsEventShell_H_ michael@0: #define _nsEventShell_H_ michael@0: michael@0: #include "AccEvent.h" michael@0: michael@0: namespace mozilla { michael@0: template class StaticRefPtr; michael@0: } michael@0: class nsIPersistentProperties; michael@0: michael@0: /** michael@0: * Used for everything about events. michael@0: */ michael@0: class nsEventShell michael@0: { michael@0: public: michael@0: michael@0: /** michael@0: * Fire the accessible event. michael@0: */ michael@0: static void FireEvent(mozilla::a11y::AccEvent* aEvent); michael@0: michael@0: /** michael@0: * Fire accessible event of the given type for the given accessible. michael@0: * michael@0: * @param aEventType [in] the event type michael@0: * @param aAccessible [in] the event target michael@0: */ michael@0: static void FireEvent(uint32_t aEventType, michael@0: mozilla::a11y::Accessible* aAccessible, michael@0: mozilla::a11y::EIsFromUserInput aIsFromUserInput = mozilla::a11y::eAutoDetect); michael@0: michael@0: /** michael@0: * Fire state change event. michael@0: */ michael@0: static void FireEvent(mozilla::a11y::Accessible* aTarget, uint64_t aState, michael@0: bool aIsEnabled, bool aIsFromUserInput) michael@0: { michael@0: nsRefPtr stateChangeEvent = michael@0: new mozilla::a11y::AccStateChangeEvent(aTarget, aState, aIsEnabled, michael@0: (aIsFromUserInput ? michael@0: mozilla::a11y::eFromUserInput : michael@0: mozilla::a11y::eNoUserInput)); michael@0: FireEvent(stateChangeEvent); michael@0: } michael@0: michael@0: /** michael@0: * Append 'event-from-input' object attribute if the accessible event has michael@0: * been fired just now for the given node. michael@0: * michael@0: * @param aNode [in] the DOM node michael@0: * @param aAttributes [in, out] the attributes michael@0: */ michael@0: static void GetEventAttributes(nsINode *aNode, michael@0: nsIPersistentProperties *aAttributes); michael@0: michael@0: private: michael@0: static mozilla::StaticRefPtr sEventTargetNode; michael@0: static bool sEventFromUserInput; michael@0: }; michael@0: michael@0: #endif