no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / accessible / mac / AccessibleWrap.h
blobeb78b9417f7aef818d7a91b4a88b6c44d3b7febe
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 /**
33 * Mac specific functionality for an accessibility tree node that originated in
34 * mDoc's content process.
36 class AccessibleWrap : public LocalAccessible {
37 public: // construction, destruction
38 AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
39 virtual ~AccessibleWrap();
41 /**
42 * Get the native Obj-C object (mozAccessible).
44 virtual void GetNativeInterface(void** aOutAccessible) override;
46 /**
47 * The objective-c |Class| type that this accessible's native object
48 * should be instantied with. used on runtime to determine the
49 * right type for this accessible's associated native object.
51 virtual Class GetNativeType();
53 virtual void Shutdown() override;
55 virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
57 protected:
58 friend class xpcAccessibleMacInterface;
60 /**
61 * Get the native object. Create it if needed.
63 #if defined(__OBJC__)
64 mozAccessible* GetNativeObject();
65 #else
66 id GetNativeObject();
67 #endif
69 private:
70 /**
71 * Our native object. Private because its creation is done lazily.
72 * Don't access it directly. Ever. Unless you are GetNativeObject() or
73 * Shutdown()
75 #if defined(__OBJC__)
76 // if we are in Objective-C, we use the actual Obj-C class.
77 mozAccessible* mNativeObject;
78 #else
79 id mNativeObject;
80 #endif
82 /**
83 * We have created our native. This does not mean there is one.
84 * This can never go back to false.
85 * We need it because checking whether we need a native object cost time.
87 bool mNativeInited;
90 Class GetTypeFromRole(roles::Role aRole);
92 } // namespace a11y
93 } // namespace mozilla
95 #endif