michael@0: /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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: /* For documentation of the accessibility architecture, michael@0: * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html michael@0: */ michael@0: michael@0: #ifndef _AccessibleWrap_H_ michael@0: #define _AccessibleWrap_H_ michael@0: michael@0: #include michael@0: michael@0: #include "Accessible.h" michael@0: #include "States.h" michael@0: michael@0: #include "nsCOMPtr.h" michael@0: michael@0: #include "nsTArray.h" michael@0: #include "nsAutoPtr.h" michael@0: michael@0: #if defined(__OBJC__) michael@0: @class mozAccessible; michael@0: #endif michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: class AccessibleWrap : public Accessible michael@0: { michael@0: public: // construction, destruction michael@0: AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); michael@0: virtual ~AccessibleWrap(); michael@0: michael@0: /** michael@0: * Get the native Obj-C object (mozAccessible). michael@0: */ michael@0: NS_IMETHOD GetNativeInterface (void** aOutAccessible); michael@0: michael@0: /** michael@0: * The objective-c |Class| type that this accessible's native object michael@0: * should be instantied with. used on runtime to determine the michael@0: * right type for this accessible's associated native object. michael@0: */ michael@0: virtual Class GetNativeType (); michael@0: michael@0: virtual void Shutdown (); michael@0: virtual void InvalidateChildren(); michael@0: michael@0: virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE; michael@0: virtual bool RemoveChild(Accessible* aAccessible); michael@0: michael@0: virtual nsresult HandleAccEvent(AccEvent* aEvent); michael@0: michael@0: /** michael@0: * Ignored means that the accessible might still have children, but is not michael@0: * displayed to the user. it also has no native accessible object represented michael@0: * for it. michael@0: */ michael@0: bool IsIgnored(); michael@0: michael@0: inline bool HasPopup () michael@0: { return (NativeState() & mozilla::a11y::states::HASPOPUP); } michael@0: michael@0: /** michael@0: * Returns this accessible's all children, adhering to "flat" accessibles by michael@0: * not returning their children. michael@0: */ michael@0: void GetUnignoredChildren(nsTArray* aChildrenArray); michael@0: Accessible* GetUnignoredParent() const; michael@0: michael@0: protected: michael@0: michael@0: /** michael@0: * Return true if the parent doesn't have children to expose to AT. michael@0: */ michael@0: bool AncestorIsFlat(); michael@0: michael@0: /** michael@0: * Get the native object. Create it if needed. michael@0: */ michael@0: #if defined(__OBJC__) michael@0: mozAccessible* GetNativeObject(); michael@0: #else michael@0: id GetNativeObject(); michael@0: #endif michael@0: michael@0: private: michael@0: michael@0: /** michael@0: * Our native object. Private because its creation is done lazily. michael@0: * Don't access it directly. Ever. Unless you are GetNativeObject() or michael@0: * Shutdown() michael@0: */ michael@0: #if defined(__OBJC__) michael@0: // if we are in Objective-C, we use the actual Obj-C class. michael@0: mozAccessible* mNativeObject; michael@0: #else michael@0: id mNativeObject; michael@0: #endif michael@0: michael@0: /** michael@0: * We have created our native. This does not mean there is one. michael@0: * This can never go back to false. michael@0: * We need it because checking whether we need a native object cost time. michael@0: */ michael@0: bool mNativeInited; michael@0: }; michael@0: michael@0: } // namespace a11y michael@0: } // namespace mozilla michael@0: michael@0: #endif