michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __NS_ACCESSIBLE_WRAP_H__ michael@0: #define __NS_ACCESSIBLE_WRAP_H__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "Accessible.h" michael@0: michael@0: struct _AtkObject; michael@0: typedef struct _AtkObject AtkObject; michael@0: michael@0: enum AtkProperty { michael@0: PROP_0, // gobject convention michael@0: PROP_NAME, michael@0: PROP_DESCRIPTION, michael@0: PROP_PARENT, // ancestry has changed michael@0: PROP_ROLE, michael@0: PROP_LAYER, michael@0: PROP_MDI_ZORDER, michael@0: PROP_TABLE_CAPTION, michael@0: PROP_TABLE_COLUMN_DESCRIPTION, michael@0: PROP_TABLE_COLUMN_HEADER, michael@0: PROP_TABLE_ROW_DESCRIPTION, michael@0: PROP_TABLE_ROW_HEADER, michael@0: PROP_TABLE_SUMMARY, michael@0: PROP_LAST // gobject convention michael@0: }; michael@0: michael@0: struct AtkPropertyChange { michael@0: int32_t type; // property type as listed above michael@0: void *oldvalue; michael@0: void *newvalue; michael@0: }; michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: class MaiHyperlink; michael@0: michael@0: /** michael@0: * AccessibleWrap, and its descendents in atk directory provide the michael@0: * implementation of AtkObject. michael@0: */ michael@0: class AccessibleWrap : public Accessible michael@0: { michael@0: public: michael@0: AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); michael@0: virtual ~AccessibleWrap(); michael@0: void ShutdownAtkObject(); michael@0: michael@0: virtual void Shutdown(); michael@0: michael@0: // return the atk object for this AccessibleWrap michael@0: NS_IMETHOD GetNativeInterface(void **aOutAccessible); michael@0: virtual nsresult HandleAccEvent(AccEvent* aEvent); michael@0: michael@0: AtkObject * GetAtkObject(void); michael@0: static AtkObject * GetAtkObject(nsIAccessible * acc); michael@0: michael@0: bool IsValidObject(); michael@0: michael@0: // get/set the MaiHyperlink object for this AccessibleWrap michael@0: MaiHyperlink* GetMaiHyperlink(bool aCreate = true); michael@0: void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink); michael@0: michael@0: static const char * ReturnString(nsAString &aString) { michael@0: static nsCString returnedString; michael@0: returnedString = NS_ConvertUTF16toUTF8(aString); michael@0: return returnedString.get(); michael@0: } michael@0: michael@0: protected: michael@0: michael@0: nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject); michael@0: nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject); michael@0: nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject, michael@0: bool aIsAdded); michael@0: michael@0: AtkObject *mAtkObject; michael@0: michael@0: private: michael@0: michael@0: /* michael@0: * do we have text-remove and text-insert signals if not we need to use michael@0: * text-changed see AccessibleWrap::FireAtkTextChangedEvent() and michael@0: * bug 619002 michael@0: */ michael@0: enum EAvailableAtkSignals { michael@0: eUnknown, michael@0: eHaveNewAtkTextSignals, michael@0: eNoNewAtkSignals michael@0: }; michael@0: michael@0: static EAvailableAtkSignals gAvailableAtkSignals; michael@0: michael@0: uint16_t CreateMaiInterfaces(void); michael@0: }; michael@0: michael@0: } // namespace a11y michael@0: } // namespace mozilla michael@0: michael@0: #endif /* __NS_ACCESSIBLE_WRAP_H__ */