nsEventShell.h (1574B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef _nsEventShell_H_ 7 #define _nsEventShell_H_ 8 9 #include "AccEvent.h" 10 11 namespace mozilla { 12 template <typename T> 13 class StaticRefPtr; 14 } 15 16 /** 17 * Used for everything about events. 18 */ 19 class nsEventShell { 20 public: 21 /** 22 * Fire the accessible event. 23 */ 24 static void FireEvent(mozilla::a11y::AccEvent* aEvent); 25 26 /** 27 * Fire accessible event of the given type for the given accessible. 28 * 29 * @param aEventType [in] the event type 30 * @param aAccessible [in] the event target 31 */ 32 static void FireEvent(uint32_t aEventType, 33 mozilla::a11y::LocalAccessible* aAccessible, 34 mozilla::a11y::EIsFromUserInput aIsFromUserInput = 35 mozilla::a11y::eAutoDetect); 36 37 /** 38 * Fire state change event. 39 */ 40 static void FireEvent(mozilla::a11y::LocalAccessible* aTarget, 41 uint64_t aState, bool aIsEnabled, 42 bool aIsFromUserInput) { 43 RefPtr<mozilla::a11y::AccStateChangeEvent> stateChangeEvent = 44 new mozilla::a11y::AccStateChangeEvent( 45 aTarget, aState, aIsEnabled, 46 (aIsFromUserInput ? mozilla::a11y::eFromUserInput 47 : mozilla::a11y::eNoUserInput)); 48 FireEvent(stateChangeEvent); 49 } 50 }; 51 52 #endif