accessible/src/mac/mozAccessible.h

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "AccessibleWrap.h"
michael@0 7
michael@0 8 #import <Cocoa/Cocoa.h>
michael@0 9
michael@0 10 #import "mozAccessibleProtocol.h"
michael@0 11
michael@0 12 @class mozRootAccessible;
michael@0 13
michael@0 14 /**
michael@0 15 * All mozAccessibles are either abstract objects (that correspond to XUL
michael@0 16 * widgets, HTML frames, etc) or are attached to a certain view; for example
michael@0 17 * a document view. When we hand an object off to an AT, we always want
michael@0 18 * to give it the represented view, in the latter case.
michael@0 19 */
michael@0 20 inline id <mozAccessible>
michael@0 21 GetObjectOrRepresentedView(id <mozAccessible> aObject)
michael@0 22 {
michael@0 23 return [aObject hasRepresentedView] ? [aObject representedView] : aObject;
michael@0 24 }
michael@0 25
michael@0 26 inline mozAccessible*
michael@0 27 GetNativeFromGeckoAccessible(nsIAccessible* aAccessible)
michael@0 28 {
michael@0 29 mozAccessible* native = nil;
michael@0 30 aAccessible->GetNativeInterface((void**)&native);
michael@0 31 return native;
michael@0 32 }
michael@0 33
michael@0 34 @interface mozAccessible : NSObject <mozAccessible>
michael@0 35 {
michael@0 36 /**
michael@0 37 * Weak reference; it owns us.
michael@0 38 */
michael@0 39 mozilla::a11y::AccessibleWrap* mGeckoAccessible;
michael@0 40
michael@0 41 /**
michael@0 42 * Strong ref to array of children
michael@0 43 */
michael@0 44 NSMutableArray* mChildren;
michael@0 45
michael@0 46 /**
michael@0 47 * Weak reference to the parent
michael@0 48 */
michael@0 49 mozAccessible* mParent;
michael@0 50
michael@0 51 /**
michael@0 52 * The nsIAccessible role of our gecko accessible.
michael@0 53 */
michael@0 54 mozilla::a11y::role mRole;
michael@0 55 }
michael@0 56
michael@0 57 // inits with the gecko owner.
michael@0 58 - (id)initWithAccessible:(mozilla::a11y::AccessibleWrap*)geckoParent;
michael@0 59
michael@0 60 // our accessible parent (AXParent)
michael@0 61 - (id <mozAccessible>)parent;
michael@0 62
michael@0 63 // a lazy cache of our accessible children (AXChildren). updated
michael@0 64 - (NSArray*)children;
michael@0 65
michael@0 66 // returns the size of this accessible.
michael@0 67 - (NSValue*)size;
michael@0 68
michael@0 69 // returns the position, in cocoa coordinates.
michael@0 70 - (NSValue*)position;
michael@0 71
michael@0 72 // can be overridden to report another role name.
michael@0 73 - (NSString*)role;
michael@0 74
michael@0 75 // a subrole is a more specialized variant of the role. for example,
michael@0 76 // the role might be "textfield", while the subrole is "password textfield".
michael@0 77 - (NSString*)subrole;
michael@0 78
michael@0 79 // Return the role description, as there are a few exceptions.
michael@0 80 - (NSString*)roleDescription;
michael@0 81
michael@0 82 // returns the native window we're inside.
michael@0 83 - (NSWindow*)window;
michael@0 84
michael@0 85 // the accessible description of this particular instance.
michael@0 86 - (NSString*)customDescription;
michael@0 87
michael@0 88 // the value of this element.
michael@0 89 - (id)value;
michael@0 90
michael@0 91 // name that is associated with this accessible (for buttons, etc)
michael@0 92 - (NSString*)title;
michael@0 93
michael@0 94 // help text associated with this element.
michael@0 95 - (NSString*)help;
michael@0 96
michael@0 97 - (BOOL)isEnabled;
michael@0 98
michael@0 99 // information about focus.
michael@0 100 - (BOOL)isFocused;
michael@0 101 - (BOOL)canBeFocused;
michael@0 102
michael@0 103 // returns NO if for some reason we were unable to focus the element.
michael@0 104 - (BOOL)focus;
michael@0 105
michael@0 106 // notifications sent out to listening accessible providers.
michael@0 107 - (void)didReceiveFocus;
michael@0 108 - (void)valueDidChange;
michael@0 109 - (void)selectedTextDidChange;
michael@0 110
michael@0 111 #pragma mark -
michael@0 112
michael@0 113 // invalidates and removes all our children from our cached array.
michael@0 114 - (void)invalidateChildren;
michael@0 115
michael@0 116 /**
michael@0 117 * Append a child if they are already cached.
michael@0 118 */
michael@0 119 - (void)appendChild:(mozilla::a11y::Accessible*)aAccessible;
michael@0 120
michael@0 121 // makes ourselves "expired". after this point, we might be around if someone
michael@0 122 // has retained us (e.g., a third-party), but we really contain no information.
michael@0 123 - (void)expire;
michael@0 124 - (BOOL)isExpired;
michael@0 125
michael@0 126 #ifdef DEBUG
michael@0 127 - (void)printHierarchy;
michael@0 128 - (void)printHierarchyWithLevel:(unsigned)numSpaces;
michael@0 129
michael@0 130 - (void)sanityCheckChildren;
michael@0 131 - (void)sanityCheckChildren:(NSArray*)theChildren;
michael@0 132 #endif
michael@0 133
michael@0 134 // ---- NSAccessibility methods ---- //
michael@0 135
michael@0 136 // whether to skip this element when traversing the accessibility
michael@0 137 // hierarchy.
michael@0 138 - (BOOL)accessibilityIsIgnored;
michael@0 139
michael@0 140 // called by third-parties to determine the deepest child element under the mouse
michael@0 141 - (id)accessibilityHitTest:(NSPoint)point;
michael@0 142
michael@0 143 // returns the deepest unignored focused accessible element
michael@0 144 - (id)accessibilityFocusedUIElement;
michael@0 145
michael@0 146 // a mozAccessible needs to at least provide links to its parent and
michael@0 147 // children.
michael@0 148 - (NSArray*)accessibilityAttributeNames;
michael@0 149
michael@0 150 // value for the specified attribute
michael@0 151 - (id)accessibilityAttributeValue:(NSString*)attribute;
michael@0 152
michael@0 153 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute;
michael@0 154 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
michael@0 155
michael@0 156 @end
michael@0 157

mercurial