Qt Accessibility Client

accessibleobject.h
1 /*
2  Copyright 2012 Frederik Gladhorn <[email protected]>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) version 3, or any
8  later version accepted by the membership of KDE e.V. (or its
9  successor approved by the membership of KDE e.V.), which shall
10  act as a proxy defined in Section 6 of version 3 of the license.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef QACCESSIBILITYCLIENT_ACCESSIBLEOBJECT_H
22 #define QACCESSIBILITYCLIENT_ACCESSIBLEOBJECT_H
23 
24 #include <QtGlobal>
25 
26 namespace QAccessibleClient {
27  class AccessibleObject;
28 }
29 
30 #include <qlist.h>
31 #include <QSharedPointer>
32 #include <qaction.h>
33 
34 #include "qaccessibilityclient_export.h"
35 
36 namespace QAccessibleClient {
37 
38 class AccessibleObjectPrivate;
39 class RegistryPrivate;
40 
41 
42 #ifndef QT_NO_DEBUG_STREAM
43  QACCESSIBILITYCLIENT_EXPORT QDebug operator<<(QDebug, const AccessibleObject &);
44 #endif
45 
56 class QACCESSIBILITYCLIENT_EXPORT AccessibleObject
57 {
58 public:
59 
70  enum Interface {
71  NoInterface = 0x0,
72  AccessibleInterface = 0x1,
73  CacheInterface = 0x2,
74  ActionInterface = 0x4,
75  ApplicationInterface = 0x8,
76  CollectionInterface = 0x10,
77  ComponentInterface = 0x20,
78  DocumentInterface = 0x40,
79  EditableTextInterface = 0x80,
80  EventKeyboardInterface = 0x100,
81  EventMouseInterface = 0x200,
82  EventObjectInterface = 0x400,
83  HyperlinkInterface = 0x800,
84  HypertextInterface = 0x1000,
85  ImageInterface = 0x2000,
86  SelectionInterface = 0x4000,
87  TableInterface = 0x8000,
88  TextInterface = 0x10000,
89  ValueInterface = 0x20000,
90  SocketInterface = 0x40000,
91  EventWindowInterface = 0x80000,
92  EventFocusInterface = 0x100000,
93 
94  InvalidInterface = 0x80000000
95  };
96  Q_DECLARE_FLAGS(Interfaces, Interface)
97 
98 
102  enum Role {
104  CheckBox,
105  CheckableMenuItem,
106  ColumnHeader,
107  ComboBox,
108  DesktopFrame,
109  Dial,
110  Dialog,
111  Filler,
112  Frame,
113  Icon,
114  Label,
115  ListView,
116  ListItem,
117  Menu,
118  MenuBar,
119  MenuItem,
120  Tab,
121  TabContainer,
122  PasswordText,
123  PopupMenu,
124  ProgressBar,
125  Button,
126  RadioButton,
127  RadioMenuItem,
128  RowHeader,
129  ScrollBar,
130  ScrollArea,
131  Separator,
132  Slider,
133  SpinButton,
134  StatusBar,
135  TableView,
136  TableCell,
137  TableColumnHeader,
138  TableColumn,
139  TableRowHeader,
140  TableRow,
141  Terminal,
142  Text,
143  ToggleButton,
144  ToolBar,
145  ToolTip,
146  TreeView,
147  Window,
148  TreeItem
149 // Roles in Qt, I don't think we want those
150 // TitleBar = 0x00000001,
151 // Grip = 0x00000004,
152 // Sound = 0x00000005,
153 // Cursor = 0x00000006,
154 // Caret = 0x00000007,
155 // AlertMessage = 0x00000008,
156 // Client = 0x0000000A,
157 // Application = 0x0000000E,
158 // Document = 0x0000000F,
159 // Pane = 0x00000010,
160 // Chart = 0x00000011,
161 // Border = 0x00000013,
162 // Grouping = 0x00000014,
163 // Cell = 0x0000001D,
164 // Link = 0x0000001E,
165 // HelpBalloon = 0x0000001F,
166 // Assistant = 0x00000020,
167 // PageTab = 0x00000025,
168 // PropertyPage = 0x00000026,
169 // Indicator = 0x00000027,
170 // Graphic = 0x00000028,
171 // StaticText = 0x00000029,
172 // EditableText = 0x0000002A, // Editable, selectable, etc.
173 // HotkeyField = 0x00000032,
174 // SpinBox = 0x00000034,
175 // Canvas = 0x00000035,
176 // Animation = 0x00000036,
177 // Equation = 0x00000037,
178 // ButtonDropDown = 0x00000038,
179 // ButtonMenu = 0x00000039,
180 // ButtonDropGrid = 0x0000003A,
181 // Whitespace = 0x0000003B,
182 // PageTabList = 0x0000003C,
183 // Clock = 0x0000003D,
184 // Splitter = 0x0000003E,
185 // LayeredPane = 0x00000080,
186  };
187 
193  CharBoundary,
194  WordStartBoundary,
195  WordEndBoundary,
196  SentenceStartBoundary,
197  SentenceEndBoundary,
198  LineStartBoundary,
199  LineEndBoundary
200  };
201 
206 
210  AccessibleObject(const AccessibleObject &other);
211 
215  ~AccessibleObject();
216 
220  AccessibleObject &operator=(const AccessibleObject &other);
224  bool operator==(const AccessibleObject &other) const;
228  inline bool operator!=(const AccessibleObject &other) const {
229  return !operator==(other);
230  }
231 
235  QString id() const;
236 
247  QUrl url() const;
248 
255  bool isValid() const;
256 
261  AccessibleObject parent() const;
262 
267  int indexInParent() const;
268 
273  QList<AccessibleObject> children() const;
274 
290  QVector< QList<AccessibleObject> > children(const QList<Role> &roles) const;
291 
296  int childCount() const;
297 
304  AccessibleObject child(int index) const;
305 
312  QString name() const;
313 
320  QString description() const;
321 
325  Role role() const;
326 
332  QString roleName() const;
333 
339  QString localizedRoleName() const;
340 
344  int layer() const;
345 
353  int mdiZOrder() const;
354 
366  double alpha() const;
367 
375  QRect boundingRect() const;
376 
385  QRect characterRect(int offset) const;
386 
396  Interfaces supportedInterfaces() const;
397 
406  int caretOffset() const;
407 
413  int characterCount() const;
414 
431  QList< QPair<int,int> > textSelections() const;
432 
437  void setTextSelections(const QList< QPair<int,int> > &selections);
438 
451  QString text(int startOffset = 0, int endOffset = -1) const;
452 
468  QString textWithBoundary(int offset, TextBoundary boundary, int *startOffset = nullptr, int *endOffset = nullptr) const;
469 
476  bool setText(const QString &text);
477 
486  bool insertText(const QString &text, int position = 0, int length = -1);
487 
495  bool copyText(int startPos, int endPos);
496 
504  bool cutText(int startPos, int endPos);
505 
513  bool deleteText(int startPos, int endPos);
514 
521  bool pasteText(int position);
522 
528  QPoint focusPoint() const;
529 
536  AccessibleObject application() const;
537 
544  QString appToolkitName() const;
545 
552  QString appVersion() const;
553 
561  int appId() const;
562 
566  enum LocaleType {
567  LocaleTypeMessages,
568  LocaleTypeCollate,
569  LocaleTypeCType,
570  LocaleTypeMonetary,
571  LocaleTypeNumeric,
572  LocaleTypeTime
573  };
574 
581  QString appLocale(LocaleType lctype = LocaleTypeMessages) const;
582 
586  QString appBusAddress() const;
587 
595  double minimumValue() const;
596 
604  double maximumValue() const;
605 
615  double minimumValueIncrement() const;
616 
622  double currentValue() const;
623 
630  bool setCurrentValue(const double value);
631 
635  QList<AccessibleObject> selection() const;
636 
648  QString imageDescription() const;
649 
656  QString imageLocale() const;
657 
673  QRect imageRect() const;
674 
680  QVector< QSharedPointer<QAction> > actions() const;
681 
682  // states
684  bool isActive() const;
686  bool isCheckable() const;
688  bool isChecked() const;
691  bool isDefunct() const;
693  bool isEditable() const;
695  bool isEnabled() const;
697  bool isExpandable() const;
699  bool isExpanded() const;
701  bool isFocusable() const;
703  bool isFocused() const;
705  bool isMultiLine() const;
707  bool isSelectable() const;
709  bool isSelected() const;
711  bool isSensitive() const;
713  bool isSingleLine() const;
714 
720  QString stateString() const;
721 
722  /*
723  * \internal
724  * \brief isTransient marks an object as being unreliable in that it can quickly disappear or change
725  *
726  * This is mostly a hint that the object should not be cached.
727  * \return true if the object is transient
728  */
729 // bool isTransient() const;
730 
733  bool isVisible() const;
734 
735  /*
736  * \internal
737  * \brief managesDescendants marks an object as being responsible for its children
738  *
739  * This is to notify that this object handles signals for it's children.
740  * The property is typically used for tables and lists or other collection objects.
741  * \return true if the object is transient
742  */
743 // bool managesDescendants() const;
744 // bool isRequired() const;
745 // bool isAnimated() const;
746 // bool isInvalidEntry() const;
748  bool isDefault() const;
749 // bool isVisited() const;
750 
752  bool hasSelectableText() const;
754  bool hasToolTip() const;
756  bool supportsAutocompletion() const;
757 
758 private:
759  AccessibleObject(RegistryPrivate *reg, const QString &service, const QString &path);
762 
763  friend class Registry;
764  friend class RegistryPrivate;
765  friend class CacheWeakStrategy;
766  friend class CacheStrongStrategy;
767 #ifndef QT_NO_DEBUG_STREAM
768  friend QDebug QAccessibleClient::operator<<(QDebug, const AccessibleObject &);
769 #endif
770  friend uint qHash(const QAccessibleClient::AccessibleObject& object) {
771  return qHash(object.d);
772  }
773 };
774 
775 }
776 
777 Q_DECLARE_METATYPE(QAccessibleClient::AccessibleObject)
778 
779 #endif
This class represents the global accessibility registry.
Definition: registry.h:43
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-2020 The KDE developers.
Generated on Sun Aug 2 2020 23:02:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.