[129] | 1 | /****************************************************************************
|
---|
| 2 | ** $Id: qaccessible.h 131 2006-09-21 20:55:26Z dmik $
|
---|
| 3 | **
|
---|
| 4 | ** Definition of QAccessible and QAccessibleObject classes
|
---|
| 5 | **
|
---|
| 6 | ** Copyright (C) 2000-2001 Trolltech AS. All rights reserved.
|
---|
| 7 | **
|
---|
| 8 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
| 9 | **
|
---|
| 10 | ** This file may be distributed under the terms of the Q Public License
|
---|
| 11 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
| 12 | ** LICENSE.QPL included in the packaging of this file.
|
---|
| 13 | **
|
---|
| 14 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 15 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 16 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 17 | ** packaging of this file.
|
---|
| 18 | **
|
---|
| 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 20 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
| 21 | ** Agreement provided with the Software.
|
---|
| 22 | **
|
---|
| 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 25 | **
|
---|
| 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 27 | ** information about Qt Commercial License Agreements.
|
---|
| 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
| 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 30 | **
|
---|
| 31 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 32 | ** not clear to you.
|
---|
| 33 | **
|
---|
| 34 | **********************************************************************/
|
---|
| 35 |
|
---|
| 36 | #ifndef QACCESSIBLE_H
|
---|
| 37 | #define QACCESSIBLE_H
|
---|
| 38 |
|
---|
| 39 | #ifndef QT_H
|
---|
| 40 | #include "qobject.h"
|
---|
| 41 | #include <private/qcom_p.h>
|
---|
| 42 | #include "qrect.h"
|
---|
| 43 | #include "qguardedptr.h"
|
---|
| 44 | #include "qmemarray.h"
|
---|
| 45 | #endif // QT_H
|
---|
| 46 |
|
---|
| 47 | #if defined(QT_ACCESSIBILITY_SUPPORT)
|
---|
| 48 |
|
---|
| 49 | struct QAccessibleInterface;
|
---|
| 50 |
|
---|
| 51 | class Q_EXPORT QAccessible
|
---|
| 52 | {
|
---|
| 53 | private:
|
---|
| 54 | #ifdef Q_WS_MAC
|
---|
| 55 | static QMAC_PASCAL OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *);
|
---|
| 56 | static QObject *queryAccessibleObject(QAccessibleInterface *);
|
---|
| 57 | #endif
|
---|
| 58 | public:
|
---|
| 59 | enum Event {
|
---|
| 60 | SoundPlayed = 0x0001,
|
---|
| 61 | Alert = 0x0002,
|
---|
| 62 | ForegroundChanged = 0x0003,
|
---|
| 63 | MenuStart = 0x0004,
|
---|
| 64 | MenuEnd = 0x0005,
|
---|
| 65 | PopupMenuStart = 0x0006,
|
---|
| 66 | PopupMenuEnd = 0x0007,
|
---|
| 67 | ContextHelpStart = 0x000C,
|
---|
| 68 | ContextHelpEnd = 0x000D,
|
---|
| 69 | DragDropStart = 0x000E,
|
---|
| 70 | DragDropEnd = 0x000F,
|
---|
| 71 | DialogStart = 0x0010,
|
---|
| 72 | DialogEnd = 0x0011,
|
---|
| 73 | ScrollingStart = 0x0012,
|
---|
| 74 | ScrollingEnd = 0x0013,
|
---|
| 75 |
|
---|
| 76 | MenuCommand = 0x0018,
|
---|
| 77 |
|
---|
| 78 | ObjectCreated = 0x8000,
|
---|
| 79 | ObjectDestroyed = 0x8001,
|
---|
| 80 | ObjectShow = 0x8002,
|
---|
| 81 | ObjectHide = 0x8003,
|
---|
| 82 | ObjectReorder = 0x8004,
|
---|
| 83 | Focus = 0x8005,
|
---|
| 84 | Selection = 0x8006,
|
---|
| 85 | SelectionAdd = 0x8007,
|
---|
| 86 | SelectionRemove = 0x8008,
|
---|
| 87 | SelectionWithin = 0x8009,
|
---|
| 88 | StateChanged = 0x800A,
|
---|
| 89 | LocationChanged = 0x800B,
|
---|
| 90 | NameChanged = 0x800C,
|
---|
| 91 | DescriptionChanged = 0x800D,
|
---|
| 92 | ValueChanged = 0x800E,
|
---|
| 93 | ParentChanged = 0x800F,
|
---|
| 94 | HelpChanged = 0x80A0,
|
---|
| 95 | DefaultActionChanged= 0x80B0,
|
---|
| 96 | AcceleratorChanged = 0x80C0
|
---|
| 97 | };
|
---|
| 98 |
|
---|
| 99 | enum State {
|
---|
| 100 | Normal = 0x00000000,
|
---|
| 101 | Unavailable = 0x00000001,
|
---|
| 102 | Selected = 0x00000002,
|
---|
| 103 | Focused = 0x00000004,
|
---|
| 104 | Pressed = 0x00000008,
|
---|
| 105 | Checked = 0x00000010,
|
---|
| 106 | Mixed = 0x00000020,
|
---|
| 107 | ReadOnly = 0x00000040,
|
---|
| 108 | HotTracked = 0x00000080,
|
---|
| 109 | Default = 0x00000100,
|
---|
| 110 | Expanded = 0x00000200,
|
---|
| 111 | Collapsed = 0x00000400,
|
---|
| 112 | Busy = 0x00000800,
|
---|
| 113 | Floating = 0x00001000,
|
---|
| 114 | Marqueed = 0x00002000,
|
---|
| 115 | Animated = 0x00004000,
|
---|
| 116 | Invisible = 0x00008000,
|
---|
| 117 | Offscreen = 0x00010000,
|
---|
| 118 | Sizeable = 0x00020000,
|
---|
| 119 | Moveable = 0x00040000,
|
---|
| 120 | SelfVoicing = 0x00080000,
|
---|
| 121 | Focusable = 0x00100000,
|
---|
| 122 | Selectable = 0x00200000,
|
---|
| 123 | Linked = 0x00400000,
|
---|
| 124 | Traversed = 0x00800000,
|
---|
| 125 | MultiSelectable = 0x01000000,
|
---|
| 126 | ExtSelectable = 0x02000000,
|
---|
| 127 | AlertLow = 0x04000000,
|
---|
| 128 | AlertMedium = 0x08000000,
|
---|
| 129 | AlertHigh = 0x10000000,
|
---|
| 130 | Protected = 0x20000000,
|
---|
| 131 | Valid = 0x3fffffff
|
---|
| 132 | };
|
---|
| 133 |
|
---|
| 134 | enum Role {
|
---|
| 135 | NoRole = 0x00000000,
|
---|
| 136 | TitleBar = 0x00000001,
|
---|
| 137 | MenuBar = 0x00000002,
|
---|
| 138 | ScrollBar = 0x00000003,
|
---|
| 139 | Grip = 0x00000004,
|
---|
| 140 | Sound = 0x00000005,
|
---|
| 141 | Cursor = 0x00000006,
|
---|
| 142 | Caret = 0x00000007,
|
---|
| 143 | AlertMessage = 0x00000008,
|
---|
| 144 | Window = 0x00000009,
|
---|
| 145 | Client = 0x0000000A,
|
---|
| 146 | PopupMenu = 0x0000000B,
|
---|
| 147 | MenuItem = 0x0000000C,
|
---|
| 148 | ToolTip = 0x0000000D,
|
---|
| 149 | Application = 0x0000000E,
|
---|
| 150 | Document = 0x0000000F,
|
---|
| 151 | Pane = 0x00000010,
|
---|
| 152 | Chart = 0x00000011,
|
---|
| 153 | Dialog = 0x00000012,
|
---|
| 154 | Border = 0x00000013,
|
---|
| 155 | Grouping = 0x00000014,
|
---|
| 156 | Separator = 0x00000015,
|
---|
| 157 | ToolBar = 0x00000016,
|
---|
| 158 | StatusBar = 0x00000017,
|
---|
| 159 | Table = 0x00000018,
|
---|
| 160 | ColumnHeader = 0x00000019,
|
---|
| 161 | RowHeader = 0x0000001A,
|
---|
| 162 | Column = 0x0000001B,
|
---|
| 163 | Row = 0x0000001C,
|
---|
| 164 | Cell = 0x0000001D,
|
---|
| 165 | Link = 0x0000001E,
|
---|
| 166 | HelpBalloon = 0x0000001F,
|
---|
| 167 | Character = 0x00000020,
|
---|
| 168 | List = 0x00000021,
|
---|
| 169 | ListItem = 0x00000022,
|
---|
| 170 | Outline = 0x00000023,
|
---|
| 171 | OutlineItem = 0x00000024,
|
---|
| 172 | PageTab = 0x00000025,
|
---|
| 173 | PropertyPage = 0x00000026,
|
---|
| 174 | Indicator = 0x00000027,
|
---|
| 175 | Graphic = 0x00000028,
|
---|
| 176 | StaticText = 0x00000029,
|
---|
| 177 | EditableText = 0x0000002A, // Editable, selectable, etc.
|
---|
| 178 | PushButton = 0x0000002B,
|
---|
| 179 | CheckBox = 0x0000002C,
|
---|
| 180 | RadioButton = 0x0000002D,
|
---|
| 181 | ComboBox = 0x0000002E,
|
---|
| 182 | DropLest = 0x0000002F,
|
---|
| 183 | ProgressBar = 0x00000030,
|
---|
| 184 | Dial = 0x00000031,
|
---|
| 185 | HotkeyField = 0x00000032,
|
---|
| 186 | Slider = 0x00000033,
|
---|
| 187 | SpinBox = 0x00000034,
|
---|
| 188 | Diagram = 0x00000035,
|
---|
| 189 | Animation = 0x00000036,
|
---|
| 190 | Equation = 0x00000037,
|
---|
| 191 | ButtonDropDown = 0x00000038,
|
---|
| 192 | ButtonMenu = 0x00000039,
|
---|
| 193 | ButtonDropGrid = 0x0000003A,
|
---|
| 194 | Whitespace = 0x0000003B,
|
---|
| 195 | PageTabList = 0x0000003C,
|
---|
| 196 | Clock = 0x0000003D
|
---|
| 197 | };
|
---|
| 198 |
|
---|
| 199 | enum NavDirection {
|
---|
| 200 | NavUp = 0x00000001,
|
---|
| 201 | NavDown = 0x00000002,
|
---|
| 202 | NavLeft = 0x00000003,
|
---|
| 203 | NavRight = 0x00000004,
|
---|
| 204 | NavNext = 0x00000005,
|
---|
| 205 | NavPrevious = 0x00000006,
|
---|
| 206 | NavFirstChild = 0x00000007,
|
---|
| 207 | NavLastChild = 0x00000008,
|
---|
| 208 | NavFocusChild = 0x00000009
|
---|
| 209 | };
|
---|
| 210 |
|
---|
| 211 | enum Text {
|
---|
| 212 | Name = 0,
|
---|
| 213 | Description,
|
---|
| 214 | Value,
|
---|
| 215 | Help,
|
---|
| 216 | Accelerator,
|
---|
| 217 | DefaultAction
|
---|
| 218 | };
|
---|
| 219 |
|
---|
| 220 | static QRESULT queryAccessibleInterface( QObject *, QAccessibleInterface ** );
|
---|
| 221 | static void updateAccessibility( QObject *, int who, Event reason );
|
---|
| 222 | static bool isActive();
|
---|
| 223 |
|
---|
| 224 | static void initialize();
|
---|
| 225 | static void cleanup();
|
---|
| 226 | };
|
---|
| 227 |
|
---|
| 228 | // {EC86CB9C-5DA0-4c43-A739-13EBDF1C6B14}
|
---|
| 229 | #define IID_QAccessible QUuid( 0xec86cb9c, 0x5da0, 0x4c43, 0xa7, 0x39, 0x13, 0xeb, 0xdf, 0x1c, 0x6b, 0x14 )
|
---|
| 230 |
|
---|
| 231 | struct Q_EXPORT QAccessibleInterface : public QAccessible, public QUnknownInterface
|
---|
| 232 | {
|
---|
| 233 | // check for valid pointers
|
---|
| 234 | virtual bool isValid() const = 0;
|
---|
| 235 |
|
---|
| 236 | // hierarchy
|
---|
| 237 | virtual int childCount() const = 0;
|
---|
| 238 | virtual QRESULT queryChild( int control, QAccessibleInterface** ) const = 0;
|
---|
| 239 | virtual QRESULT queryParent( QAccessibleInterface** ) const = 0;
|
---|
| 240 |
|
---|
| 241 | // navigation
|
---|
| 242 | virtual int controlAt( int x, int y ) const = 0;
|
---|
| 243 | virtual QRect rect( int control ) const = 0;
|
---|
| 244 | virtual int navigate( NavDirection direction, int startControl ) const = 0;
|
---|
| 245 |
|
---|
| 246 | // properties and state
|
---|
| 247 | virtual QString text( Text t, int control ) const = 0;
|
---|
| 248 | virtual void setText( Text t, int control, const QString &text ) = 0;
|
---|
| 249 | virtual Role role( int control ) const = 0;
|
---|
| 250 | virtual State state( int control ) const = 0;
|
---|
| 251 | virtual QMemArray<int> selection() const = 0;
|
---|
| 252 |
|
---|
| 253 | // methods
|
---|
| 254 | virtual bool doDefaultAction( int control ) = 0;
|
---|
| 255 | virtual bool setFocus( int control ) = 0;
|
---|
| 256 | virtual bool setSelected( int control, bool on, bool extend ) = 0;
|
---|
| 257 | virtual void clearSelection() = 0;
|
---|
| 258 | };
|
---|
| 259 |
|
---|
| 260 | // {49F4C6A7-412F-41DE-9E24-648843421FD3}
|
---|
| 261 | #ifndef IID_QAccessibleFactory
|
---|
| 262 | #define IID_QAccessibleFactory QUuid( 0x49f4c6a7, 0x412f, 0x41de, 0x9e, 0x24, 0x64, 0x88, 0x43, 0x42, 0x1f, 0xd3 )
|
---|
| 263 | #endif
|
---|
| 264 |
|
---|
| 265 | struct Q_EXPORT QAccessibleFactoryInterface : public QAccessible, public QFeatureListInterface
|
---|
| 266 | {
|
---|
| 267 | virtual QRESULT createAccessibleInterface( const QString &, QObject *, QAccessibleInterface** ) = 0;
|
---|
| 268 | };
|
---|
| 269 |
|
---|
| 270 | class Q_EXPORT QAccessibleObject : public QObject, public QAccessibleInterface
|
---|
| 271 | {
|
---|
| 272 | public:
|
---|
| 273 | QAccessibleObject( QObject *object );
|
---|
| 274 | virtual ~QAccessibleObject();
|
---|
| 275 |
|
---|
| 276 | QRESULT queryInterface( const QUuid &, QUnknownInterface** );
|
---|
| 277 | Q_REFCOUNT
|
---|
| 278 |
|
---|
| 279 | bool isValid() const;
|
---|
| 280 |
|
---|
| 281 | protected:
|
---|
| 282 | QObject *object() const;
|
---|
| 283 |
|
---|
| 284 | private:
|
---|
| 285 | QGuardedPtr<QObject> object_;
|
---|
| 286 | };
|
---|
| 287 |
|
---|
| 288 | #define Q_DEFINED_QACCESSIBLE_OBJECT
|
---|
| 289 | #include "qwinexport.h"
|
---|
| 290 | #endif //QT_ACCESSIBILITY_SUPPORT
|
---|
| 291 |
|
---|
| 292 | #endif //QACCESSIBLE_H
|
---|