1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the Qwt License, Version 1.0
8
*****************************************************************************/
10
#if defined(_MSC_VER) /* MSVC Compiler */
11
#pragma warning ( disable : 4786 )
15
#include <qvaluelist.h>
17
#include <qdragobject.h>
19
#include "qwtplugin.h"
20
#include "qwt_text_label.h"
24
#include "qwt_scale_widget.h"
27
#ifndef NO_QWT_WIDGETS
28
#include "qwt_counter.h"
29
#include "qwt_wheel.h"
30
#include "qwt_thermo.h"
32
#include "qwt_slider.h"
33
#include "qwt_analog_clock.h"
34
#include "qwt_compass.h"
42
Entry( QString _classname, QString _header, QString _pixmap,
43
QString _tooltip, QString _whatshis):
44
classname(_classname),
58
QValueList<Entry> vec;
60
const Entry *entry(const QString& str)
62
for ( uint i = 0; i < vec.count(); i++ )
64
if (str == vec[i].classname)
71
QwtPlugin::QwtPlugin()
74
vec.append(Entry("QwtPlot", "qwt_plot.h",
75
"qwtplot.png", "QwtPlot", "whatsthis"));
76
vec.append(Entry("QwtScaleWidget", "qwt_scale_widget.h",
77
"qwtscale.png", "QwtScaleWidget", "whatsthis"));
80
#ifndef NO_QWT_WIDGETS
81
vec.append(Entry("QwtAnalogClock", "qwt_analog_clock.h",
82
"qwtanalogclock.png", "QwtAnalogClock", "whatsthis"));
83
vec.append(Entry("QwtCompass", "qwt_compass.h",
84
"qwtcompass.png", "QwtCompass", "whatsthis"));
85
vec.append(Entry("QwtCounter", "qwt_counter.h",
86
"qwtcounter.png", "QwtCounter", "whatsthis"));
87
vec.append(Entry("QwtDial", "qwt_dial.h",
88
"qwtdial.png", "QwtDial", "whatsthis"));
89
vec.append(Entry("QwtKnob", "qwt_knob.h",
90
"qwtknob.png", "QwtKnob", "whatsthis"));
91
vec.append(Entry("QwtSlider", "qwt_slider.h",
92
"qwtslider.png", "QwtSlider", "whatsthis"));
93
vec.append(Entry("QwtThermo", "qwt_thermo.h",
94
"qwtthermo.png", "QwtThermo", "whatsthis"));
95
vec.append(Entry("QwtWheel", "qwt_wheel.h",
96
"qwtwheel.png", "QwtWheel", "whatsthis"));
99
vec.append(Entry("QwtTextLabel", "qwt_text_label.h",
100
"qwtwidget.png", "QwtTextLabel", "whatsthis"));
104
QWidget* QwtPlugin::create(const QString &key,
105
QWidget* parent, const char* name)
110
if ( key == "QwtPlot" )
111
w = new QwtPlot( parent );
112
else if ( key == "QwtScaleWidget" )
113
w = new QwtScaleWidget( QwtScaleDraw::LeftScale, parent);
116
#ifndef NO_QWT_WIDGETS
117
if ( key == "QwtAnalogClock" )
118
w = new QwtAnalogClock( parent);
119
else if ( key == "QwtCounter" )
120
w = new QwtCounter( parent);
121
else if ( key == "QwtCompass" )
122
w = new QwtCompass( parent);
123
else if ( key == "QwtDial" )
124
w = new QwtDial( parent);
125
else if ( key == "QwtWheel" )
126
w = new QwtWheel( parent);
127
else if ( key == "QwtThermo" )
128
w = new QwtThermo( parent);
129
else if ( key == "QwtKnob" )
130
w = new QwtKnob( parent);
131
else if ( key == "QwtSlider" )
132
w = new QwtSlider( parent);
135
if ( key == "QwtTextLabel" )
136
w = new QwtTextLabel( parent);
144
QStringList QwtPlugin::keys() const
148
for (unsigned i = 0; i < vec.count(); i++)
149
list += vec[i].classname;
154
QString QwtPlugin::group( const QString& feature ) const
156
if (entry(feature) != NULL )
157
return QString("Qwt");
158
return QString::null;
161
QIconSet QwtPlugin::iconSet( const QString& pmap) const
163
QString pixmapKey("qwtwidget.png");
164
if (entry(pmap) != NULL )
165
pixmapKey = entry(pmap)->pixmap;
167
const QMimeSource *ms =
168
QMimeSourceFactory::defaultFactory()->data(pixmapKey);
171
QImageDrag::decode(ms, pixmap);
173
return QIconSet(pixmap);
176
QString QwtPlugin::includeFile( const QString& feature ) const
178
if (entry(feature) != NULL)
179
return entry(feature)->header;
180
return QString::null;
183
QString QwtPlugin::toolTip( const QString& feature ) const
185
if (entry(feature) != NULL )
186
return entry(feature)->tooltip;
187
return QString::null;
190
QString QwtPlugin::whatsThis( const QString& feature ) const
192
if (entry(feature) != NULL)
193
return entry(feature)->whatshis;
194
return QString::null;
197
bool QwtPlugin::isContainer( const QString& ) const
202
Q_EXPORT_PLUGIN( QwtPlugin )