summaryrefslogtreecommitdiffstats
path: root/plugins/src/accessible/widgets/main.cpp
blob: e63219240832191ebe6688687ede9e73bd03851a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#include "qaccessiblewidget.h"
#include "qaccessiblemenu.h"

#include <ntqtoolbutton.h>
#include <ntqtoolbar.h>
#include <ntqvariant.h>

class AccessibleFactory : public TQAccessibleFactoryInterface, public TQLibraryInterface
{
public:
    AccessibleFactory();

    TQRESULT queryInterface( const TQUuid &, TQUnknownInterface **iface );
    Q_REFCOUNT

    TQStringList featureList() const;
    TQRESULT createAccessibleInterface( const TQString &classname, TQObject *object, TQAccessibleInterface **iface );

    bool init();
    void cleanup();
    bool canUnload() const;
};

AccessibleFactory::AccessibleFactory()
{
}

TQRESULT AccessibleFactory::queryInterface( const TQUuid &iid, TQUnknownInterface **iface )
{
    *iface = 0;
    if ( iid == IID_QUnknown )
	*iface = (TQUnknownInterface*)(TQFeatureListInterface*)(TQAccessibleFactoryInterface*)this;
    else if ( iid == IID_QFeatureList )
	*iface = (TQFeatureListInterface*)this;
    else if ( iid == IID_QAccessibleFactory )
	*iface = (TQAccessibleFactoryInterface*)this;
    else if ( iid == IID_QLibrary )
	*iface = (TQLibraryInterface*)this;
    else
	return TQE_NOINTERFACE;

    (*iface)->addRef();
    return TQS_OK;
}

TQStringList AccessibleFactory::featureList() const
{
    TQStringList list;
    list << "TQLineEdit";
    list << "TQComboBox";
    list << "TQSpinBox";
    list << "TQSpinWidget";
    list << "TQDial";
    list << "TQScrollBar";
    list << "TQSlider";
    list << "TQToolButton";
    list << "TQCheckBox";
    list << "TQRadioButton";
    list << "TQButton";
    list << "TQViewportWidget";
    list << "TQClipperWidget";
    list << "TQTextEdit";
#ifndef QT_NO_ICONVIEW
    list << "TQIconView";
#endif
    list << "TQListView";
    list << "TQListBox";
    list << "TQTable";
    list << "TQDialog";
    list << "TQMessageBox";
    list << "TQMainWindow";
    list << "TQLabel";
    list << "TQGroupBox";
    list << "TQStatusBar";
    list << "TQProgressBar";
    list << "TQToolBar";
    list << "TQMenuBar";
    list << "TQPopupMenu";
    list << "TQHeader";
    list << "TQTabBar";
    list << "TQTitleBar";
    list << "TQWorkspaceChild";
    list << "TQSizeGrip";
    list << "TQSplitterHandle";
    list << "TQToolBarSeparator";
    list << "TQDockWindowHandle";
    list << "TQDockWindowResizeHandle";
    list << "TQTipLabel";
    list << "TQFrame";
    list << "TQWidgetStack";
    list << "TQWidget";
    list << "TQScrollView";

    return list;
}

