2011-04-27 17:42:27 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-05-28 02:37:24 +04:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-05-06 06:23:50 +04:00
|
|
|
|
|
|
|
#ifndef __NS_MAI_H__
|
|
|
|
#define __NS_MAI_H__
|
|
|
|
|
|
|
|
#include <atk/atk.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
2016-01-19 15:12:03 +03:00
|
|
|
#include "AccessibleOrProxy.h"
|
2012-05-29 05:18:45 +04:00
|
|
|
#include "AccessibleWrap.h"
|
2003-05-06 06:23:50 +04:00
|
|
|
|
2014-03-08 01:35:19 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
class ProxyAccessible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-06 06:23:50 +04:00
|
|
|
#define MAI_TYPE_ATK_OBJECT (mai_atk_object_get_type ())
|
|
|
|
#define MAI_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
|
|
|
MAI_TYPE_ATK_OBJECT, MaiAtkObject))
|
|
|
|
#define MAI_ATK_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
|
|
|
|
MAI_TYPE_ATK_OBJECT, \
|
|
|
|
MaiAtkObjectClass))
|
2006-08-30 09:19:06 +04:00
|
|
|
#define IS_MAI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
2003-05-06 06:23:50 +04:00
|
|
|
MAI_TYPE_ATK_OBJECT))
|
2006-08-30 09:19:06 +04:00
|
|
|
#define IS_MAI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
2003-05-06 06:23:50 +04:00
|
|
|
MAI_TYPE_ATK_OBJECT))
|
|
|
|
#define MAI_ATK_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
|
|
|
MAI_TYPE_ATK_OBJECT, \
|
|
|
|
MaiAtkObjectClass))
|
|
|
|
GType mai_atk_object_get_type(void);
|
2012-12-01 06:44:37 +04:00
|
|
|
GType mai_util_get_type();
|
2015-09-02 00:57:57 +03:00
|
|
|
extern "C" GType mai_atk_socket_get_type(void);
|
|
|
|
|
|
|
|
/* MaiAtkSocket */
|
|
|
|
|
|
|
|
#define MAI_TYPE_ATK_SOCKET (mai_atk_socket_get_type ())
|
|
|
|
#define MAI_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
|
|
|
|
MAI_TYPE_ATK_SOCKET, MaiAtkSocket))
|
|
|
|
#define MAI_IS_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
|
|
|
|
MAI_TYPE_ATK_SOCKET))
|
|
|
|
#define MAI_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
|
|
|
|
MAI_TYPE_ATK_SOCKET,\
|
|
|
|
MaiAtkSocketClass))
|
|
|
|
#define MAI_IS_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
|
|
|
|
MAI_TYPE_ATK_SOCKET))
|
|
|
|
#define MAI_ATK_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
|
|
|
|
MAI_TYPE_ATK_SOCKET,\
|
|
|
|
MaiAtkSocketClass))
|
|
|
|
|
|
|
|
typedef struct _MaiAtkSocket
|
|
|
|
{
|
|
|
|
AtkSocket parent;
|
|
|
|
|
|
|
|
mozilla::a11y::AccessibleWrap* accWrap;
|
|
|
|
} MaiAtkSocket;
|
|
|
|
|
|
|
|
typedef struct _MaiAtkSocketClass
|
|
|
|
{
|
|
|
|
AtkSocketClass parent_class;
|
|
|
|
} MaiAtkSocketClass;
|
|
|
|
|
2016-10-17 14:36:43 +03:00
|
|
|
// This is a pointer to the atk_table_cell_get_type function if we are using
|
|
|
|
// a version of atk that defines that.
|
|
|
|
extern "C" GType (*gAtkTableCellGetTypeFunc)();
|
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
|
2014-03-08 01:35:19 +04:00
|
|
|
mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
|
2016-01-22 13:49:30 +03:00
|
|
|
mozilla::a11y::AccessibleOrProxy GetInternalObj(AtkObject* aObj);
|
2014-09-23 16:00:15 +04:00
|
|
|
AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
|
2016-03-22 21:53:33 +03:00
|
|
|
AtkObject* GetWrapperFor(mozilla::a11y::AccessibleOrProxy aObj);
|
2003-05-06 06:23:50 +04:00
|
|
|
|
2017-06-13 22:06:08 +03:00
|
|
|
extern int atkMajorVersion, atkMinorVersion, atkMicroVersion;
|
2014-02-05 01:29:12 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the loaded version of libatk-1.0.so is at least
|
2017-06-13 22:06:08 +03:00
|
|
|
* aMajor.aMinor.aMicro.
|
2014-02-05 01:29:12 +04:00
|
|
|
*/
|
|
|
|
static inline bool
|
2017-06-13 22:06:08 +03:00
|
|
|
IsAtkVersionAtLeast(int aMajor, int aMinor, int aMicro=0)
|
2014-02-05 01:29:12 +04:00
|
|
|
{
|
2014-02-12 19:07:48 +04:00
|
|
|
return aMajor < atkMajorVersion ||
|
2017-06-13 22:06:08 +03:00
|
|
|
(aMajor == atkMajorVersion &&
|
|
|
|
(aMinor < atkMinorVersion ||
|
|
|
|
(aMinor == atkMinorVersion && aMicro <= atkMicroVersion)));
|
2014-02-05 01:29:12 +04:00
|
|
|
}
|
|
|
|
|
2015-04-21 23:31:58 +03:00
|
|
|
// This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
|
|
|
|
// proxy.
|
|
|
|
static const uintptr_t IS_PROXY = 1;
|
|
|
|
|
2015-04-08 18:32:40 +03:00
|
|
|
/**
|
|
|
|
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
|
|
|
|
*/
|
|
|
|
struct MaiAtkObject
|
|
|
|
{
|
|
|
|
AtkObject parent;
|
|
|
|
/*
|
|
|
|
* The AccessibleWrap whose properties and features are exported
|
|
|
|
* via this object instance.
|
|
|
|
*/
|
2016-01-19 15:12:03 +03:00
|
|
|
mozilla::a11y::AccessibleOrProxy accWrap;
|
2015-04-08 18:32:40 +03:00
|
|
|
|
2015-04-17 22:21:36 +03:00
|
|
|
/*
|
|
|
|
* Get the AtkHyperlink for this atk object.
|
|
|
|
*/
|
|
|
|
AtkHyperlink* GetAtkHyperlink();
|
|
|
|
|
2015-04-08 18:32:40 +03:00
|
|
|
/*
|
|
|
|
* Shutdown this AtkObject.
|
|
|
|
*/
|
|
|
|
void Shutdown();
|
2015-05-13 17:35:34 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Notify atk of a state change on this AtkObject.
|
|
|
|
*/
|
|
|
|
void FireStateChangeEvent(uint64_t aState, bool aEnabled);
|
2015-06-05 21:42:27 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Notify ATK of a text change within this ATK object.
|
|
|
|
*/
|
|
|
|
void FireTextChangeEvent(const nsString& aStr, int32_t aStart, uint32_t aLen,
|
|
|
|
bool aIsInsert, bool aIsFromUser);
|
|
|
|
|
2016-04-06 03:18:30 +03:00
|
|
|
/**
|
|
|
|
* Notify ATK of a shown or hidden subtree rooted at aObject whose parent is
|
|
|
|
* aParent
|
|
|
|
*/
|
|
|
|
void FireAtkShowHideEvent(AtkObject* aParent, bool aIsAdded, bool aFromUser);
|
|
|
|
|
2015-06-05 21:42:27 +03:00
|
|
|
private:
|
|
|
|
/*
|
|
|
|
* do we have text-remove and text-insert signals if not we need to use
|
|
|
|
* text-changed see AccessibleWrap::FireAtkTextChangedEvent() and
|
|
|
|
* bug 619002
|
|
|
|
*/
|
|
|
|
enum EAvailableAtkSignals {
|
|
|
|
eUnknown,
|
|
|
|
eHaveNewAtkTextSignals,
|
|
|
|
eNoNewAtkSignals
|
|
|
|
};
|
|
|
|
|
|
|
|
static EAvailableAtkSignals gAvailableAtkSignals;
|
2015-04-08 18:32:40 +03:00
|
|
|
};
|
|
|
|
|
2003-05-06 06:23:50 +04:00
|
|
|
#endif /* __NS_MAI_H__ */
|