Index: trunk/include/qaccessible.h
===================================================================
--- trunk/include/qaccessible.h	(revision 131)
+++ trunk/include/qaccessible.h	(revision 131)
@@ -0,0 +1,292 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QAccessible and QAccessibleObject classes
+**
+** Copyright (C) 2000-2001 Trolltech AS.  All rights reserved.
+**
+** This file is part of the kernel module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QACCESSIBLE_H
+#define QACCESSIBLE_H
+
+#ifndef QT_H
+#include "qobject.h"
+#include <private/qcom_p.h>
+#include "qrect.h"
+#include "qguardedptr.h"
+#include "qmemarray.h"
+#endif // QT_H
+
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+
+struct QAccessibleInterface;
+
+class Q_EXPORT QAccessible
+{
+private:
+#ifdef Q_WS_MAC
+    static QMAC_PASCAL OSStatus globalEventProcessor(EventHandlerCallRef,  EventRef, void *);
+    static QObject *queryAccessibleObject(QAccessibleInterface *);
+#endif
+public:
+    enum Event {
+	SoundPlayed	    = 0x0001,
+	Alert		    = 0x0002,
+	ForegroundChanged   = 0x0003,
+	MenuStart	    = 0x0004,
+	MenuEnd		    = 0x0005,
+	PopupMenuStart	    = 0x0006,
+	PopupMenuEnd	    = 0x0007,
+	ContextHelpStart    = 0x000C,
+	ContextHelpEnd	    = 0x000D,
+	DragDropStart	    = 0x000E,
+	DragDropEnd	    = 0x000F,
+	DialogStart	    = 0x0010,
+	DialogEnd	    = 0x0011,
+	ScrollingStart	    = 0x0012,
+	ScrollingEnd	    = 0x0013,
+
+	MenuCommand	    = 0x0018,
+
+	ObjectCreated	    = 0x8000,
+	ObjectDestroyed	    = 0x8001,
+	ObjectShow	    = 0x8002,
+	ObjectHide	    = 0x8003,
+	ObjectReorder	    = 0x8004,
+	Focus		    = 0x8005,
+	Selection	    = 0x8006,
+	SelectionAdd	    = 0x8007,
+	SelectionRemove	    = 0x8008,
+	SelectionWithin	    = 0x8009,
+	StateChanged	    = 0x800A,
+	LocationChanged	    = 0x800B,
+	NameChanged	    = 0x800C,
+	DescriptionChanged  = 0x800D,
+	ValueChanged	    = 0x800E,
+	ParentChanged	    = 0x800F,
+	HelpChanged	    = 0x80A0,
+	DefaultActionChanged= 0x80B0,
+	AcceleratorChanged  = 0x80C0
+    };
+
+    enum State {
+	Normal		= 0x00000000,
+	Unavailable	= 0x00000001,
+	Selected	= 0x00000002,
+	Focused		= 0x00000004,
+	Pressed		= 0x00000008,
+	Checked		= 0x00000010,
+	Mixed		= 0x00000020,
+	ReadOnly	= 0x00000040,
+	HotTracked	= 0x00000080,
+	Default		= 0x00000100,
+	Expanded	= 0x00000200,
+	Collapsed	= 0x00000400,
+	Busy		= 0x00000800,
+	Floating	= 0x00001000,
+	Marqueed	= 0x00002000,
+	Animated	= 0x00004000,
+	Invisible	= 0x00008000,
+	Offscreen	= 0x00010000,
+	Sizeable	= 0x00020000,
+	Moveable	= 0x00040000,
+	SelfVoicing	= 0x00080000,
+	Focusable	= 0x00100000,
+	Selectable	= 0x00200000,
+	Linked		= 0x00400000,
+	Traversed	= 0x00800000,
+	MultiSelectable	= 0x01000000,
+	ExtSelectable	= 0x02000000,
+	AlertLow	= 0x04000000,
+	AlertMedium	= 0x08000000,
+	AlertHigh	= 0x10000000,
+	Protected	= 0x20000000,
+	Valid		= 0x3fffffff
+    };
+
+    enum Role {
+	NoRole		= 0x00000000,
+	TitleBar	= 0x00000001,
+	MenuBar		= 0x00000002,
+	ScrollBar	= 0x00000003,
+	Grip		= 0x00000004,
+	Sound		= 0x00000005,
+	Cursor		= 0x00000006,
+	Caret		= 0x00000007,
+	AlertMessage	= 0x00000008,
+	Window		= 0x00000009,
+	Client		= 0x0000000A,
+	PopupMenu	= 0x0000000B,
+	MenuItem	= 0x0000000C,
+	ToolTip		= 0x0000000D,
+	Application	= 0x0000000E,
+	Document	= 0x0000000F,
+	Pane		= 0x00000010,
+	Chart		= 0x00000011,
+	Dialog		= 0x00000012,
+	Border		= 0x00000013,
+	Grouping	= 0x00000014,
+	Separator	= 0x00000015,
+	ToolBar		= 0x00000016,
+	StatusBar	= 0x00000017,
+	Table		= 0x00000018,
+	ColumnHeader	= 0x00000019,
+	RowHeader	= 0x0000001A,
+	Column		= 0x0000001B,
+	Row		= 0x0000001C,
+	Cell		= 0x0000001D,
+	Link		= 0x0000001E,
+	HelpBalloon	= 0x0000001F,
+	Character	= 0x00000020,
+	List		= 0x00000021,
+	ListItem	= 0x00000022,
+	Outline		= 0x00000023,
+	OutlineItem	= 0x00000024,
+	PageTab		= 0x00000025,
+	PropertyPage	= 0x00000026,
+	Indicator	= 0x00000027,
+	Graphic		= 0x00000028,
+	StaticText	= 0x00000029,
+	EditableText	= 0x0000002A,  // Editable, selectable, etc.
+	PushButton	= 0x0000002B,
+	CheckBox	= 0x0000002C,
+	RadioButton	= 0x0000002D,
+	ComboBox	= 0x0000002E,
+	DropLest	= 0x0000002F,
+	ProgressBar	= 0x00000030,
+	Dial		= 0x00000031,
+	HotkeyField	= 0x00000032,
+	Slider		= 0x00000033,
+	SpinBox		= 0x00000034,
+	Diagram		= 0x00000035,
+	Animation	= 0x00000036,
+	Equation	= 0x00000037,
+	ButtonDropDown	= 0x00000038,
+	ButtonMenu	= 0x00000039,
+	ButtonDropGrid	= 0x0000003A,
+	Whitespace	= 0x0000003B,
+	PageTabList	= 0x0000003C,
+	Clock		= 0x0000003D
+    };
+
+    enum NavDirection {
+	NavUp		= 0x00000001,
+	NavDown		= 0x00000002,
+	NavLeft		= 0x00000003,
+	NavRight	= 0x00000004,
+	NavNext		= 0x00000005,
+	NavPrevious	= 0x00000006,
+	NavFirstChild	= 0x00000007,
+	NavLastChild	= 0x00000008,
+	NavFocusChild	= 0x00000009
+    };
+
+    enum Text {
+	Name		= 0,
+	Description,
+	Value,
+	Help,
+	Accelerator,
+	DefaultAction
+    };
+
+    static QRESULT queryAccessibleInterface( QObject *, QAccessibleInterface ** );
+    static void updateAccessibility( QObject *, int who, Event reason );
+    static bool isActive();
+
+    static void initialize();
+    static void cleanup();
+};
+
+// {EC86CB9C-5DA0-4c43-A739-13EBDF1C6B14}
+#define IID_QAccessible QUuid( 0xec86cb9c, 0x5da0, 0x4c43, 0xa7, 0x39, 0x13, 0xeb, 0xdf, 0x1c, 0x6b, 0x14 )
+
+struct Q_EXPORT QAccessibleInterface : public QAccessible, public QUnknownInterface
+{
+    // check for valid pointers
+    virtual bool	isValid() const = 0;
+
+    // hierarchy
+    virtual int		childCount() const = 0;
+    virtual QRESULT	queryChild( int control, QAccessibleInterface** ) const = 0;
+    virtual QRESULT	queryParent( QAccessibleInterface** ) const = 0;
+
+    // navigation
+    virtual int		controlAt( int x, int y ) const = 0;
+    virtual QRect	rect( int control ) const = 0;
+    virtual int		navigate( NavDirection direction, int startControl ) const = 0;
+
+    // properties and state
+    virtual QString	text( Text t, int control ) const = 0;
+    virtual void	setText( Text t, int control, const QString &text ) = 0;
+    virtual Role	role( int control ) const = 0;
+    virtual State	state( int control ) const = 0;
+    virtual QMemArray<int> selection() const = 0;
+
+    // methods
+    virtual bool	doDefaultAction( int control ) = 0;
+    virtual bool	setFocus( int control ) = 0;
+    virtual bool	setSelected( int control, bool on, bool extend ) = 0;
+    virtual void	clearSelection() = 0;    
+};
+
+// {49F4C6A7-412F-41DE-9E24-648843421FD3} 
+#ifndef IID_QAccessibleFactory
+#define IID_QAccessibleFactory QUuid( 0x49f4c6a7, 0x412f, 0x41de, 0x9e, 0x24, 0x64, 0x88, 0x43, 0x42, 0x1f, 0xd3 )
+#endif
+
+struct Q_EXPORT QAccessibleFactoryInterface : public QAccessible, public QFeatureListInterface
+{
+    virtual QRESULT createAccessibleInterface( const QString &, QObject *, QAccessibleInterface** ) = 0;
+};
+
+class Q_EXPORT QAccessibleObject : public QObject, public QAccessibleInterface
+{
+public:
+    QAccessibleObject( QObject *object );
+    virtual ~QAccessibleObject();
+
+    QRESULT	queryInterface( const QUuid &, QUnknownInterface** );
+    Q_REFCOUNT
+
+    bool	isValid() const;
+
+protected:
+    QObject *object() const;
+
+private:
+    QGuardedPtr<QObject> object_;
+};
+
+#define Q_DEFINED_QACCESSIBLE_OBJECT
+#include "qwinexport.h"
+#endif //QT_ACCESSIBILITY_SUPPORT
+
+#endif //QACCESSIBLE_H
Index: trunk/src/kernel/qaccessible.cpp
===================================================================
--- trunk/src/kernel/qaccessible.cpp	(revision 131)
+++ trunk/src/kernel/qaccessible.cpp	(revision 131)
@@ -0,0 +1,681 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of QAccessible and QAccessibleObject classes
+**
+** Copyright (C) 2000-2001 Trolltech AS.  All rights reserved.
+**
+** This file is part of the kernel module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "qaccessible.h"
+
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+
+#include "qptrdict.h"
+#include "qmetaobject.h"
+#include <private/qpluginmanager_p.h>
+#include "qapplication.h"
+#include <stdlib.h>
+
+/*!
+    \class QAccessible qaccessible.h
+    \brief The QAccessible class provides enums and static functions
+    relating to accessibility.
+
+    \ingroup misc
+
+    Accessibility clients use implementations of the
+    QAccessibleInterface to read the information an accessible object
+    exposes, or to call functions to manipulate the accessible object.
+
+\omit
+    Qt provides implementations of the QAccessibleInterface for most
+    widget classes in a plugin. This plugin is located in the \e
+    accessibility subdirectory of the plugins installation directory.
+    The default installation directory for plugins is \c INSTALL/plugins,
+    where \c INSTALL is the directory where Qt was installed.  Calling
+    queryAccessibleInterface( QObject *object, QAccessibleInterface
+    **iface ) will ask all plugins located in this directory for an
+    implementation that exposes the information for objects of the
+    class of \e object.
+
+    To make a Qt application accessible you have to distribute the
+    accessibility plugin provded with Qt together with your
+    application. Simply add the plugins created in
+    INSTALL/plugins/accessibility to your distribution process. Use \l
+    QApplication::addLibraryPath() to specify a plugin directory for
+    your application, and copy the files into an \e accessibility
+    subdirectory of one of those plugin directories. Qt's
+    accessibility framework will load the plugins upon request and use
+    the implementations provided to expose an object's accessibility
+    information.
+\endomit
+
+    See the \link plugins-howto.html plugin documentation \endlink for
+    more details about how to redistribute Qt plugins.
+*/
+
+/*!
+    \enum QAccessible::State
+
+    This enum type defines bitflags that can be combined to indicate
+    the state of the accessible object. The values are:
+
+    \value Normal
+    \value Unavailable
+    \value Selected
+    \value Focused
+    \value Pressed
+    \value Checked
+    \value Mixed
+    \value ReadOnly
+    \value HotTracked
+    \value Default
+    \value Expanded
+    \value Collapsed
+    \value Busy
+    \value Floating
+    \value Marqueed
+    \value Animated
+    \value Invisible
+    \value Offscreen
+    \value Sizeable
+    \value Moveable
+    \value SelfVoicing
+    \value Focusable
+    \value Selectable
+    \value Linked
+    \value Traversed
+    \value MultiSelectable
+    \value ExtSelectable
+    \value AlertLow
+    \value AlertMedium
+    \value AlertHigh
+    \value Protected
+    \value Valid
+*/
+
+/*!
+    \enum QAccessible::Event
+
+    This enum type defines event types when the state of the
+    accessible object has changed. The event types are:
+
+    \value SoundPlayed
+    \value Alert
+    \value ForegroundChanged
+    \value MenuStart
+    \value MenuEnd
+    \value PopupMenuStart
+    \value PopupMenuEnd
+    \value ContextHelpStart
+    \value ContextHelpEnd
+    \value DragDropStart
+    \value DragDropEnd
+    \value DialogStart
+    \value DialogEnd
+    \value ScrollingStart
+    \value ScrollingEnd
+    \value ObjectCreated
+    \value ObjectDestroyed
+    \value ObjectShow
+    \value ObjectHide
+    \value ObjectReorder
+    \value Focus
+    \value Selection
+    \value SelectionAdd
+    \value SelectionRemove
+    \value SelectionWithin
+    \value StateChanged
+    \value LocationChanged
+    \value NameChanged
+    \value DescriptionChanged
+    \value ValueChanged
+    \value ParentChanged
+    \value HelpChanged
+    \value DefaultActionChanged
+    \value AcceleratorChanged
+    \value MenuCommand
+*/
+
+/*!
+    \enum QAccessible::Role
+
+    This enum defines a number of roles an accessible object can have.
+    The roles are:
+
+    \value NoRole
+    \value TitleBar
+    \value MenuBar
+    \value ScrollBar
+    \value Grip
+    \value Sound
+    \value Cursor
+    \value Caret
+    \value AlertMessage
+    \value Window
+    \value Client
+    \value PopupMenu
+    \value MenuItem
+    \value ToolTip
+    \value Application
+    \value Document
+    \value Pane
+    \value Chart
+    \value Dialog
+    \value Border
+    \value Grouping
+    \value Separator
+    \value ToolBar
+    \value StatusBar
+    \value Table
+    \value ColumnHeader
+    \value RowHeader
+    \value Column
+    \value Row
+    \value Cell
+    \value Link
+    \value HelpBalloon
+    \value Character
+    \value List
+    \value ListItem
+    \value Outline
+    \value OutlineItem
+    \value PageTab
+    \value PropertyPage
+    \value Indicator
+    \value Graphic
+    \value StaticText
+    \value EditableText
+    \value PushButton
+    \value CheckBox
+    \value RadioButton
+    \value ComboBox
+    \value DropLest
+    \value ProgressBar
+    \value Dial
+    \value HotkeyField
+    \value Slider
+    \value SpinBox
+    \value Diagram
+    \value Animation
+    \value Equation
+    \value ButtonDropDown
+    \value ButtonMenu
+    \value ButtonDropGrid
+    \value Whitespace
+    \value PageTabList
+    \value Clock
+*/
+
+/*!
+    \enum QAccessible::NavDirection
+
+    This enum specifies which item to move to when navigating.
+
+    \value NavUp	    sibling above
+    \value NavDown	    sibling below
+    \value NavLeft	    left sibling
+    \value NavRight	    right sibling
+    \value NavNext	    next sibling
+    \value NavPrevious	    previous sibling
+    \value NavFirstChild    first child
+    \value NavLastChild	    last child
+    \value NavFocusChild    child with focus
+*/
+
+/*!
+    \enum QAccessible::Text
+
+    This enum specifies string information that an accessible object
+    returns.
+
+    \value Name		    The name of the object
+    \value Description	    A short text describing the object
+    \value Value	    The value of the object
+    \value Help		    A longer text giving information about how
+			    to use the object
+    \value DefaultAction    The default method to interact with the object
+    \value Accelerator	    The keyboard shortcut that executes the
+			    default action
+*/
+
+/*!
+    \fn static void QAccessible::updateAccessibility( QObject *object, int control, Event reason )
+
+    Notifies accessibility clients about a change in \a object's
+    accessibility information.
+
+    \a reason specifies the cause of the change, for example,
+    ValueChange when the position of a slider has been changed. \a
+    control is the ID of the child element that has changed. When \a
+    control is 0, the object itself has changed.
+
+    Call this function whenever the state of your accessible object or
+    one of it's sub-elements has been changed either programmatically
+    (e.g. by calling QLabel::setText()) or by user interaction.
+
+    If there are no accessibility tools listening to this event, the
+    performance penalty for calling this function is minor, but if determining
+    the parameters of the call is expensive you can use isActive() to
+    avoid unnecessary performance penalties if no client is listening.
+*/
+
+static QPluginManager<QAccessibleFactoryInterface> *qAccessibleManager = 0;
+static QPtrDict<QAccessibleInterface> *qAccessibleInterface = 0;
+static bool cleanupAdded = FALSE;
+
+static void qAccessibleCleanup()
+{
+    if ( qAccessibleInterface && qAccessibleInterface->count() && qAccessibleManager )
+	qAccessibleManager->setAutoUnload( FALSE );
+
+    delete qAccessibleInterface;
+    qAccessibleInterface = 0;
+    delete qAccessibleManager;
+    qAccessibleManager = 0;
+}
+
+#ifdef Q_WS_MAC
+QObject *QAccessible::queryAccessibleObject(QAccessibleInterface *o)
+{
+    if(qAccessibleInterface) {
+	for(QPtrDictIterator<QAccessibleInterface> it(*qAccessibleInterface); it.current(); ++it) {
+	    if(it.current() == o)
+		return (QObject*)it.currentKey();
+	}
+    }
+    return NULL;
+}
+#endif
+
+/*!
+    Sets \a iface to point to the implementation of the
+    QAccessibleInterface for \a object, and returns \c QS_OK if
+    successfull, or sets \a iface to 0 and returns \c QE_NOCOMPONENT if
+    no accessibility implementation for \a object exists.
+
+    The function uses the \link QObject::className() classname
+    \endlink of \a object to find a suitable implementation. If no
+    implementation for the object's class is available the function
+    tries to find an implementation for the object's parent class.
+
+    This function is called to answer an accessibility client's
+    request for object information. You should never need to call this
+    function yourself.
+*/
+QRESULT QAccessible::queryAccessibleInterface( QObject *object, QAccessibleInterface **iface )
+{
+    *iface = 0;
+    if ( !object )
+	return QE_INVALIDARG;
+
+    if ( qAccessibleInterface ) {
+	*iface = qAccessibleInterface->find( object );
+	if ( *iface ) {
+	    (*iface)->addRef();
+	    return QS_OK;
+	}
+    }
+
+    if ( !qAccessibleManager ) {
+	qAccessibleManager = new QPluginManager<QAccessibleFactoryInterface>( IID_QAccessibleFactory, QApplication::libraryPaths(), "/accessible" );
+	if ( !cleanupAdded ) {
+	    qAddPostRoutine( qAccessibleCleanup );
+	    cleanupAdded = TRUE;
+	}
+    }
+
+    QInterfacePtr<QAccessibleFactoryInterface> factory = 0;
+    QMetaObject *mo = object->metaObject();
+    while ( mo ) {
+	qAccessibleManager->queryInterface( mo->className(), &factory );
+	if ( factory )
+	    break;
+	mo = mo->superClass();
+    }
+    if ( factory )
+	return factory->createAccessibleInterface( mo->className(), object, iface );
+
+    return QE_NOCOMPONENT;
+}
+
+/*!
+    Returns TRUE if an accessibility implementation has been requested,
+    during the runtime of the application, otherwise returns FALSE. 
+    
+    Use this function to prevent potentially expensive notifications via
+    updateAccessibility().
+
+    \omit
+    QListView uses this function to prevent index-lookups for item based
+    notifications.
+    \endomit
+*/
+bool QAccessible::isActive()
+{
+    return qAccessibleManager != 0;
+}
+
+/*!
+    \class QAccessibleInterface qaccessible.h
+    \brief The QAccessibleInterface class defines an interface that exposes information about accessible objects.
+
+    \ingroup misc
+*/
+
+/*!
+    \fn bool QAccessibleInterface::isValid() const
+
+    Returns TRUE if all the data necessary to use this interface
+    implementation is valid (e.g. all pointers are non-null),
+    otherwise returns FALSE.
+*/
+
+/*!
+    \fn int QAccessibleInterface::childCount() const
+
+    Returns the number of children that belong to this object. A child
+    can provide accessibility information on it's own (e.g. a child
+    widget), or be a sub-element of this accessible object.
+
+    All objects provide this information.
+
+    \sa queryChild()
+*/
+
+/*!
+    \fn QRESULT QAccessibleInterface::queryChild( int control, QAccessibleInterface **iface ) const
+
+    Sets \a iface to point to the implementation of the
+    QAccessibleInterface for the child specified with \a control. If
+    the child doesn't provide accessibility information on it's own,
+    the value of \a iface is set to 0. For those elements, this
+    object is responsible for exposing the child's properties.
+
+    All objects provide this information.
+
+    \sa childCount(), queryParent()
+*/
+
+/*!
+    \fn QRESULT QAccessibleInterface::queryParent( QAccessibleInterface **iface ) const
+
+    Sets \a iface to point to the implementation of the
+    QAccessibleInterface for the parent object, or to 0 if there is
+    no such implementation or object.
+
+    All objects provide this information.
+
+    \sa queryChild()
+*/
+
+/*!
+    \fn int QAccessibleInterface::controlAt( int x, int y ) const
+
+    Returns the ID of the child that contains the screen coordinates
+    (\a x, \a y). This function returns 0 if the point is positioned
+    on the object itself. If the tested point is outside the
+    boundaries of the object this function returns -1.
+
+    All visual objects provide this information.
+*/
+
+/*!
+    \fn QRect QAccessibleInterface::rect( int control ) const
+
+    Returns the location of the child specified with \a control in
+    screen coordinates. This function returns the location of the
+    object itself if \a control is 0.
+
+    All visual objects provide this information.
+*/
+
+/*!
+    \fn int QAccessibleInterface::navigate( NavDirection direction, int startControl ) const
+
+    This function traverses to another object, or to a sub-element of
+    the current object. \a direction specifies in which direction to
+    navigate, and \a startControl specifies the start point of the
+    navigation, which is either 0 if the navigation starts at the
+    object itself, or an ID of one of the object's sub-elements.
+
+    The function returns the ID of the sub-element located in the \a
+    direction specified. If there is nothing in the navigated \a
+    direction, this function returns -1.
+
+    All objects support navigation.
+*/
+
+/*!
+    \fn QString QAccessibleInterface::text( Text t, int control ) const
+
+    Returns a string property \a t of the child object specified by \a
+    control, or the string property of the object itself if \a control
+    is 0.
+
+    The \e Name is a string used by clients to identify, find or
+    announce an accessible object for the user. All objects must have
+    a name that is unique within their container.
+
+    An accessible object's \e Description provides textual information
+    about an object's visual appearance. The description is primarily
+    used to provide greater context for low-vision or blind users, but
+    is also used for context searching or other applications. Not all
+    objects have a description. An "OK" button would not need a
+    description, but a toolbutton that shows a picture of a smiley
+    would.
+
+    The \e Value of an accessible object represents visual information
+    contained by the object, e.g. the text in a line edit. Usually,
+    the value can be modified by the user. Not all objects have a
+    value, e.g. static text labels don't, and some objects have a
+    state that already is the value, e.g. toggle buttons.
+
+    The \e Help text provides information about the function and
+    usage of an accessible object. Not all objects provide this
+    information.
+
+    An accessible object's \e DefaultAction describes the object's
+    primary method of manipulation, and should be a verb or a short
+    phrase, e.g. "Press" for a button.
+
+    The accelerator is a keyboard shortcut that activates the default
+    action of the object. A keyboard shortcut is the underlined
+    character in the text of a menu, menu item or control, and is
+    either the character itself, or a combination of this character
+    and a modifier key like ALT, CTRL or SHIFT. Command controls like
+    tool buttons also have shortcut keys and usually display them in
+    their tooltip.
+
+    \sa role(), state(), selection()
+*/
+
+/*!
+    \fn void QAccessibleInterface::setText( Text t, int control, const QString &text )
+
+    Sets the text property \a t of the child object \a control to \a
+    text. If \a control is 0, the text property of the object itself
+    is set.
+*/
+
+/*!
+    \fn QAccessible::Role QAccessibleInterface::role( int control ) const
+
+    Returns the role of the object if \a control is 0, or the role of
+    the object's sub-element with ID \a control. The role of an object
+    is usually static. All accessible objects have a role.
+
+    \sa text(), state(), selection()
+*/
+
+/*!
+    \fn QAccessible::State QAccessibleInterface::state( int control ) const
+
+    Returns the current state of the object if \a control is 0, or the
+    state of the object's sub-element element with ID \a control. All
+    objects have a state.
+
+    \sa text(), role(), selection()
+*/
+
+/*!
+    \fn QMemArray<int> QAccessibleInterface::selection() const
+
+    Returns the list of all the element IDs that are selected.
+
+    \sa text(), role(), state()
+*/
+
+/*!
+    \fn bool QAccessibleInterface::doDefaultAction( int control )
+
+    Calling this function performs the default action of the child
+    object specified by \a control, or the default action of the
+    object itself if \a control is 0.
+*/
+
+/*!
+    \fn bool QAccessibleInterface::setFocus( int control )
+
+    Gives the focus to the child object specified by \a control, or to
+    the object itself if \a control is 0.
+
+    Returns TRUE if the focus could be set; otherwise returns FALSE.
+*/
+
+/*!
+    \fn bool QAccessibleInterface::setSelected( int control, bool on, bool extend )
+
+    Sets the selection of the child object with ID \a control to \a
+    on. If \a extend is TRUE, all child elements between the focused
+    item and the specified child object have their selection set to \a
+    on.
+
+    Returns TRUE if the selection could be set; otherwise returns
+    FALSE.
+
+    \sa setFocus(), clearSelection()
+*/
+
+/*!
+    \fn void QAccessibleInterface::clearSelection()
+
+    Removes any selection from the object.
+
+    \sa setSelected()
+*/
+
+
+
+/*!
+    \class QAccessibleObject qaccessible.h
+    \brief The QAccessibleObject class implements parts of the
+    QAccessibleInterface for QObjects.
+
+    \ingroup misc
+
+    This class is mainly provided for convenience. All subclasses of
+    the QAccessibleInterface should use this class as the base class.
+*/
+
+/*!
+    Creates a QAccessibleObject for \a object.
+*/
+QAccessibleObject::QAccessibleObject( QObject *object )
+: object_(object)
+{
+    if ( !qAccessibleInterface ) {
+	qAccessibleInterface = new QPtrDict<QAccessibleInterface>( 73 );
+	if ( !cleanupAdded ) {
+	    qAddPostRoutine( qAccessibleCleanup );
+	    cleanupAdded = TRUE;
+	}
+    }
+
+    qAccessibleInterface->insert( object, this );
+}
+
+/*!
+    Destroys the QAccessibleObject.
+
+    This only happens when a call to release() decrements the internal
+    reference counter to zero.
+*/
+QAccessibleObject::~QAccessibleObject()
+{
+    if ( qAccessibleInterface ) {
+	qAccessibleInterface->remove( object_ );
+	if ( !qAccessibleInterface->count() ) {
+	    delete qAccessibleInterface;
+	    qAccessibleInterface = 0;
+	}
+    }
+}
+
+/*!
+    \reimp
+*/
+QRESULT QAccessibleObject::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
+{
+    *iface = 0;
+    if ( uuid == IID_QAccessible )
+	*iface = (QAccessibleInterface*)this;
+    else if ( uuid == IID_QUnknown )
+	*iface = (QUnknownInterface*)this;
+    else
+	return QE_NOINTERFACE;
+
+    (*iface)->addRef();
+    return QS_OK;
+}
+
+/*!
+    Returns the QObject for which this QAccessibleInterface
+    implementation provides information. Use isValid() to make sure
+    the object pointer is safe to use.
+*/
+QObject *QAccessibleObject::object() const
+{
+#if defined(QT_CHECK_RANGE)
+    if ( !isValid() )
+	qWarning( "QAccessibleInterface is invalid. Crash pending..." );
+#endif
+    return object_;
+}
+
+/*!
+    \reimp
+*/
+bool QAccessibleObject::isValid() const
+{
+    return !object_.isNull();
+}
+
+#endif
