File indexing completed on 2024-10-06 12:47:43
0001 /* 0002 SPDX-FileCopyrightText: 2012 Sebastian Sauer <sebastian.sauer@kdab.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef QACCESSIBILITYCLIENT_ROLEOBJECTS_H 0008 #define QACCESSIBILITYCLIENT_ROLEOBJECTS_H 0009 0010 #include <QObject> 0011 #include <QRect> 0012 0013 #include "qaccessibilityclient_export.h" 0014 #include "accessibleobject.h" 0015 0016 namespace QAccessibleClient { 0017 0018 /** 0019 Base class for role objects. 0020 0021 The role objects offer a high level API to deal with accessible 0022 objects. Every accessible objects has a role assigned and that 0023 role is used with the role objects to create one specialized 0024 role object instance per accessible object. The API given is 0025 Qt-ified using the QMetaObject system to allow introspection. 0026 */ 0027 class QACCESSIBILITYCLIENT_EXPORT ObjectRole : public QObject 0028 { 0029 Q_OBJECT 0030 Q_PROPERTY(AccessibleObject accessible READ accessible) 0031 Q_PROPERTY(AccessibleObject::Role role READ role) 0032 Q_PROPERTY(QString roleName READ roleName) 0033 Q_PROPERTY(QString localizedRoleName READ localizedRoleName) 0034 Q_PROPERTY(QString url READ url) 0035 Q_PROPERTY(QString name READ name) 0036 Q_PROPERTY(QString description READ description) 0037 Q_PROPERTY(QRect boundingRect READ boundingRect) 0038 public: 0039 virtual ~ObjectRole(); 0040 0041 AccessibleObject accessible() const; 0042 AccessibleObject::Role role() const; 0043 QString roleName() const; 0044 QString localizedRoleName() const; 0045 QString url() const; 0046 QString name() const; 0047 QString description() const; 0048 QRect boundingRect() const; 0049 0050 static ObjectRole* create(const AccessibleObject &acc); 0051 0052 protected: 0053 class Private; 0054 Private *d; 0055 0056 ObjectRole(const AccessibleObject &acc); 0057 ObjectRole(Private *dd); 0058 }; 0059 0060 /** 0061 CheckBox role object. 0062 */ 0063 class CheckBoxRole : public ObjectRole 0064 { 0065 Q_OBJECT 0066 Q_PROPERTY(QString text READ text) 0067 public: 0068 explicit CheckBoxRole(const AccessibleObject &acc); 0069 QString text() const; 0070 //bool isChecked() const; 0071 //void setChecked(bool checked); 0072 }; 0073 0074 // CheckableMenuItem 0075 // ColumnHeader 0076 0077 /** 0078 ComboBox role object. 0079 */ 0080 class ComboBoxRole : public ObjectRole 0081 { 0082 Q_OBJECT 0083 Q_PROPERTY(QString text READ text) 0084 public: 0085 explicit ComboBoxRole(const AccessibleObject &acc); 0086 QString text() const; 0087 //void setText(const QString &text); 0088 //QStringList items() const; 0089 //int currentIndex() const; 0090 //void setCurrentIndex(int index); 0091 }; 0092 0093 // DesktopFrame 0094 // Dial 0095 // Dialog 0096 // Filler 0097 // Frame 0098 // Icon 0099 0100 /** 0101 Label role object. 0102 */ 0103 class LabelRole : public ObjectRole 0104 { 0105 Q_OBJECT 0106 Q_PROPERTY(QString text READ text) 0107 public: 0108 explicit LabelRole(const AccessibleObject &acc); 0109 QString text() const; 0110 }; 0111 0112 // ListView 0113 // ListItem 0114 // Menu 0115 // MenuBar 0116 // MenuItem 0117 // Tab 0118 // TabContainer 0119 // PasswordText 0120 // PopupMenu 0121 // ProgressBar 0122 0123 /** 0124 Button role object. 0125 */ 0126 class ButtonRole : public ObjectRole 0127 { 0128 Q_OBJECT 0129 Q_PROPERTY(QString text READ text) 0130 public: 0131 explicit ButtonRole(const AccessibleObject &acc); 0132 QString text() const; 0133 //void activate(); 0134 }; 0135 0136 /** 0137 RadioButton role object. 0138 */ 0139 class RadioButtonRole : public ObjectRole 0140 { 0141 Q_OBJECT 0142 Q_PROPERTY(QString text READ text) 0143 public: 0144 explicit RadioButtonRole(const AccessibleObject &acc); 0145 QString text() const; 0146 //bool isChecked() const; 0147 //void setChecked(bool checked); 0148 }; 0149 0150 // RadioMenuItem 0151 // RowHeader 0152 // ScrollBar 0153 // ScrollArea 0154 // Separator 0155 // Slider 0156 // SpinButton 0157 // StatusBar 0158 // TableView 0159 // TableCell 0160 // TableColumnHeader 0161 // TableColumn 0162 // TableRowHeader 0163 // TableRow 0164 // Terminal 0165 0166 /** 0167 Text role object. 0168 */ 0169 class TextRole : public ObjectRole 0170 { 0171 Q_OBJECT 0172 Q_PROPERTY(QString text READ text WRITE setText) 0173 Q_PROPERTY(bool isEditable READ isEditable) 0174 public: 0175 explicit TextRole(const AccessibleObject &acc); 0176 QString text() const; 0177 bool isEditable() const; 0178 public Q_SLOTS: 0179 void setText(const QString &text); 0180 }; 0181 0182 /** 0183 ToggleButton role object. 0184 */ 0185 class ToggleButtonRole : public ObjectRole 0186 { 0187 Q_OBJECT 0188 Q_PROPERTY(QString text READ text) 0189 public: 0190 explicit ToggleButtonRole(const AccessibleObject &acc); 0191 QString text() const; 0192 //void toggle(bool toggled); 0193 }; 0194 0195 // ToolBar 0196 // ToolTip 0197 // TreeView 0198 // Window 0199 // TreeItem 0200 0201 } 0202 0203 //Q_DECLARE_METATYPE(QAccessibleClient::ObjectRole) 0204 0205 #endif 0206