1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_a11y_Platform_h
8 #define mozilla_a11y_Platform_h
11 #include "nsStringFwd.h"
15 # include "nsTArray.h"
19 #ifdef MOZ_WIDGET_COCOA
20 # include "mozilla/a11y/Role.h"
21 # include "nsTArray.h"
28 class RemoteAccessible
;
30 enum EPlatformDisabledState
{
31 ePlatformIsForceEnabled
= -1,
32 ePlatformIsEnabled
= 0,
33 ePlatformIsDisabled
= 1
37 * Return the platform disabled state.
39 EPlatformDisabledState
PlatformDisabledState();
41 #ifdef MOZ_ACCESSIBILITY_ATK
43 * Perform initialization that should be done as soon as possible, in order
44 * to minimize startup time.
45 * XXX: this function and the next defined in ApplicationAccessibleWrap.cpp
50 #if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_DARWIN)
52 * Is platform accessibility enabled.
53 * Only used on Linux, MacOS and iOS for now.
55 bool ShouldA11yBeEnabled();
60 * Name of platform service that instantiated accessibility
62 void SetInstantiator(const uint32_t aInstantiatorPid
);
63 bool GetInstantiator(nsIFile
** aOutInstantiator
);
67 * Called to initialize platform specific accessibility support.
68 * Note this is called after internal accessibility support is initialized.
73 * Shutdown platform accessibility.
74 * Note this is called before internal accessibility support is shutdown.
76 void PlatformShutdown();
79 * called when a new RemoteAccessible is created, so the platform may setup a
80 * wrapper for it, or take other action.
82 void ProxyCreated(RemoteAccessible
* aProxy
);
85 * Called just before a RemoteAccessible is destroyed so its wrapper can be
86 * disposed of and other action taken.
88 void ProxyDestroyed(RemoteAccessible
*);
91 * Called when an event is fired on an Accessible so that platforms may fire
92 * events if appropriate.
94 void PlatformEvent(Accessible
* aTarget
, uint32_t aEventType
);
95 void PlatformStateChangeEvent(Accessible
* aTarget
, uint64_t aState
,
98 void PlatformFocusEvent(Accessible
* aTarget
,
99 const LayoutDeviceIntRect
& aCaretRect
);
100 void PlatformCaretMoveEvent(Accessible
* aTarget
, int32_t aOffset
,
101 bool aIsSelectionCollapsed
, int32_t aGranularity
,
102 const LayoutDeviceIntRect
& aCaretRect
,
104 void PlatformTextChangeEvent(Accessible
* aTarget
, const nsAString
& aStr
,
105 int32_t aStart
, uint32_t aLen
, bool aIsInsert
,
107 void PlatformShowHideEvent(Accessible
* aTarget
, Accessible
* aParent
,
108 bool aInsert
, bool aFromUser
);
109 void PlatformSelectionEvent(Accessible
* aTarget
, Accessible
* aWidget
,
113 void PlatformScrollingEvent(Accessible
* aTarget
, uint32_t aEventType
,
114 uint32_t aScrollX
, uint32_t aScrollY
,
115 uint32_t aMaxScrollX
, uint32_t aMaxScrollY
);
117 void PlatformAnnouncementEvent(Accessible
* aTarget
,
118 const nsAString
& aAnnouncement
,
121 bool LocalizeString(const nsAString
& aToken
, nsAString
& aLocalized
);
124 #ifdef MOZ_WIDGET_COCOA
126 void PlatformTextSelectionChangeEvent(Accessible
* aTarget
,
127 const nsTArray
<TextRange
>& aSelection
);
129 void PlatformRoleChangedEvent(Accessible
* aTarget
, const a11y::role
& aRole
,
130 uint8_t aRoleMapEntryIndex
);
134 } // namespace mozilla
136 #endif // mozilla_a11y_Platform_h