Bug 1854550 - pt 10. Allow LOG() with zero extra arguments r=glandium
[gecko.git] / accessible / atk / nsMai.h
blob175a3c64ff799814f2160620d4495d59d68631f7
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 "AccessibleWrap.h"
16 namespace mozilla {
17 namespace a11y {
18 class RemoteAccessible;
19 class Accessible;
20 } // namespace a11y
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();
37 // This is a pointer to the atk_table_cell_get_type function if we are using
38 // a version of atk that defines that.
39 extern "C" GType (*gAtkTableCellGetTypeFunc)();
41 mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
42 mozilla::a11y::RemoteAccessible* GetProxy(AtkObject* aAtkObj);
43 mozilla::a11y::Accessible* GetInternalObj(AtkObject* aObj);
44 AtkObject* GetWrapperFor(mozilla::a11y::Accessible* acc);
46 extern int atkMajorVersion, atkMinorVersion, atkMicroVersion;
48 /**
49 * Return true if the loaded version of libatk-1.0.so is at least
50 * aMajor.aMinor.aMicro.
52 static inline bool IsAtkVersionAtLeast(int aMajor, int aMinor, int aMicro = 0) {
53 return aMajor < atkMajorVersion ||
54 (aMajor == atkMajorVersion &&
55 (aMinor < atkMinorVersion ||
56 (aMinor == atkMinorVersion && aMicro <= atkMicroVersion)));
59 /**
60 * This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
62 struct MaiAtkObject {
63 AtkObject parent;
65 * The AccessibleWrap whose properties and features are exported
66 * via this object instance.
68 mozilla::a11y::Accessible* acc;
71 * Get the AtkHyperlink for this atk object.
73 AtkHyperlink* GetAtkHyperlink();
76 * Shutdown this AtkObject.
78 void Shutdown();
81 * Notify atk of a state change on this AtkObject.
83 void FireStateChangeEvent(uint64_t aState, bool aEnabled);
86 * Notify ATK of a text change within this ATK object.
88 void FireTextChangeEvent(const nsAString& aStr, int32_t aStart, uint32_t aLen,
89 bool aIsInsert, bool aIsFromUser);
91 /**
92 * Notify ATK of a shown or hidden subtree rooted at aObject whose parent is
93 * aParent
95 void FireAtkShowHideEvent(AtkObject* aParent, bool aIsAdded, bool aFromUser);
97 private:
99 * do we have text-remove and text-insert signals if not we need to use
100 * text-changed see AccessibleWrap::FireAtkTextChangedEvent() and
101 * bug 619002
103 enum EAvailableAtkSignals {
104 eUnknown,
105 eHaveNewAtkTextSignals,
106 eNoNewAtkSignals
109 static EAvailableAtkSignals gAvailableAtkSignals;
112 #endif /* __NS_MAI_H__ */