Qt Accessibility Client

accessibleobject.h
1 /*
2  SPDX-FileCopyrightText: 2012 Frederik Gladhorn <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef QACCESSIBILITYCLIENT_ACCESSIBLEOBJECT_H
8 #define QACCESSIBILITYCLIENT_ACCESSIBLEOBJECT_H
9 
10 #include <QtGlobal>
11 
12 namespace QAccessibleClient {
13  class AccessibleObject;
14 }
15 
16 #include <qlist.h>
17 #include <QSharedPointer>
18 #include <qaction.h>
19 
20 #include "qaccessibilityclient_export.h"
21 
22 namespace QAccessibleClient {
23 
24 class AccessibleObjectPrivate;
25 class RegistryPrivate;
26 
27 
28 #ifndef QT_NO_DEBUG_STREAM
29  QACCESSIBILITYCLIENT_EXPORT QDebug operator<<(QDebug, const AccessibleObject &);
30 #endif
31 
42 class QACCESSIBILITYCLIENT_EXPORT AccessibleObject
43 {
44 public:
45 
56  enum Interface {
57  NoInterface = 0x0,
58  AccessibleInterface = 0x1,
59  CacheInterface = 0x2,
60  ActionInterface = 0x4,
61  ApplicationInterface = 0x8,
62  CollectionInterface = 0x10,
63  ComponentInterface = 0x20,
64  DocumentInterface = 0x40,
65  EditableTextInterface = 0x80,
66  EventKeyboardInterface = 0x100,
67  EventMouseInterface = 0x200,
68  EventObjectInterface = 0x400,
69  HyperlinkInterface = 0x800,
70  HypertextInterface = 0x1000,
71  ImageInterface = 0x2000,
72  SelectionInterface = 0x4000,
73  TableInterface = 0x8000,
74  TextInterface = 0x10000,
75  ValueInterface = 0x20000,
76  SocketInterface = 0x40000,
77  EventWindowInterface = 0x80000,
78  EventFocusInterface = 0x100000,
79 
80  InvalidInterface = 0x80000000
81  };
82  Q_DECLARE_FLAGS(Interfaces, Interface)
83 
84 
88  enum Role {
90  CheckBox,
91  CheckableMenuItem,
92  ColumnHeader,
93  ComboBox,
94  DesktopFrame,
95  Dial,
96  Dialog,
97  Filler,
98  Frame,
99  Icon,
100  Label,
101  ListView,
102  ListItem,
103  Menu,
104  MenuBar,
105  MenuItem,
106  Tab,
107  TabContainer,
108  PasswordText,
109  PopupMenu,
110  ProgressBar,
111  Button,
112  RadioButton,
113  RadioMenuItem,
114  RowHeader,
115  ScrollBar,
116  ScrollArea,
117  Separator,
118  Slider,
119  SpinButton,
120  StatusBar,
121  TableView,
122  TableCell,
123  TableColumnHeader,
124  TableColumn,
125  TableRowHeader,
126  TableRow,
127  Terminal,
128  Text,
129  ToggleButton,
130  ToolBar,
131  ToolTip,
132  TreeView,
133  Window,
134  TreeItem
135 // Roles in Qt, I don't think we want those
136 // TitleBar = 0x00000001,
137 // Grip = 0x00000004,
138 // Sound = 0x00000005,
139 // Cursor = 0x00000006,
140 // Caret = 0x00000007,
141 // AlertMessage = 0x00000008,
142 // Client = 0x0000000A,
143 // Application = 0x0000000E,
144 // Document = 0x0000000F,
145 // Pane = 0x00000010,
146 // Chart = 0x00000011,
147 // Border = 0x00000013,
148 // Grouping = 0x00000014,
149 // Cell = 0x0000001D,
150 // Link = 0x0000001E,
151 // HelpBalloon = 0x0000001F,
152 // Assistant = 0x00000020,
153 // PageTab = 0x00000025,
154 // PropertyPage = 0x00000026,
155 // Indicator = 0x00000027,
156 // Graphic = 0x00000028,
157 // StaticText = 0x00000029,
158 // EditableText = 0x0000002A, // Editable, selectable, etc.
159 // HotkeyField = 0x00000032,
160 // SpinBox = 0x00000034,
161 // Canvas = 0x00000035,
162 // Animation = 0x00000036,
163 // Equation = 0x00000037,
164 // ButtonDropDown = 0x00000038,
165 // ButtonMenu = 0x00000039,
166 // ButtonDropGrid = 0x0000003A,
167 // Whitespace = 0x0000003B,
168 // PageTabList = 0x0000003C,
169 // Clock = 0x0000003D,
170 // Splitter = 0x0000003E,
171 // LayeredPane = 0x00000080,
172  };
173 
179  CharBoundary,
180  WordStartBoundary,
181  WordEndBoundary,
182  SentenceStartBoundary,
183  SentenceEndBoundary,
184  LineStartBoundary,
185  LineEndBoundary
186  };
187 
192 
196  AccessibleObject(const AccessibleObject &other);
197 
201  ~AccessibleObject();
202 
206  AccessibleObject &operator=(const AccessibleObject &other);
210  bool operator==(const AccessibleObject &other) const;
214  inline bool operator!=(const AccessibleObject &other) const {
215  return !operator==(other);
216  }
217 
221  QString id() const;
222 
233  QUrl url() const;
234 
241  bool isValid() const;
242 
247  AccessibleObject parent() const;
248 
253  int indexInParent() const;
254 
259  QList<AccessibleObject> children() const;
260 
276  QVector< QList<AccessibleObject> > children(const QList<Role> &roles) const;
277 
282  int childCount() const;
283 
290  AccessibleObject child(int index) const;
291 
298  QString accessibleId() const;
299 
306  QString name() const;
307 
314  QString description() const;
315 
319  Role role() const;
320 
326  QString roleName() const;
327 
333  QString localizedRoleName() const;
334 
338  int layer() const;
339 
347  int mdiZOrder() const;
348 
360  double alpha() const;
361 
369  QRect boundingRect() const;
370 
379  QRect characterRect(int offset) const;
380 
390  Interfaces supportedInterfaces() const;
391 
400  int caretOffset() const;
401 
407  int characterCount() const;
408 
425  QList< QPair<int,int> > textSelections() const;
426 
431  void setTextSelections(const QList< QPair<int,int> > &selections);
432 
445  QString text(int startOffset = 0, int endOffset = -1) const;
446 
462  QString textWithBoundary(int offset, TextBoundary boundary, int *startOffset = nullptr, int *endOffset = nullptr) const;
463 
470  bool setText(const QString &text);
471 
480  bool insertText(const QString &text, int position = 0, int length = -1);
481 
489  bool copyText(int startPos, int endPos);
490 
498  bool cutText(int startPos, int endPos);
499 
507  bool deleteText(int startPos, int endPos);
508 
515  bool pasteText(int position);
516 
522  QPoint focusPoint() const;
523 
530  AccessibleObject application() const;
531 
538  QString appToolkitName() const;
539 
546  QString appVersion() const;
547 
555  int appId() const;
556 
560  enum LocaleType {
561  LocaleTypeMessages,
562  LocaleTypeCollate,
563  LocaleTypeCType,
564  LocaleTypeMonetary,
565  LocaleTypeNumeric,
566  LocaleTypeTime
567  };
568 
575  QString appLocale(LocaleType lctype = LocaleTypeMessages) const;
576 
580  QString appBusAddress() const;
581 
589  double minimumValue() const;
590 
598  double maximumValue() const;
599 
609  double minimumValueIncrement() const;
610 
616  double currentValue() const;
617 
624  bool setCurrentValue(const double value);
625 
629  QList<AccessibleObject> selection() const;
630 
642  QString imageDescription() const;
643 
650  QString imageLocale() const;
651 
667  QRect imageRect() const;
668 
674  QVector< QSharedPointer<QAction> > actions() const;
675 
676  // states
678  bool isActive() const;
680  bool isCheckable() const;
682  bool isChecked() const;
685  bool isDefunct() const;
687  bool isEditable() const;
689  bool isEnabled() const;
691  bool isExpandable() const;
693  bool isExpanded() const;
695  bool isFocusable() const;
697  bool isFocused() const;
699  bool isMultiLine() const;
701  bool isSelectable() const;
703  bool isSelected() const;
705  bool isSensitive() const;
707  bool isSingleLine() const;
708 
714  QString stateString() const;
715 
716  /*
717  * \internal
718  * \brief isTransient marks an object as being unreliable in that it can quickly disappear or change
719  *
720  * This is mostly a hint that the object should not be cached.
721  * \return true if the object is transient
722  */
723 // bool isTransient() const;
724 
727  bool isVisible() const;
728 
729  /*
730  * \internal
731  * \brief managesDescendants marks an object as being responsible for its children
732  *
733  * This is to notify that this object handles signals for it's children.
734  * The property is typically used for tables and lists or other collection objects.
735  * \return true if the object is transient
736  */
737 // bool managesDescendants() const;
738 // bool isRequired() const;
739 // bool isAnimated() const;
740 // bool isInvalidEntry() const;
742  bool isDefault() const;
743 // bool isVisited() const;
744 
746  bool hasSelectableText() const;
748  bool hasToolTip() const;
750  bool supportsAutocompletion() const;
751 
752 private:
753  AccessibleObject(RegistryPrivate *reg, const QString &service, const QString &path);
756 
757  friend class Registry;
758  friend class RegistryPrivate;
759  friend class CacheWeakStrategy;
760  friend class CacheStrongStrategy;
761 #ifndef QT_NO_DEBUG_STREAM
762  friend QDebug QAccessibleClient::operator<<(QDebug, const AccessibleObject &);
763 #endif
764  friend uint qHash(const QAccessibleClient::AccessibleObject& object) {
765  return qHash(object.d);
766  }
767 };
768 
769 }
770 
771 Q_DECLARE_METATYPE(QAccessibleClient::AccessibleObject)
772 
773 #endif
This class represents the global accessibility registry.
Definition: registry.h:29
This class represents an accessible object.
TextBoundary
The TextBoundaries enum represents the different boundaries when asking for text at a certain offset...
bool operator!=(const AccessibleObject &other) const
Inequality operator.
Interface
This enum describes the different interfaces that an AccessibleObject can implement.
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Role
The role indicates the type of UI element that an AccessibleObject represents.
Label
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:07:16 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.