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