- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qaccessible2.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtGui module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QACCESSIBLE2_H
    00043 #define QACCESSIBLE2_H
    00044
    00045 #include <QtGui/qaccessible.h>
    00046
    00047 QT_BEGIN_HEADER
    00048
    00049 QT_BEGIN_NAMESPACE
    00050
    00051 QT_MODULE(Gui)
    00052
    00053 #ifndef QT_NO_ACCESSIBILITY
    00054
    00055 namespace QAccessible2
    00056 {
    00057     enum CoordinateType
    00058     {
    00059         RelativeToScreen = 0,
    00060         RelativeToParent = 1
    00061     };
    00062
    00063     enum BoundaryType {
    00064         CharBoundary,
    00065         WordBoundary,
    00066         SentenceBoundary,
    00067         ParagraphBoundary,
    00068         LineBoundary,
    00069         NoBoundary
    00070     };
    00071 }
    00072
    00073 class Q_GUI_EXPORT QAccessible2Interface
    00074 {
    00075 public:
    00076     virtual ~QAccessible2Interface() {}
    00077 };
    00078
    00079 // catch-all functions. If an accessible class doesn't implement interface T, return 0
    00080 inline QAccessible2Interface *qAccessibleValueCastHelper() { return 0; }
    00081 inline QAccessible2Interface *qAccessibleTextCastHelper() { return 0; }
    00082 inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
    00083 inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
    00084 inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; }
    00085 inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
    00086
    00087 #define Q_ACCESSIBLE_OBJECT \
    00088     public: \
    00089     QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \
    00090     { \
    00091         switch (t) { \
    00092         case QAccessible2::TextInterface: \
    00093             return qAccessibleTextCastHelper(); \
    00094         case QAccessible2::EditableTextInterface: \
    00095             return qAccessibleEditableTextCastHelper(); \
    00096         case QAccessible2::ValueInterface: \
    00097             return qAccessibleValueCastHelper(); \
    00098         case QAccessible2::TableInterface: \
    00099             return qAccessibleTableCastHelper(); \
    00100         case QAccessible2::ActionInterface: \
    00101             return qAccessibleActionCastHelper(); \
    00102         case QAccessible2::ImageInterface: \
    00103             return qAccessibleImageCastHelper(); \
    00104         } \
    00105         return 0; \
    00106     } \
    00107     private:
    00108
    00109 class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface
    00110 {
    00111 public:
    00112     inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; }
    00113
    00114     virtual ~QAccessibleTextInterface() {}
    00115
    00116     virtual void addSelection(int startOffset, int endOffset) = 0;
    00117     virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
    00118     virtual int cursorPosition() = 0;
    00119     virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
    00120     virtual int selectionCount() = 0;
    00121     virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
    00122     virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
    00123     virtual QString text(int startOffset, int endOffset) = 0;
    00124     virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
    00125                               int *startOffset, int *endOffset) = 0;
    00126     virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
    00127                             int *startOffset, int *endOffset) = 0;
    00128     virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
    00129                          int *startOffset, int *endOffset) = 0;
    00130     virtual void removeSelection(int selectionIndex) = 0;
    00131     virtual void setCursorPosition(int position) = 0;
    00132     virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
    00133     virtual int characterCount() = 0;
    00134     virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
    00135 };
    00136
    00137 class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface
    00138 {
    00139 public:
    00140     inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; }
    00141
    00142     virtual ~QAccessibleEditableTextInterface() {}
    00143
    00144     virtual void copyText(int startOffset, int endOffset) = 0;
    00145     virtual void deleteText(int startOffset, int endOffset) = 0;
    00146     virtual void insertText(int offset, const QString &text) = 0;
    00147     virtual void cutText(int startOffset, int endOffset) = 0;
    00148     virtual void pasteText(int offset) = 0;
    00149     virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
    00150     virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0;
    00151 };
    00152
    00153 class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface
    00154 {
    00155 public:
    00156     QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface);
    00157
    00158     void copyText(int startOffset, int endOffset);
    00159     void deleteText(int startOffset, int endOffset);
    00160     void insertText(int offset, const QString &text);
    00161     void cutText(int startOffset, int endOffset);
    00162     void pasteText(int offset);
    00163     void replaceText(int startOffset, int endOffset, const QString &text);
    00164     inline void setAttributes(int, int, const QString &) {}
    00165
    00166 private:
    00167     QAccessibleInterface *iface;
    00168 };
    00169
    00170 class Q_GUI_EXPORT QAccessibleValueInterface: public QAccessible2Interface
    00171 {
    00172 public:
    00173     inline QAccessible2Interface *qAccessibleValueCastHelper() { return this; }
    00174
    00175     virtual ~QAccessibleValueInterface() {}
    00176
    00177     virtual QVariant currentValue() = 0;
    00178     virtual void setCurrentValue(const QVariant &value) = 0;
    00179     virtual QVariant maximumValue() = 0;
    00180     virtual QVariant minimumValue() = 0;
    00181 };
    00182
    00183 class Q_GUI_EXPORT QAccessibleTableInterface: public QAccessible2Interface
    00184 {
    00185 public:
    00186     inline QAccessible2Interface *qAccessibleTableCastHelper() { return this; }
    00187
    00188     virtual QAccessibleInterface *accessibleAt(int row, int column) = 0;
    00189     virtual QAccessibleInterface *caption() = 0;
    00190     virtual int childIndex(int rowIndex, int columnIndex) = 0;
    00191     virtual QString columnDescription(int column) = 0;
    00192     virtual int columnSpan(int row, int column) = 0;
    00193     virtual QAccessibleInterface *columnHeader() = 0;
    00194     virtual int columnIndex(int childIndex) = 0;
    00195     virtual int columnCount() = 0;
    00196     virtual int rowCount() = 0;
    00197     virtual int selectedColumnCount() = 0;
    00198     virtual int selectedRowCount() = 0;
    00199     virtual QString rowDescription(int row) = 0;
    00200     virtual int rowSpan(int row, int column) = 0;
    00201     virtual QAccessibleInterface *rowHeader() = 0;
    00202     virtual int rowIndex(int childIndex) = 0;
    00203     virtual int selectedRows(int maxRows, QList<int> *rows) = 0;
    00204     virtual int selectedColumns(int maxColumns, QList<int> *columns) = 0;
    00205     virtual QAccessibleInterface *summary() = 0;
    00206     virtual bool isColumnSelected(int column) = 0;
    00207     virtual bool isRowSelected(int row) = 0;
    00208     virtual bool isSelected(int row, int column) = 0;
    00209     virtual void selectRow(int row) = 0;
    00210     virtual void selectColumn(int column) = 0;
    00211     virtual void unselectRow(int row) = 0;
    00212     virtual void unselectColumn(int column) = 0;
    00213     virtual void cellAtIndex(int index, int *row, int *column, int *rowSpan,
    00214                              int *columnSpan, bool *isSelected) = 0;
    00215 };
    00216
    00217 class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface
    00218 {
    00219 public:
    00220     inline QAccessible2Interface *qAccessibleActionCastHelper() { return this; }
    00221
    00222     virtual int actionCount() = 0;
    00223     virtual void doAction(int actionIndex) = 0;
    00224     virtual QString description(int actionIndex) = 0;
    00225     virtual QString name(int actionIndex) = 0;
    00226     virtual QString localizedName(int actionIndex) = 0;
    00227     virtual QStringList keyBindings(int actionIndex) = 0;
    00228 };
    00229
    00230 class Q_GUI_EXPORT QAccessibleImageInterface : public QAccessible2Interface
    00231 {
    00232 public:
    00233     inline QAccessible2Interface *qAccessibleImageCastHelper() { return this; }
    00234
    00235     virtual QString imageDescription() = 0;
    00236     virtual QSize imageSize() = 0;
    00237     virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0;
    00238 };
    00239
    00240 #endif // QT_NO_ACCESSIBILITY
    00241
    00242 QT_END_NAMESPACE
    00243
    00244 QT_END_HEADER
    00245
    00246 #endif