TQRESULT AccessibleFactory::createAccessibleInterface( const TQString &classname, TQObject *object, TQAccessibleInterface **iface )
{
    *iface = 0;

    if ( classname == "TQLineEdit" ) {
	*iface = new TQAccessibleText( object, EditableText );
    } else if ( classname == "TQComboBox" ) {
	*iface = new TQAccessibleComboBox( object );
    } else if ( classname == "TQSpinBox" ) {
	*iface = new TQAccessibleRangeControl( object, SpinBox );
    } else if ( classname == "TQSpinWidget" ) {
	*iface = new TQAccessibleSpinWidget( object );
    } else if ( classname == "TQDial" ) {
	*iface = new TQAccessibleRangeControl( object, Dial );
    } else if ( classname == "TQScrollBar" ) {
	*iface = new TQAccessibleScrollBar( object );
    } else if ( classname == "TQSlider" ) {
	*iface = new TQAccessibleSlider( object );
    } else if ( classname == "TQToolButton" ) {
	TQToolButton *tb = (TQToolButton*)object;
	if ( !tb->popup() )
	    *iface = new TQAccessibleButton( object, PushButton );
	else if ( !tb->popupDelay() )
	    *iface = new TQAccessibleButton( object, ButtonDropDown );
	else
	    *iface = new TQAccessibleButton( object, ButtonMenu );
    } else if ( classname == "TQCheckBox" ) {
	*iface = new TQAccessibleButton( object, CheckBox );
    } else if ( classname == "TQRadioButton" ) {
	*iface = new TQAccessibleButton( object, RadioButton );
    } else if ( classname == "TQButton" ) {
	*iface = new TQAccessibleButton( object, PushButton );
    } else if ( classname == "TQViewportWidget" ) {
	*iface = new TQAccessibleViewport( object, object->parent() );
    } else if ( classname == "TQClipperWidget" ) {
	*iface = new TQAccessibleViewport( object, object->parent()->parent() );
    } else if ( classname == "TQTextEdit" ) {
	*iface = new TQAccessibleTextEdit( object );
#ifndef QT_NO_ICONVIEW
    } else if ( classname == "TQIconView" ) {
	*iface = new TQAccessibleIconView( object );
#endif
    } else if ( classname == "TQListView" ) {
	*iface = new TQAccessibleListView( object );
    } else if ( classname == "TQListBox" ) {
	*iface = new TQAccessibleListBox( object );
    } else if ( classname == "TQTable" ) {
	*iface = new TQAccessibleScrollView( object, Table );
    } else if ( classname == "TQDialog" ) {
	*iface = new TQAccessibleWidget( object, Dialog );
    } else if ( classname == "TQMessageBox" ) {
	*iface = new TQAccessibleWidget( object, AlertMessage );
    } else if ( classname == "TQMainWindow" ) {
	*iface = new TQAccessibleWidget( object, Application );
    } else if ( classname == "TQLabel" || classname == "TQLCDNumber" ) {
	*iface = new TQAccessibleDisplay( object, StaticText );
    } else if ( classname == "TQGroupBox" ) {
	*iface = new TQAccessibleDisplay( object, Grouping );
    } else if ( classname == "TQStatusBar" ) {
	*iface = new TQAccessibleWidget( object, StatusBar );
    } else if ( classname == "TQProgressBar" ) {
	*iface = new TQAccessibleRangeControl( object, ProgressBar );
    } else if ( classname == "TQToolBar" ) {
	TQToolBar *tb = (TQToolBar*)object;
	*iface = new TQAccessibleWidget( object, ToolBar, tb->label() );
    } else if ( classname == "TQMenuBar" ) {
	*iface = new TQAccessibleMenuBar( object );
    } else if ( classname == "TQPopupMenu" ) {
	*iface = new TQAccessiblePopup( object );
    } else if ( classname == "TQHeader" ) {
	*iface = new TQAccessibleHeader( object );
    } else if ( classname == "TQTabBar" ) {
	*iface = new TQAccessibleTabBar( object );
    } else if ( classname == "TQTitleBar" ) {
	*iface = new TQAccessibleTitleBar( object );
    } else if ( classname == "TQWorkspaceChild" ) {
	*iface = new TQAccessibleWidget( object, Window );
    } else if ( classname == "TQSizeGrip" ) {
	*iface = new TQAccessibleWidget( object, Grip );
    } else if ( classname == "TQSplitterHandle" ) {
	*iface = new TQAccessibleWidget( object, Separator, TQString::null, 
					TQString::null, TQString::null, TQString::null, 
					TQString::null, TQString::null, TQAccessible::Moveable );
    } else if ( classname == "TQToolBarSeparator" ) {
	*iface = new TQAccessibleWidget( object, TQAccessible::Separator, TQString::null, 
					TQString::null, TQString::null, TQString::null, 
					TQString::null, TQString::null, TQAccessible::Unavailable );
    } else if ( classname == "TQDockWindowHandle" ) {
	*iface = new TQAccessibleWidget( object, TQAccessible::Grip, object->property( "caption" ).toString(),
					TQString::null, TQString::null, TQString::null,
					TQString::null, TQString::null, TQAccessible::Moveable );
    } else if ( classname == "TQDockWindowResizeHandle" ) {
	*iface = new TQAccessibleWidget( object, TQAccessible::Separator, TQString::null,
					TQString::null, TQString::null, TQString::null,
					TQString::null, TQString::null, TQAccessible::Moveable );
    } else if ( classname == "TQTipLabel" ) {
	*iface = new TQAccessibleWidget( object, ToolTip );
    } else if ( classname == "TQFrame" ) {
	*iface = new TQAccessibleWidget( object, Border );
    } else if ( classname == "TQWidgetStack" ) {
	*iface = new TQAccessibleWidgetStack( object );
    } else if ( classname == "TQWidget" ) {
	*iface = new TQAccessibleWidget( object );
    } else if ( classname == "TQScrollView" ) {
        *iface = new TQAccessibleScrollView( object, Client );
    } else
	return TQE_NOINTERFACE;

    (*iface)->addRef();
    return TQS_OK;
}

bool AccessibleFactory::init()
{
    return TRUE;
}

void AccessibleFactory::cleanup()
{
}

bool AccessibleFactory::canUnload() const
{
    return (TQAccessibleWidget::objects == 0);
}

Q_EXPORT_COMPONENT()
{
    Q_CREATE_INSTANCE( AccessibleFactory )
}