2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef _MozAccessible_H_
9 #define _MozAccessible_H_
11 #include "AccessibleWrap.h"
12 #include "RemoteAccessible.h"
14 #import <Cocoa/Cocoa.h>
16 #import "MOXAccessibleBase.h"
18 @
class mozRootAccessible
;
21 * All mozAccessibles are either abstract objects (that correspond to XUL
22 * widgets, HTML frames, etc) or are attached to a certain view; for example
23 * a document view. When we hand an object off to an AT, we always want
24 * to give it the represented view, in the latter case.
30 inline mozAccessible
* GetNativeFromGeckoAccessible(
31 mozilla::a11y::Accessible
* aAcc
) {
35 if (LocalAccessible
* acc
= aAcc
->AsLocal()) {
36 mozAccessible
* native
= nil
;
37 acc
->GetNativeInterface((void**)&native
);
41 RemoteAccessible
* proxy
= aAcc
->AsRemote();
42 return reinterpret_cast<mozAccessible
*>(proxy
->GetWrapper());
45 // Checked state values some accessibles return as AXValue.
54 } // namespace mozilla
56 @interface mozAccessible
: MOXAccessibleBase
{
58 * Reference to the accessible we were created with;
59 * either a proxy accessible or an accessible wrap.
61 mozilla::a11y::Accessible
* mGeckoAccessible
;
64 * The role of our gecko accessible.
66 mozilla::a11y::role mRole
;
68 nsStaticAtom
* mARIARole
;
73 // inits with the given wrap or proxy accessible
74 - (id
)initWithAccessible
:(mozilla::a11y::Accessible
*)aAcc
;
76 // allows for gecko accessible access outside of the class
77 - (mozilla::a11y::Accessible
*)geckoAccessible
;
82 // should a child be disabled
83 - (BOOL
)disableChild
:(mozAccessible
*)child
;
85 // Given a gecko accessibility event type, post the relevant
86 // system accessibility notification.
87 // Note: when overriding or adding new events, make sure your events aren't
88 // filtered out in Platform::PlatformEvent or AccessibleWrap::HandleAccEvent!
89 - (void)handleAccessibleEvent
:(uint32_t)eventType
;
91 - (void)handleAccessibleTextChangeEvent
:(NSString
*)change
92 inserted
:(BOOL
)isInserted
93 inContainer
:(mozilla::a11y::Accessible
*)container
96 // internal method to retrieve a child at a given index.
97 - (id
)childAt
:(uint32_t)i
;
99 // Get gecko accessible's state.
102 // Get gecko accessible's state filtered through given mask.
103 - (uint64_t)stateWithMask
:(uint64_t)mask
;
105 // Notify of a state change, so notifications can be fired.
106 - (void)stateChanged
:(uint64_t)state isEnabled
:(BOOL
)enabled
;
108 // Get top level (tab) web area.
109 - (mozAccessible
*)topWebArea
;
111 // Handle a role change
112 - (void)handleRoleChanged
:(mozilla::a11y::role
)newRole
;
115 - (nsStaticAtom
*)ARIARole
;
117 // Get array of related mozAccessibles
118 - (NSArray
<mozAccessible
*>*)getRelationsByType
:
119 (mozilla::a11y::RelationType
)relationType
;
121 #pragma mark - mozAccessible protocol / widget
124 - (BOOL
)hasRepresentedView
;
127 - (id
)representedView
;
132 #pragma mark - MOXAccessible protocol
135 - (BOOL
)moxBlockSelector
:(SEL
)selector
;
138 - (id
)moxHitTest
:(NSPoint
)point
;
141 - (id
)moxFocusedUIElement
;
143 - (id
<MOXTextMarkerSupport
>)moxTextMarkerDelegate
;
145 - (BOOL
)moxIsLiveRegion
;
150 - (id
<mozAccessible
>)moxParent
;
153 - (NSArray
*)moxChildren
;
159 - (NSValue
*)moxPosition
;
162 - (NSString
*)moxRole
;
165 - (NSString
*)moxSubrole
;
168 - (NSString
*)moxRoleDescription
;
171 - (NSWindow
*)moxWindow
;
177 - (NSString
*)moxTitle
;
180 - (NSString
*)moxLabel
;
183 - (NSString
*)moxHelp
;
186 - (NSNumber
*)moxEnabled
;
189 - (NSNumber
*)moxFocused
;
192 - (NSNumber
*)moxSelected
;
195 - (NSNumber
*)moxExpanded
;
198 - (NSValue
*)moxFrame
;
201 - (NSString
*)moxARIACurrent
;
204 - (NSNumber
*)moxARIAAtomic
;
207 - (NSString
*)moxARIALive
;
210 - (NSNumber
*)moxARIAPosInSet
;
213 - (NSNumber
*)moxARIASetSize
;
216 - (NSString
*)moxARIARelevant
;
219 - (NSString
*)moxPlaceholderValue
;
222 - (id
)moxTitleUIElement
;
225 - (NSString
*)moxDOMIdentifier
;
228 - (NSNumber
*)moxRequired
;
231 - (NSNumber
*)moxElementBusy
;
234 - (NSArray
*)moxLinkedUIElements
;
237 - (NSArray
*)moxARIAControls
;
240 - (id
)moxEditableAncestor
;
243 - (id
)moxHighestEditableAncestor
;
246 - (id
)moxFocusableAncestor
;
249 - (NSString
*)moxLanguage
;
251 #ifndef RELEASE_OR_BETA
253 - (NSString
*)moxMozDebugDescription
;
257 - (NSArray
*)moxUIElementsForSearchPredicate
:(NSDictionary
*)searchPredicate
;
260 - (NSNumber
*)moxUIElementCountForSearchPredicate
:(NSDictionary
*)searchPredicate
;
263 - (void)moxSetFocused
:(NSNumber
*)focused
;
266 - (void)moxPerformScrollToVisible
;
269 - (void)moxPerformShowMenu
;
272 - (void)moxPerformPress
;
275 - (BOOL
)moxIgnoreWithParent
:(mozAccessible
*)parent
;
278 - (BOOL
)moxIgnoreChild
:(mozAccessible
*)child
;
282 // makes ourselves "expired". after this point, we might be around if someone
283 // has retained us (e.g., a third-party), but we really contain no information.