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.

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

mercurial