Bug 1700051: part 36) Reduce accessibility of `SoftText::mBegin` to `private`. r...
[gecko.git] / accessible / atk / nsMai.h
blob9053febdf25ad9ead268554619aaa8e8d94f0a03
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __NS_MAI_H__
8 #define __NS_MAI_H__
10 #include <atk/atk.h>
11 #include <glib.h>
12 #include <glib-object.h>
14 #include "AccessibleOrProxy.h"
15 #include "AccessibleWrap.h"
17 namespace mozilla {
18 namespace a11y {
19 class RemoteAccessible;
21 } // namespace mozilla
23 #define MAI_TYPE_ATK_OBJECT (mai_atk_object_get_type())
24 #define MAI_ATK_OBJECT(obj) \
25 (G_TYPE_CHECK_INSTANCE_CAST((obj), MAI_TYPE_ATK_OBJECT, MaiAtkObject))
26 #define MAI_ATK_OBJECT_CLASS(klass) \
27 (G_TYPE_CHECK_CLASS_CAST((klass), MAI_TYPE_ATK_OBJECT, MaiAtkObjectClass))
28 #define IS_MAI_OBJECT(obj) \
29 (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAI_TYPE_ATK_OBJECT))
30 #define IS_MAI_OBJECT_CLASS(klass) \
31 (G_TYPE_CHECK_CLASS_TYPE((klass), MAI_TYPE_ATK_OBJECT))
32 #define MAI_ATK_OBJECT_GET_CLASS(obj) \
33 (G_TYPE_INSTANCE_GET_CLASS((obj), MAI_TYPE_ATK_OBJECT, MaiAtkObjectClass))
34 GType mai_atk_object_get_type(void);
35 GType mai_util_get_type();
36 extern "C" GType mai_atk_socket_get_type(void);
38 /* MaiAtkSocket */
40 #define MAI_TYPE_ATK_SOCKET (mai_atk_socket_get_type())
41 #define MAI_ATK_SOCKET(obj) \
42 (G_TYPE_CHECK_INSTANCE_CAST((obj), MAI_TYPE_ATK_SOCKET, MaiAtkSocket))
43 #define MAI_IS_ATK_SOCKET(obj) \
44 (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAI_TYPE_ATK_SOCKET))
45 #define MAI_ATK_SOCKET_CLASS(klass) \
46 (G_TYPE_CHECK_CLASS_CAST((klass), MAI_TYPE_ATK_SOCKET, MaiAtkSocketClass))
47 #define MAI_IS_ATK_SOCKET_CLASS(klass) \
48 (G_TYPE_CHECK_CLASS_TYPE((klass), MAI_TYPE_ATK_SOCKET))
49 #define MAI_ATK_SOCKET_GET_CLASS(obj) \
50 (G_TYPE_INSTANCE_GET_CLASS((obj), MAI_TYPE_ATK_SOCKET, MaiAtkSocketClass))
52 typedef struct _MaiAtkSocket {
53 AtkSocket parent;
55 mozilla::a11y::AccessibleWrap* accWrap;
56 } MaiAtkSocket;
58 typedef struct _MaiAtkSocketClass {
59 AtkSocketClass parent_class;
60 } MaiAtkSocketClass;
62 // This is a pointer to the atk_table_cell_get_type function if we are using
63 // a version of atk that defines that.
64 extern "C" GType (*gAtkTableCellGetTypeFunc)();
66 mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
67 mozilla::a11y::RemoteAccessible* GetProxy(AtkObject* aAtkObj);
68 mozilla::a11y::AccessibleOrProxy GetInternalObj(AtkObject* aObj);
69 AtkObject* GetWrapperFor(mozilla::a11y::RemoteAccessible* aProxy);
70 AtkObject* GetWrapperFor(mozilla::a11y::AccessibleOrProxy aObj);
72 extern int atkMajorVersion, atkMinorVersion, atkMicroVersion;
74 /**
75 * Return true if the loaded version of libatk-1.0.so is at least
76 * aMajor.aMinor.aMicro.
78 static inline bool IsAtkVersionAtLeast(int aMajor, int aMinor, int aMicro = 0) {
79 return aMajor < atkMajorVersion ||
80 (aMajor == atkMajorVersion &&
81 (aMinor < atkMinorVersion ||
82 (aMinor == atkMinorVersion && aMicro <= atkMicroVersion)));
85 // This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
86 // proxy.
87 static const uintptr_t IS_PROXY = 1;
89 /**
90 * This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
92 struct MaiAtkObject {
93 AtkObject parent;
95 * The AccessibleWrap whose properties and features are exported
96 * via this object instance.
98 mozilla::a11y::AccessibleOrProxy accWrap;
101 * Get the AtkHyperlink for this atk object.
103 AtkHyperlink* GetAtkHyperlink();
106 * Shutdown this AtkObject.
108 void Shutdown();
111 * Notify atk of a state change on this AtkObject.
113 void FireStateChangeEvent(uint64_t aState, bool aEnabled);
116 * Notify ATK of a text change within this ATK object.
118 void FireTextChangeEvent(const nsString& aStr, int32_t aStart, uint32_t aLen,
119 bool aIsInsert, bool aIsFromUser);
122 * Notify ATK of a shown or hidden subtree rooted at aObject whose parent is
123 * aParent
125 void FireAtkShowHideEvent(AtkObject* aParent, bool aIsAdded, bool aFromUser);
127 private:
129 * do we have text-remove and text-insert signals if not we need to use
130 * text-changed see AccessibleWrap::FireAtkTextChangedEvent() and
131 * bug 619002
133 enum EAvailableAtkSignals {
134 eUnknown,
135 eHaveNewAtkTextSignals,
136 eNoNewAtkSignals
139 static EAvailableAtkSignals gAvailableAtkSignals;
142 #endif /* __NS_MAI_H__ */