source: trunk/src/plugins/accessible/compat/main.cpp@ 352

Last change on this file since 352 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 5.1 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the plugins of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
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
51QT_BEGIN_NAMESPACE
52
53class CompatAccessibleFactory : public QAccessiblePlugin
54{
55public:
56 CompatAccessibleFactory();
57
58 QStringList keys() const;
59 QAccessibleInterface *create(const QString &classname, QObject *object);
60};
61
62CompatAccessibleFactory::CompatAccessibleFactory()
63{
64}
65
66QStringList 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
87QAccessibleInterface *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
127Q_EXPORT_STATIC_PLUGIN(CompatAccessibleFactory)
128Q_EXPORT_PLUGIN2(qtaccessiblecompatwidgets, CompatAccessibleFactory)
129
130QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.