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"
14 # include "nsTArray.h"
18 #ifdef MOZ_WIDGET_COCOA
19 # include "mozilla/a11y/Role.h"
29 class RemoteAccessible
;
31 enum EPlatformDisabledState
{
32 ePlatformIsForceEnabled
= -1,
33 ePlatformIsEnabled
= 0,
34 ePlatformIsDisabled
= 1
38 * Return the platform disabled state.
40 EPlatformDisabledState
PlatformDisabledState();
42 #ifdef MOZ_ACCESSIBILITY_ATK
44 * Perform initialization that should be done as soon as possible, in order
45 * to minimize startup time.
46 * XXX: this function and the next defined in ApplicationAccessibleWrap.cpp
51 #if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_MACOSX)
53 * Is platform accessibility enabled.
54 * Only used on linux with atk and MacOS for now.
56 bool ShouldA11yBeEnabled();
61 * Do we have AccessibleHandler.dll registered.
63 bool IsHandlerRegistered();
66 * Name of platform service that instantiated accessibility
68 void SetInstantiator(const uint32_t aInstantiatorPid
);
69 bool GetInstantiator(nsIFile
** aOutInstantiator
);
73 * Called to initialize platform specific accessibility support.
74 * Note this is called after internal accessibility support is initialized.
79 * Shutdown platform accessibility.
80 * Note this is called before internal accessibility support is shutdown.
82 void PlatformShutdown();
85 * called when a new RemoteAccessible is created, so the platform may setup a
86 * wrapper for it, or take other action.
88 void ProxyCreated(RemoteAccessible
* aProxy
);
91 * Called just before a RemoteAccessible is destroyed so its wrapper can be
92 * disposed of and other action taken.
94 void ProxyDestroyed(RemoteAccessible
*);
97 * Callied when an event is fired on a proxied accessible.
99 void ProxyEvent(RemoteAccessible
* aTarget
, uint32_t aEventType
);
100 void ProxyStateChangeEvent(RemoteAccessible
* aTarget
, uint64_t aState
,
104 void ProxyFocusEvent(RemoteAccessible
* aTarget
,
105 const LayoutDeviceIntRect
& aCaretRect
);
106 void ProxyCaretMoveEvent(RemoteAccessible
* aTarget
,
107 const LayoutDeviceIntRect
& aCaretRect
,
108 int32_t aGranularity
);
110 void ProxyCaretMoveEvent(RemoteAccessible
* aTarget
, int32_t aOffset
,
111 bool aIsSelectionCollapsed
, int32_t aGranularity
);
113 void ProxyTextChangeEvent(RemoteAccessible
* aTarget
, const nsAString
& aStr
,
114 int32_t aStart
, uint32_t aLen
, bool aIsInsert
,
116 void ProxyShowHideEvent(RemoteAccessible
* aTarget
, RemoteAccessible
* aParent
,
117 bool aInsert
, bool aFromUser
);
118 void ProxySelectionEvent(RemoteAccessible
* aTarget
, RemoteAccessible
* aWidget
,
122 void ProxyVirtualCursorChangeEvent(RemoteAccessible
* aTarget
,
123 RemoteAccessible
* aOldPosition
,
124 int32_t aOldStartOffset
,
125 int32_t aOldEndOffset
,
126 RemoteAccessible
* aNewPosition
,
127 int32_t aNewStartOffset
,
128 int32_t aNewEndOffset
, int16_t aReason
,
129 int16_t aBoundaryType
, bool aFromUser
);
131 void ProxyScrollingEvent(RemoteAccessible
* aTarget
, uint32_t aEventType
,
132 uint32_t aScrollX
, uint32_t aScrollY
,
133 uint32_t aMaxScrollX
, uint32_t aMaxScrollY
);
135 void ProxyAnnouncementEvent(RemoteAccessible
* aTarget
,
136 const nsAString
& aAnnouncement
, uint16_t aPriority
);
140 void ProxyBatch(RemoteAccessible
* aDocument
, const uint64_t aBatchType
,
141 const nsTArray
<RemoteAccessible
*>& aAccessibles
,
142 const nsTArray
<BatchData
>& aData
);
144 bool LocalizeString(const nsAString
& aToken
, nsAString
& aLocalized
);
147 #ifdef MOZ_WIDGET_COCOA
149 void ProxyTextSelectionChangeEvent(RemoteAccessible
* aTarget
,
150 const nsTArray
<TextRangeData
>& aSelection
);
152 void ProxyRoleChangedEvent(RemoteAccessible
* aTarget
, const a11y::role
& aRole
,
153 uint8_t aRoleMapEntryIndex
);
157 } // namespace mozilla
159 #endif // mozilla_a11y_Platform_h