Bug 1631735 Part 1: Make nsCocoaWindow animated transitions asynchronous and atomic...
[gecko.git] / accessible / base / Platform.h
blob89bee48661d1d56147d9cabf5d66a39fdbdde52b
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
10 #include <stdint.h>
11 #include "nsStringFwd.h"
13 #if defined(ANDROID)
14 # include "nsTArray.h"
15 # include "nsRect.h"
16 #endif
18 #ifdef MOZ_WIDGET_COCOA
19 # include "mozilla/a11y/Role.h"
20 #endif
22 #if defined(XP_WIN)
23 # include "Units.h"
24 #endif
26 namespace mozilla {
27 namespace a11y {
29 class RemoteAccessible;
31 enum EPlatformDisabledState {
32 ePlatformIsForceEnabled = -1,
33 ePlatformIsEnabled = 0,
34 ePlatformIsDisabled = 1
37 /**
38 * Return the platform disabled state.
40 EPlatformDisabledState PlatformDisabledState();
42 #ifdef MOZ_ACCESSIBILITY_ATK
43 /**
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
48 void PreInit();
49 #endif
51 #if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_MACOSX)
52 /**
53 * Is platform accessibility enabled.
54 * Only used on linux with atk and MacOS for now.
56 bool ShouldA11yBeEnabled();
57 #endif
59 #if defined(XP_WIN)
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);
70 #endif
72 /**
73 * Called to initialize platform specific accessibility support.
74 * Note this is called after internal accessibility support is initialized.
76 void PlatformInit();
78 /**
79 * Shutdown platform accessibility.
80 * Note this is called before internal accessibility support is shutdown.
82 void PlatformShutdown();
84 /**
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);
90 /**
91 * Called just before a RemoteAccessible is destroyed so its wrapper can be
92 * disposed of and other action taken.
94 void ProxyDestroyed(RemoteAccessible*);
96 /**
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,
101 bool aEnabled);
103 #if defined(XP_WIN)
104 void ProxyFocusEvent(RemoteAccessible* aTarget,
105 const LayoutDeviceIntRect& aCaretRect);
106 void ProxyCaretMoveEvent(RemoteAccessible* aTarget,
107 const LayoutDeviceIntRect& aCaretRect,
108 int32_t aGranularity);
109 #else
110 void ProxyCaretMoveEvent(RemoteAccessible* aTarget, int32_t aOffset,
111 bool aIsSelectionCollapsed, int32_t aGranularity);
112 #endif
113 void ProxyTextChangeEvent(RemoteAccessible* aTarget, const nsAString& aStr,
114 int32_t aStart, uint32_t aLen, bool aIsInsert,
115 bool aFromUser);
116 void ProxyShowHideEvent(RemoteAccessible* aTarget, RemoteAccessible* aParent,
117 bool aInsert, bool aFromUser);
118 void ProxySelectionEvent(RemoteAccessible* aTarget, RemoteAccessible* aWidget,
119 uint32_t aType);
121 #if defined(ANDROID)
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);
138 class BatchData;
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);
145 #endif
147 #ifdef MOZ_WIDGET_COCOA
148 class TextRangeData;
149 void ProxyTextSelectionChangeEvent(RemoteAccessible* aTarget,
150 const nsTArray<TextRangeData>& aSelection);
152 void ProxyRoleChangedEvent(RemoteAccessible* aTarget, const a11y::role& aRole,
153 uint8_t aRoleMapEntryIndex);
154 #endif
156 } // namespace a11y
157 } // namespace mozilla
159 #endif // mozilla_a11y_Platform_h