Bug 1468398: Enable keep-alive connections in wdclient for wdspec tests. r=whimboo
[gecko.git] / accessible / mac / AccessibleWrap.h
blob6c746ff0dccf622d0f6e77707edada3126f3e11a
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"
22 #if defined(__OBJC__)
23 @class mozAccessible;
24 #endif
26 namespace mozilla {
27 namespace a11y {
29 class AccessibleWrap : public Accessible
31 public: // construction, destruction
32 AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
33 virtual ~AccessibleWrap();
35 /**
36 * Get the native Obj-C object (mozAccessible).
38 virtual void GetNativeInterface(void** aOutAccessible) override;
40 /**
41 * The objective-c |Class| type that this accessible's native object
42 * should be instantied with. used on runtime to determine the
43 * right type for this accessible's associated native object.
45 virtual Class GetNativeType ();
47 virtual void Shutdown () override;
49 virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) override;
50 virtual bool RemoveChild(Accessible* aAccessible) override;
52 virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
54 protected:
56 /**
57 * Return true if the parent doesn't have children to expose to AT.
59 bool AncestorIsFlat();
61 /**
62 * Get the native object. Create it if needed.
64 #if defined(__OBJC__)
65 mozAccessible* GetNativeObject();
66 #else
67 id GetNativeObject();
68 #endif
70 private:
72 /**
73 * Our native object. Private because its creation is done lazily.
74 * Don't access it directly. Ever. Unless you are GetNativeObject() or
75 * Shutdown()
77 #if defined(__OBJC__)
78 // if we are in Objective-C, we use the actual Obj-C class.
79 mozAccessible* mNativeObject;
80 #else
81 id mNativeObject;
82 #endif
84 /**
85 * We have created our native. This does not mean there is one.
86 * This can never go back to false.
87 * We need it because checking whether we need a native object cost time.
89 bool mNativeInited;
92 #if defined(__OBJC__)
93 void FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType);
94 #else
95 void FireNativeEvent(id aNativeAcc, uint32_t aEventType);
96 #endif
98 Class GetTypeFromRole(roles::Role aRole);
100 } // namespace a11y
101 } // namespace mozilla
103 #endif