|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the plugins of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qaccessiblecompat.h" |
|
43 #include "q3simplewidgets.h" |
|
44 #include "q3complexwidgets.h" |
|
45 |
|
46 #include <qaccessibleplugin.h> |
|
47 #include <qplugin.h> |
|
48 #include <qstringlist.h> |
|
49 #include <q3toolbar.h> |
|
50 |
|
51 QT_BEGIN_NAMESPACE |
|
52 |
|
53 class CompatAccessibleFactory : public QAccessiblePlugin |
|
54 { |
|
55 public: |
|
56 CompatAccessibleFactory(); |
|
57 |
|
58 QStringList keys() const; |
|
59 QAccessibleInterface *create(const QString &classname, QObject *object); |
|
60 }; |
|
61 |
|
62 CompatAccessibleFactory::CompatAccessibleFactory() |
|
63 { |
|
64 } |
|
65 |
|
66 QStringList CompatAccessibleFactory::keys() const |
|
67 { |
|
68 QStringList list; |
|
69 list << QLatin1String("Q3TextEdit"); |
|
70 list << QLatin1String("Q3IconView"); |
|
71 list << QLatin1String("Q3ListView"); |
|
72 list << QLatin1String("Q3WidgetStack"); |
|
73 list << QLatin1String("Q3GroupBox"); |
|
74 list << QLatin1String("Q3ToolBar"); |
|
75 list << QLatin1String("Q3ToolBarSeparator"); |
|
76 list << QLatin1String("Q3DockWindowHandle"); |
|
77 list << QLatin1String("Q3DockWindowResizeHandle"); |
|
78 list << QLatin1String("Q3MainWindow"); |
|
79 list << QLatin1String("Q3Header"); |
|
80 list << QLatin1String("Q3ListBox"); |
|
81 list << QLatin1String("Q3Table"); |
|
82 list << QLatin1String("Q3TitleBar"); |
|
83 |
|
84 return list; |
|
85 } |
|
86 |
|
87 QAccessibleInterface *CompatAccessibleFactory::create(const QString &classname, QObject *object) |
|
88 { |
|
89 QAccessibleInterface *iface = 0; |
|
90 if (!object || !object->isWidgetType()) |
|
91 return iface; |
|
92 QWidget *widget = static_cast<QWidget*>(object); |
|
93 |
|
94 if (classname == QLatin1String("Q3TextEdit")) { |
|
95 iface = new Q3AccessibleTextEdit(widget); |
|
96 } else if (classname == QLatin1String("Q3IconView")) { |
|
97 iface = new QAccessibleIconView(widget); |
|
98 } else if (classname == QLatin1String("Q3ListView")) { |
|
99 iface = new QAccessibleListView(widget); |
|
100 } else if (classname == QLatin1String("Q3WidgetStack")) { |
|
101 iface = new QAccessibleWidgetStack(widget); |
|
102 } else if (classname == QLatin1String("Q3ListBox")) { |
|
103 iface = new QAccessibleListBox(widget); |
|
104 } else if (classname == QLatin1String("Q3Table")) { |
|
105 iface = new Q3AccessibleScrollView(widget, Table); |
|
106 } else if (classname == QLatin1String("Q3GroupBox")) { |
|
107 iface = new Q3AccessibleDisplay(widget, Grouping); |
|
108 } else if (classname == QLatin1String("Q3ToolBar")) { |
|
109 iface = new QAccessibleWidget(widget, ToolBar, static_cast<Q3ToolBar *>(widget)->label()); |
|
110 } else if (classname == QLatin1String("Q3MainWindow")) { |
|
111 iface = new QAccessibleWidget(widget, Application); |
|
112 } else if (classname == QLatin1String("Q3ToolBarSeparator")) { |
|
113 iface = new QAccessibleWidget(widget, Separator); |
|
114 } else if (classname == QLatin1String("Q3DockWindowHandle")) { |
|
115 iface = new QAccessibleWidget(widget, Grip); |
|
116 } else if (classname == QLatin1String("Q3DockWindowResizeHandle")) { |
|
117 iface = new QAccessibleWidget(widget, Grip); |
|
118 } else if (classname == QLatin1String("Q3Header")) { |
|
119 iface = new Q3AccessibleHeader(widget); |
|
120 } else if (classname == QLatin1String("Q3TitleBar")) { |
|
121 iface = new Q3AccessibleTitleBar(widget); |
|
122 } |
|
123 |
|
124 return iface; |
|
125 } |
|
126 |
|
127 Q_EXPORT_STATIC_PLUGIN(CompatAccessibleFactory) |
|
128 Q_EXPORT_PLUGIN2(qtaccessiblecompatwidgets, CompatAccessibleFactory) |
|
129 |
|
130 QT_END_NAMESPACE |