Qt Accessibility Client

registry.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_REGISTRY_H
22 #define QACCESSIBILITYCLIENT_REGISTRY_H
23 
24 #include <qobject.h>
25 
26 #include "qaccessibilityclient_export.h"
27 #include "accessibleobject.h"
28 #include <QUrl>
29 
30 #define accessibleRegistry (QAccessibleClient::Registry::instance())
31 
32 namespace QAccessibleClient {
33 
34 class RegistryPrivate;
35 class RegistryPrivateCacheApi;
36 
43 class QACCESSIBILITYCLIENT_EXPORT Registry : public QObject
44 {
45  Q_OBJECT
46 
47 public:
48 
53  NoEventListeners = 0x0,
54  Window = 0x1,
55  Focus = 0x2,
56  //FocusPoint = 0x4,
57 
58  //BoundsChanged = 0x8,
59  //LinkSelected = 0x10,
60  StateChanged = 0x20,
61  ChildrenChanged = 0x40,
62  VisibleDataChanged = 0x80,
63  SelectionChanged = 0x100,
64  ModelChanged = 0x200,
66  TextCaretMoved = 0x400,
67  TextChanged = 0x800,
68  TextSelectionChanged = 0x1000,
69  PropertyChanged = 0x2000,
70  //TextBoundsChanged = 0x2000,
71  //TextAttributesChanged = 0x4000,
72  //AttributesChanged = 0x8000,
73 
74  AllEventListeners = 0xffffffff
75  };
76  Q_ENUM(EventListener)
77  Q_DECLARE_FLAGS(EventListeners, EventListener)
78 
82  explicit Registry(QObject *parent = nullptr);
86  ~Registry() override;
87 
88 public Q_SLOTS:
89 
99  bool isEnabled() const;
104  void setEnabled(bool enable);
105 
113  bool isScreenReaderEnabled() const;
117  void setScreenReaderEnabled(bool enable);
118 
125  void subscribeEventListeners(const EventListeners &listeners) const;
129  EventListeners subscribedEventListeners() const;
130 
135  QList<AccessibleObject> applications() const;
136 
145  AccessibleObject accessibleFromUrl(const QUrl &url) const;
146 
147 Q_SIGNALS:
148 
155  void enabledChanged(bool enabled);
156 
163  void screenReaderEnabledChanged(bool enabled);
164 
171  void added(const QAccessibleClient::AccessibleObject &object);
172 
179  void removed(const QAccessibleClient::AccessibleObject &object);
180 
187  void defunct(const QAccessibleClient::AccessibleObject &object);
188 
190  void windowCreated(const QAccessibleClient::AccessibleObject &object);
192  void windowDestroyed(const QAccessibleClient::AccessibleObject &object);
194  void windowClosed(const QAccessibleClient::AccessibleObject &object);
196  void windowReparented(const QAccessibleClient::AccessibleObject &object);
198  void windowMinimized(const QAccessibleClient::AccessibleObject &object);
200  void windowMaximized(const QAccessibleClient::AccessibleObject &object);
202  void windowRestored(const QAccessibleClient::AccessibleObject &object);
204  void windowActivated(const QAccessibleClient::AccessibleObject &object);
206  void windowDeactivated(const QAccessibleClient::AccessibleObject &object);
208  void windowDesktopCreated(const QAccessibleClient::AccessibleObject &object);
210  void windowDesktopDestroyed(const QAccessibleClient::AccessibleObject &object);
212  void windowRaised(const QAccessibleClient::AccessibleObject &object);
214  void windowLowered(const QAccessibleClient::AccessibleObject &object);
216  void windowMoved(const QAccessibleClient::AccessibleObject &object);
218  void windowResized(const QAccessibleClient::AccessibleObject &object);
220  void windowShaded(const QAccessibleClient::AccessibleObject &object);
222  void windowUnshaded(const QAccessibleClient::AccessibleObject &object);
223 
224  //void boundsChanged(const QAccessibleClient::AccessibleObject &object);
225  //void linkSelected(const QAccessibleClient::AccessibleObject &object);
226 
233  void stateChanged(const QAccessibleClient::AccessibleObject &object, const QString &state, bool active);
234 
244  void childAdded(const QAccessibleClient::AccessibleObject &parent, int childIndex);
245 
252  void childRemoved(const QAccessibleClient::AccessibleObject &parent, int childIndex);
253 
257  void visibleDataChanged(const QAccessibleClient::AccessibleObject &object);
258 
262  void selectionChanged(const QAccessibleClient::AccessibleObject &object);
263 
267  void modelChanged(const QAccessibleClient::AccessibleObject &object);
268 
275  void focusChanged(const QAccessibleClient::AccessibleObject &object);
276 
285  void textCaretMoved(const QAccessibleClient::AccessibleObject &object, int pos);
286 
294  void textSelectionChanged(const QAccessibleClient::AccessibleObject &object);
295 
296 
303  void accessibleNameChanged(const QAccessibleClient::AccessibleObject &object);
304 
311  void accessibleDescriptionChanged(const QAccessibleClient::AccessibleObject &object);
312 
320  void textChanged(const QAccessibleClient::AccessibleObject &object, const QString& text, int startOffset, int endOffset);
321 
329  void textInserted(const QAccessibleClient::AccessibleObject &object, const QString& text, int startOffset, int endOffset);
330 
339  void textRemoved(const QAccessibleClient::AccessibleObject &object, const QString& text, int startOffset, int endOffset);
340 
341  //void textBoundsChanged(const QAccessibleClient::AccessibleObject &object);
342  //void textAttributesChanged(const QAccessibleClient::AccessibleObject &object);
343  //void attributesChanged(const QAccessibleClient::AccessibleObject &object);
344 
345 private:
346  Q_DISABLE_COPY(Registry)
347  RegistryPrivate *d;
348  friend class RegistryPrivate;
349  friend class RegistryPrivateCacheApi;
350 
351  enum CacheType { NoCache, WeakCache};
352  CacheType cacheType() const;
353  void setCacheType(CacheType type);
354  AccessibleObject clientCacheObject(const QString &id) const;
355  QStringList clientCacheObjects() const;
356  void clearClientCache();
357 };
358 
359 Q_DECLARE_OPERATORS_FOR_FLAGS(Registry::EventListeners)
360 
361 }
362 
363 #endif
This class represents the global accessibility registry.
Definition: registry.h:43
This class represents an accessible object.
EventListener
This enum describes the different types of events that can be observed.
Definition: registry.h:52
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 23:02:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.