accessible/src/mac/AccessibleWrap.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 /* For documentation of the accessibility architecture,
michael@0 7 * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
michael@0 8 */
michael@0 9
michael@0 10 #ifndef _AccessibleWrap_H_
michael@0 11 #define _AccessibleWrap_H_
michael@0 12
michael@0 13 #include <objc/objc.h>
michael@0 14
michael@0 15 #include "Accessible.h"
michael@0 16 #include "States.h"
michael@0 17
michael@0 18 #include "nsCOMPtr.h"
michael@0 19
michael@0 20 #include "nsTArray.h"
michael@0 21 #include "nsAutoPtr.h"
michael@0 22
michael@0 23 #if defined(__OBJC__)
michael@0 24 @class mozAccessible;
michael@0 25 #endif
michael@0 26
michael@0 27 namespace mozilla {
michael@0 28 namespace a11y {
michael@0 29
michael@0 30 class AccessibleWrap : public Accessible
michael@0 31 {
michael@0 32 public: // construction, destruction
michael@0 33 AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
michael@0 34 virtual ~AccessibleWrap();
michael@0 35
michael@0 36 /**
michael@0 37 * Get the native Obj-C object (mozAccessible).
michael@0 38 */
michael@0 39 NS_IMETHOD GetNativeInterface (void** aOutAccessible);
michael@0 40
michael@0 41 /**
michael@0 42 * The objective-c |Class| type that this accessible's native object
michael@0 43 * should be instantied with. used on runtime to determine the
michael@0 44 * right type for this accessible's associated native object.
michael@0 45 */
michael@0 46 virtual Class GetNativeType ();
michael@0 47
michael@0 48 virtual void Shutdown ();
michael@0 49 virtual void InvalidateChildren();
michael@0 50
michael@0 51 virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
michael@0 52 virtual bool RemoveChild(Accessible* aAccessible);
michael@0 53
michael@0 54 virtual nsresult HandleAccEvent(AccEvent* aEvent);
michael@0 55
michael@0 56 /**
michael@0 57 * Ignored means that the accessible might still have children, but is not
michael@0 58 * displayed to the user. it also has no native accessible object represented
michael@0 59 * for it.
michael@0 60 */
michael@0 61 bool IsIgnored();
michael@0 62
michael@0 63 inline bool HasPopup ()
michael@0 64 { return (NativeState() & mozilla::a11y::states::HASPOPUP); }
michael@0 65
michael@0 66 /**
michael@0 67 * Returns this accessible's all children, adhering to "flat" accessibles by
michael@0 68 * not returning their children.
michael@0 69 */
michael@0 70 void GetUnignoredChildren(nsTArray<Accessible*>* aChildrenArray);
michael@0 71 Accessible* GetUnignoredParent() const;
michael@0 72
michael@0 73 protected:
michael@0 74
michael@0 75 /**
michael@0 76 * Return true if the parent doesn't have children to expose to AT.
michael@0 77 */
michael@0 78 bool AncestorIsFlat();
michael@0 79
michael@0 80 /**
michael@0 81 * Get the native object. Create it if needed.
michael@0 82 */
michael@0 83 #if defined(__OBJC__)
michael@0 84 mozAccessible* GetNativeObject();
michael@0 85 #else
michael@0 86 id GetNativeObject();
michael@0 87 #endif
michael@0 88
michael@0 89 private:
michael@0 90
michael@0 91 /**
michael@0 92 * Our native object. Private because its creation is done lazily.
michael@0 93 * Don't access it directly. Ever. Unless you are GetNativeObject() or
michael@0 94 * Shutdown()
michael@0 95 */
michael@0 96 #if defined(__OBJC__)
michael@0 97 // if we are in Objective-C, we use the actual Obj-C class.
michael@0 98 mozAccessible* mNativeObject;
michael@0 99 #else
michael@0 100 id mNativeObject;
michael@0 101 #endif
michael@0 102
michael@0 103 /**
michael@0 104 * We have created our native. This does not mean there is one.
michael@0 105 * This can never go back to false.
michael@0 106 * We need it because checking whether we need a native object cost time.
michael@0 107 */
michael@0 108 bool mNativeInited;
michael@0 109 };
michael@0 110
michael@0 111 } // namespace a11y
michael@0 112 } // namespace mozilla
michael@0 113
michael@0 114 #endif

mercurial