Bug 1648429 [wpt PR 24338] - Python 3: port tests in service-workers [part 5], a...
[gecko.git] / accessible / mac / AccessibleWrap.h
blob463aa87304b7a781c430e5ae0ec8f4dc8e3a4503
1 /* clang-format off */
2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* clang-format on */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 /* For documentation of the accessibility architecture,
9 * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
12 #ifndef _AccessibleWrap_H_
13 #define _AccessibleWrap_H_
15 #include <objc/objc.h>
17 #include "Accessible.h"
18 #include "States.h"
20 #include "nsCOMPtr.h"
22 #include "nsTArray.h"
24 #if defined(__OBJC__)
25 @class mozAccessible;
26 #endif
28 namespace mozilla {
29 namespace a11y {
31 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 virtual void GetNativeInterface(void** aOutAccessible) override;
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() override;
50 virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
52 protected:
53 friend class xpcAccessibleMacInterface;
55 /**
56 * Get the native object. Create it if needed.
58 #if defined(__OBJC__)
59 mozAccessible* GetNativeObject();
60 #else
61 id GetNativeObject();
62 #endif
64 private:
65 /**
66 * Our native object. Private because its creation is done lazily.
67 * Don't access it directly. Ever. Unless you are GetNativeObject() or
68 * Shutdown()
70 #if defined(__OBJC__)
71 // if we are in Objective-C, we use the actual Obj-C class.
72 mozAccessible* mNativeObject;
73 #else
74 id mNativeObject;
75 #endif
77 /**
78 * We have created our native. This does not mean there is one.
79 * This can never go back to false.
80 * We need it because checking whether we need a native object cost time.
82 bool mNativeInited;
85 Class GetTypeFromRole(roles::Role aRole);
87 } // namespace a11y
88 } // namespace mozilla
90 #endif