Bug 1735098 - Implement EpochTimeStamp from HR-Time r=edgar
[gecko.git] / accessible / mac / MOXAccessibleBase.h
blob751fa5f28df9b8d558f68595981a35970f53cbfa
1 /* clang-format off */
2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* clang-format on */
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 #import <Cocoa/Cocoa.h>
10 #import "mozAccessibleProtocol.h"
11 #import "MOXAccessibleProtocol.h"
13 #include "Platform.h"
15 inline id<mozAccessible> GetObjectOrRepresentedView(id<mozAccessible> aObject) {
16 if (!mozilla::a11y::ShouldA11yBeEnabled()) {
17 // If platform a11y is not enabled, don't return represented view.
18 // This is mostly for our mochitest environment because the represented
19 // ChildView checks `ShouldA11yBeEnabled` before proxying accessibility
20 // methods to mozAccessibles.
21 return aObject;
24 return [aObject hasRepresentedView] ? [aObject representedView] : aObject;
27 @interface MOXAccessibleBase : NSObject <mozAccessible, MOXAccessible> {
28 BOOL mIsExpired;
31 #pragma mark - mozAccessible/widget
33 // override
34 - (BOOL)hasRepresentedView;
36 // override
37 - (id)representedView;
39 // override
40 - (BOOL)isRoot;
42 #pragma mark - mozAccessible/NSAccessibility
44 // The methods below interface with the platform through NSAccessibility.
45 // They should not be called directly or overridden in subclasses.
47 // override, final
48 - (NSArray*)accessibilityAttributeNames;
50 // override, final
51 - (id)accessibilityAttributeValue:(NSString*)attribute;
53 // override, final
54 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute;
56 // override, final
57 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
59 // override, final
60 - (NSArray*)accessibilityActionNames;
62 // override, final
63 - (void)accessibilityPerformAction:(NSString*)action;
65 // override, final
66 - (NSString*)accessibilityActionDescription:(NSString*)action;
68 // override, final
69 - (NSArray*)accessibilityParameterizedAttributeNames;
71 // override, final
72 - (id)accessibilityAttributeValue:(NSString*)attribute
73 forParameter:(id)parameter;
75 // override, final
76 - (id)accessibilityHitTest:(NSPoint)point;
78 // override, final
79 - (id)accessibilityFocusedUIElement;
81 // override, final
82 - (BOOL)isAccessibilityElement;
84 // final
85 - (BOOL)accessibilityNotifiesWhenDestroyed;
87 #pragma mark - MOXAccessible protocol
89 // override
90 - (id)moxHitTest:(NSPoint)point;
92 // override
93 - (id)moxFocusedUIElement;
95 // override
96 - (void)moxPostNotification:(NSString*)notification;
98 // override
99 - (void)moxPostNotification:(NSString*)notification
100 withUserInfo:(NSDictionary*)userInfo;
102 // override
103 - (BOOL)moxBlockSelector:(SEL)selector;
105 // override
106 - (NSArray*)moxUnignoredChildren;
108 // override
109 - (NSArray*)moxChildren;
111 // override
112 - (id<mozAccessible>)moxUnignoredParent;
114 // override
115 - (id<mozAccessible>)moxParent;
117 // override
118 - (NSNumber*)moxIndexForChildUIElement:(id)child;
120 // override
121 - (id)moxTopLevelUIElement;
123 // override
124 - (id<MOXTextMarkerSupport>)moxTextMarkerDelegate;
126 // override
127 - (BOOL)moxIsLiveRegion;
129 // override
130 - (id<MOXAccessible>)moxFindAncestor:(BOOL (^)(id<MOXAccessible> moxAcc,
131 BOOL* stop))findBlock;
133 #pragma mark -
135 - (NSString*)description;
137 - (BOOL)isExpired;
139 // makes ourselves "expired". after this point, we might be around if someone
140 // has retained us (e.g., a third-party), but we really contain no information.
141 - (void)expire;
143 @end