home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qaccessible.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  8KB  |  288 lines

  1. /****************************************************************************
  2. ** $Id$
  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. public:
  54.     enum Event {
  55.     SoundPlayed        = 0x0001,
  56.     Alert            = 0x0002,
  57.     ForegroundChanged   = 0x0003,
  58.     MenuStart        = 0x0004,
  59.     MenuEnd            = 0x0005,
  60.     PopupMenuStart        = 0x0006,
  61.     PopupMenuEnd        = 0x0007,
  62.     ContextHelpStart    = 0x000C,
  63.     ContextHelpEnd        = 0x000D,
  64.     DragDropStart        = 0x000E,
  65.     DragDropEnd        = 0x000F,
  66.     DialogStart        = 0x0010,
  67.     DialogEnd        = 0x0011,
  68.     ScrollingStart        = 0x0012,
  69.     ScrollingEnd        = 0x0013,
  70.  
  71.     MenuCommand        = 0x0018,
  72.  
  73.     ObjectCreated        = 0x8000,
  74.     ObjectDestroyed        = 0x8001,
  75.     ObjectShow        = 0x8002,
  76.     ObjectHide        = 0x8003,
  77.     ObjectReorder        = 0x8004,
  78.     Focus            = 0x8005,
  79.     Selection        = 0x8006,
  80.     SelectionAdd        = 0x8007,
  81.     SelectionRemove        = 0x8008,
  82.     SelectionWithin        = 0x8009,
  83.     StateChanged        = 0x800A,
  84.     LocationChanged        = 0x800B,
  85.     NameChanged        = 0x800C,
  86.     DescriptionChanged  = 0x800D,
  87.     ValueChanged        = 0x800E,
  88.     ParentChanged        = 0x800F,
  89.     HelpChanged        = 0x80A0,
  90.     DefaultActionChanged= 0x80B0,
  91.     AcceleratorChanged  = 0x80C0
  92.     };
  93.  
  94.     enum State {
  95.     Normal        = 0x00000000,
  96.     Unavailable    = 0x00000001,
  97.     Selected    = 0x00000002,
  98.     Focused        = 0x00000004,
  99.     Pressed        = 0x00000008,
  100.     Checked        = 0x00000010,
  101.     Mixed        = 0x00000020,
  102.     ReadOnly    = 0x00000040,
  103.     HotTracked    = 0x00000080,
  104.     Default        = 0x00000100,
  105.     Expanded    = 0x00000200,
  106.     Collapsed    = 0x00000400,
  107.     Busy        = 0x00000800,
  108.     Floating    = 0x00001000,
  109.     Marqueed    = 0x00002000,
  110.     Animated    = 0x00004000,
  111.     Invisible    = 0x00008000,
  112.     Offscreen    = 0x00010000,
  113.     Sizeable    = 0x00020000,
  114.     Moveable    = 0x00040000,
  115.     SelfVoicing    = 0x00080000,
  116.     Focusable    = 0x00100000,
  117.     Selectable    = 0x00200000,
  118.     Linked        = 0x00400000,
  119.     Traversed    = 0x00800000,
  120.     MultiSelectable    = 0x01000000,
  121.     ExtSelectable    = 0x02000000,
  122.     AlertLow    = 0x04000000,
  123.     AlertMedium    = 0x08000000,
  124.     AlertHigh    = 0x10000000,
  125.     Protected    = 0x20000000,
  126.     Valid        = 0x3fffffff
  127.     };
  128.  
  129.     enum Role {
  130.     NoRole        = 0x00000000,
  131.     TitleBar    = 0x00000001,
  132.     MenuBar        = 0x00000002,
  133.     ScrollBar    = 0x00000003,
  134.     Grip        = 0x00000004,
  135.     Sound        = 0x00000005,
  136.     Cursor        = 0x00000006,
  137.     Caret        = 0x00000007,
  138.     AlertMessage    = 0x00000008,
  139.     Window        = 0x00000009,
  140.     Client        = 0x0000000A,
  141.     PopupMenu    = 0x0000000B,
  142.     MenuItem    = 0x0000000C,
  143.     ToolTip        = 0x0000000D,
  144.     Application    = 0x0000000E,
  145.     Document    = 0x0000000F,
  146.     Pane        = 0x00000010,
  147.     Chart        = 0x00000011,
  148.     Dialog        = 0x00000012,
  149.     Border        = 0x00000013,
  150.     Grouping    = 0x00000014,
  151.     Separator    = 0x00000015,
  152.     ToolBar        = 0x00000016,
  153.     StatusBar    = 0x00000017,
  154.     Table        = 0x00000018,
  155.     ColumnHeader    = 0x00000019,
  156.     RowHeader    = 0x0000001A,
  157.     Column        = 0x0000001B,
  158.     Row        = 0x0000001C,
  159.     Cell        = 0x0000001D,
  160.     Link        = 0x0000001E,
  161.     HelpBalloon    = 0x0000001F,
  162.     Character    = 0x00000020,
  163.     List        = 0x00000021,
  164.     ListItem    = 0x00000022,
  165.     Outline        = 0x00000023,
  166.     OutlineItem    = 0x00000024,
  167.     PageTab        = 0x00000025,
  168.     PropertyPage    = 0x00000026,
  169.     Indicator    = 0x00000027,
  170.     Graphic        = 0x00000028,
  171.     StaticText    = 0x00000029,
  172.     EditableText    = 0x0000002A,  // Editable, selectable, etc.
  173.     PushButton    = 0x0000002B,
  174.     CheckBox    = 0x0000002C,
  175.     RadioButton    = 0x0000002D,
  176.     ComboBox    = 0x0000002E,
  177.     DropLest    = 0x0000002F,
  178.     ProgressBar    = 0x00000030,
  179.     Dial        = 0x00000031,
  180.     HotkeyField    = 0x00000032,
  181.     Slider        = 0x00000033,
  182.     SpinBox        = 0x00000034,
  183.     Diagram        = 0x00000035,
  184.     Animation    = 0x00000036,
  185.     Equation    = 0x00000037,
  186.     ButtonDropDown    = 0x00000038,
  187.     ButtonMenu    = 0x00000039,
  188.     ButtonDropGrid    = 0x0000003A,
  189.     Whitespace    = 0x0000003B,
  190.     PageTabList    = 0x0000003C,
  191.     Clock        = 0x0000003D
  192.     };
  193.  
  194.     enum NavDirection {
  195.     NavUp        = 0x00000001,
  196.     NavDown        = 0x00000002,
  197.     NavLeft        = 0x00000003,
  198.     NavRight    = 0x00000004,
  199.     NavNext        = 0x00000005,
  200.     NavPrevious    = 0x00000006,
  201.     NavFirstChild    = 0x00000007,
  202.     NavLastChild    = 0x00000008,
  203.     NavFocusChild    = 0x00000009
  204.     };
  205.  
  206.     enum Text {
  207.     Name        = 0,
  208.     Description,
  209.     Value,
  210.     Help,
  211.     Accelerator,
  212.     DefaultAction
  213.     };
  214.  
  215.     static QRESULT queryAccessibleInterface( QObject *, QAccessibleInterface ** );
  216.     static void updateAccessibility( QObject *, int who, Event reason );
  217. };
  218.  
  219. // {EC86CB9C-5DA0-4c43-A739-13EBDF1C6B14}
  220. #define IID_QAccessible QUuid( 0xec86cb9c, 0x5da0, 0x4c43, 0xa7, 0x39, 0x13, 0xeb, 0xdf, 0x1c, 0x6b, 0x14 )
  221.  
  222. struct Q_EXPORT QAccessibleInterface : public QAccessible, public QUnknownInterface
  223. {
  224.     // check for valid pointers
  225.     virtual bool    isValid() const = 0;
  226.  
  227.     // hierarchy
  228.     virtual int        childCount() const = 0;
  229.     virtual QRESULT    queryChild( int control, QAccessibleInterface** ) const = 0;
  230.     virtual QRESULT    queryParent( QAccessibleInterface** ) const = 0;
  231.  
  232.     // navigation
  233.     virtual int        controlAt( int x, int y ) const = 0;
  234.     virtual QRect    rect( int control ) const = 0;
  235.     virtual int        navigate( NavDirection direction, int startControl ) const = 0;
  236.  
  237.     // properties and state
  238.     virtual QString    text( Text t, int control ) const = 0;
  239.     virtual void    setText( Text t, int control, const QString &text ) = 0;
  240.     virtual Role    role( int control ) const = 0;
  241.     virtual State    state( int control ) const = 0;
  242.     virtual QMemArray<int> selection() const = 0;
  243.  
  244.     // methods
  245.     virtual bool    doDefaultAction( int control ) = 0;
  246.     virtual bool    setFocus( int control ) = 0;
  247.     virtual bool    setSelected( int control, bool on, bool extend ) = 0;
  248.     virtual void    clearSelection() = 0;    
  249. };
  250.  
  251. // {49F4C6A7-412F-41DE-9E24-648843421FD3} 
  252. #ifndef IID_QAccessibleFactory
  253. #define IID_QAccessibleFactory QUuid( 0x49f4c6a7, 0x412f, 0x41de, 0x9e, 0x24, 0x64, 0x88, 0x43, 0x42, 0x1f, 0xd3 )
  254. #endif
  255.  
  256. struct Q_EXPORT QAccessibleFactoryInterface : public QAccessible, public QFeatureListInterface
  257. {
  258.     virtual QRESULT createAccessibleInterface( const QString &, QObject *, QAccessibleInterface** ) = 0;
  259. };
  260.  
  261. #if defined(Q_TEMPLATEDLL)
  262. // MOC_SKIP_BEGIN
  263. template class Q_EXPORT QGuardedPtr<QObject>;
  264. // MOC_SKIP_END
  265. #endif
  266.  
  267. class Q_EXPORT QAccessibleObject : public QObject, public QAccessibleInterface
  268. {
  269. public:
  270.     QAccessibleObject( QObject *object );
  271.     virtual ~QAccessibleObject();
  272.  
  273.     QRESULT    queryInterface( const QUuid &, QUnknownInterface** );
  274.     Q_REFCOUNT
  275.  
  276.     bool    isValid() const;
  277.  
  278. protected:
  279.     QObject *object() const;
  280.  
  281. private:
  282.     QGuardedPtr<QObject> object_;
  283. };
  284.  
  285. #endif //QT_ACCESSIBILITY_SUPPORT
  286.  
  287. #endif //QACCESSIBLE_H
  288.