2011-04-27 06:42:27 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-05-27 15:37:24 -07:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef __NS_MAI_H__
|
|
|
|
#define __NS_MAI_H__
|
|
|
|
|
|
|
|
#include <atk/atk.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
#include "AccessibleWrap.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
class ProxyAccessible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07: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))
|
|
|
|
#define IS_MAI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
|
|
|
MAI_TYPE_ATK_OBJECT))
|
|
|
|
#define IS_MAI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
|
|
|
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-11-30 18:44:37 -08:00
|
|
|
GType mai_util_get_type();
|
2015-09-01 14:57:57 -07: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;
|
|
|
|
|
2012-11-17 18:01:44 -08:00
|
|
|
mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
|
2014-03-07 13:35:19 -08:00
|
|
|
mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
|
2014-09-23 05:00:15 -07:00
|
|
|
AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-02-04 13:29:12 -08:00
|
|
|
extern int atkMajorVersion, atkMinorVersion;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the loaded version of libatk-1.0.so is at least
|
|
|
|
* aMajor.aMinor.0.
|
|
|
|
*/
|
|
|
|
static inline bool
|
|
|
|
IsAtkVersionAtLeast(int aMajor, int aMinor)
|
|
|
|
{
|
2014-02-12 07:07:48 -08:00
|
|
|
return aMajor < atkMajorVersion ||
|
|
|
|
(aMajor == atkMajorVersion && aMinor <= atkMinorVersion);
|
2014-02-04 13:29:12 -08:00
|
|
|
}
|
|
|
|
|
2015-04-21 13:31:58 -07: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 08:32:40 -07: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.
|
|
|
|
*/
|
|
|
|
uintptr_t accWrap;
|
|
|
|
|
2015-04-17 12:21:36 -07:00
|
|
|
/*
|
|
|
|
* Get the AtkHyperlink for this atk object.
|
|
|
|
*/
|
|
|
|
AtkHyperlink* GetAtkHyperlink();
|
|
|
|
|
2015-04-08 08:32:40 -07:00
|
|
|
/*
|
|
|
|
* Shutdown this AtkObject.
|
|
|
|
*/
|
|
|
|
void Shutdown();
|
2015-05-13 07:35:34 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Notify atk of a state change on this AtkObject.
|
|
|
|
*/
|
|
|
|
void FireStateChangeEvent(uint64_t aState, bool aEnabled);
|
2015-06-05 11:42:27 -07: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);
|
|
|
|
|
|
|
|
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 08:32:40 -07:00
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif /* __NS_MAI_H__ */
|