Bug 1734067 [wpt PR 31108] - Update wpt metadata, a=testonly
[gecko.git] / accessible / mac / AccessibleWrap.h
blob33e280d35a705bb2ae86c71d013b1a34c8a5447c
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 "LocalAccessible.h"
18 #include "PlatformExtTypes.h"
19 #include "States.h"
21 #include "nsCOMPtr.h"
23 #include "nsTArray.h"
25 #if defined(__OBJC__)
26 @class mozAccessible;
27 #endif
29 namespace mozilla {
30 namespace a11y {
32 class AccessibleWrap : public LocalAccessible {
33 public: // construction, destruction
34 AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
35 virtual ~AccessibleWrap();
37 /**
38 * Get the native Obj-C object (mozAccessible).
40 virtual void GetNativeInterface(void** aOutAccessible) override;
42 /**
43 * The objective-c |Class| type that this accessible's native object
44 * should be instantied with. used on runtime to determine the
45 * right type for this accessible's associated native object.
47 virtual Class GetNativeType();
49 virtual void Shutdown() override;
51 virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
53 bool ApplyPostFilter(const EWhichPostFilter& aSearchKey,
54 const nsString& aSearchText);
56 protected:
57 friend class xpcAccessibleMacInterface;
59 /**
60 * Get the native object. Create it if needed.
62 #if defined(__OBJC__)
63 mozAccessible* GetNativeObject();
64 #else
65 id GetNativeObject();
66 #endif
68 private:
69 /**
70 * Our native object. Private because its creation is done lazily.
71 * Don't access it directly. Ever. Unless you are GetNativeObject() or
72 * Shutdown()
74 #if defined(__OBJC__)
75 // if we are in Objective-C, we use the actual Obj-C class.
76 mozAccessible* mNativeObject;
77 #else
78 id mNativeObject;
79 #endif
81 /**
82 * We have created our native. This does not mean there is one.
83 * This can never go back to false.
84 * We need it because checking whether we need a native object cost time.
86 bool mNativeInited;
89 Class GetTypeFromRole(roles::Role aRole);
91 } // namespace a11y
92 } // namespace mozilla
94 #endif