File indexing completed on 2024-12-22 04:18:20

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef WIDGETS_H
0014 #define WIDGETS_H
0015 
0016 #include <QObject>
0017 #include <QDesignerCustomWidgetInterface>
0018 
0019 #include <QtPlugin>
0020 
0021 #include "colorbutton.h"
0022 #include "gradienteditor.h"
0023 #include "filerequester.h"
0024 #include "combobox.h"
0025 #include "datarange.h"
0026 #include "curveselector.h"
0027 #include "vectorselector.h"
0028 #include "matrixselector.h"
0029 #include "scalarselector.h"
0030 #include "stringselector.h"
0031 #include "curveappearance.h"
0032 #include "curveplacement.h"
0033 #include "fftoptions.h"
0034 #include "colorpalette.h"
0035 #include "datasourceselector.h"
0036 #include "labelbuilder.h"
0037 #include "labellineedit.h"
0038 
0039 #ifndef QNX // Qt for QNX doesn't include the designer interfaces by default
0040 
0041 namespace Kst {
0042 class Widgets : public QObject, public QDesignerCustomWidgetCollectionInterface {
0043   Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
0044   Q_OBJECT
0045   public:
0046     explicit Widgets(QObject *parent = 0);
0047     virtual ~Widgets();
0048     QList<QDesignerCustomWidgetInterface*> customWidgets() const {
0049       return _plugins;
0050     }
0051 
0052   private:
0053     QList<QDesignerCustomWidgetInterface*> _plugins;
0054 };
0055 
0056 class WidgetPlugin : public QObject, public QDesignerCustomWidgetInterface {
0057   Q_OBJECT
0058 
0059   public:
0060     explicit WidgetPlugin(QObject *parent = 0);
0061     virtual ~WidgetPlugin();
0062 
0063     QString group() const;
0064     QString toolTip() const;
0065     QString whatsThis() const;
0066     QString instanceName() const;
0067     QString includeFile() const;
0068     QString domXml() const;
0069     bool isContainer() const;
0070     bool isInitialized() const;
0071     QIcon icon() const;
0072     void initialize(QDesignerFormEditorInterface *);
0073 
0074   private:
0075     bool _initialized;
0076 };
0077 
0078 class ColorButtonPlugin : public WidgetPlugin {
0079   Q_OBJECT
0080   Q_INTERFACES(QDesignerCustomWidgetInterface)
0081   public:
0082     explicit ColorButtonPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0083     QString name() const {
0084       return QLatin1String("ColorButton");
0085     } //do not translate
0086     QWidget *createWidget(QWidget *parent) {
0087       return new ColorButton(parent);
0088     }
0089 };
0090 
0091 class DataSourceSelectorPlugin : public WidgetPlugin {
0092   Q_OBJECT
0093   Q_INTERFACES(QDesignerCustomWidgetInterface)
0094   public:
0095     explicit DataSourceSelectorPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0096     QString name() const {
0097       return QLatin1String("DataSourceSelector");
0098     } //do not translate
0099     QWidget *createWidget(QWidget *parent) {
0100       return new DataSourceSelector(parent);
0101     }
0102 };
0103 
0104 class GradientEditorPlugin : public WidgetPlugin {
0105   Q_OBJECT
0106   Q_INTERFACES(QDesignerCustomWidgetInterface)
0107   public:
0108     explicit GradientEditorPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0109     QString name() const {
0110       return QLatin1String("GradientEditor");
0111     } //do not translate
0112     QWidget *createWidget(QWidget *parent) {
0113       return new GradientEditor(parent);
0114     }
0115 };
0116 
0117 class FileRequesterPlugin : public WidgetPlugin {
0118   Q_OBJECT
0119   Q_INTERFACES(QDesignerCustomWidgetInterface)
0120   public:
0121     explicit FileRequesterPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0122     QString name() const {
0123       return QLatin1String("FileRequester");
0124     } //do not translate
0125     QWidget *createWidget(QWidget *parent) {
0126       return new FileRequester(parent);
0127     }
0128 };
0129 
0130 class ComboBoxPlugin : public WidgetPlugin {
0131   Q_OBJECT
0132   Q_INTERFACES(QDesignerCustomWidgetInterface)
0133   public:
0134     explicit ComboBoxPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0135     QString name() const {
0136       return QLatin1String("ComboBox");
0137     } //do not translate
0138     QWidget *createWidget(QWidget *parent) {
0139       return new ComboBox(parent);
0140     }
0141 };
0142 
0143 class DataRangePlugin : public WidgetPlugin {
0144   Q_OBJECT
0145   Q_INTERFACES(QDesignerCustomWidgetInterface)
0146   public:
0147     explicit DataRangePlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0148     QString name() const {
0149       return QLatin1String("DataRange");
0150     } //do not translate
0151     QWidget *createWidget(QWidget *parent) {
0152       return new DataRange(parent);
0153     }
0154 };
0155 
0156 class CurveSelectorPlugin : public WidgetPlugin {
0157   Q_OBJECT
0158   Q_INTERFACES(QDesignerCustomWidgetInterface)
0159   public:
0160     explicit CurveSelectorPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0161     QString name() const {
0162       return QLatin1String("CurveSelector");
0163     } //do not translate
0164     QWidget *createWidget(QWidget *parent) {
0165       return new CurveSelector(parent);
0166     }
0167 };
0168 
0169 class VectorSelectorPlugin : public WidgetPlugin {
0170   Q_OBJECT
0171   Q_INTERFACES(QDesignerCustomWidgetInterface)
0172   public:
0173     explicit VectorSelectorPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0174     QString name() const {
0175       return QLatin1String("VectorSelector");
0176     } //do not translate
0177     QWidget *createWidget(QWidget *parent) {
0178       return new VectorSelector(parent);
0179     }
0180 };
0181 
0182 class MatrixSelectorPlugin : public WidgetPlugin {
0183   Q_OBJECT
0184   Q_INTERFACES(QDesignerCustomWidgetInterface)
0185   public:
0186     explicit MatrixSelectorPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0187     QString name() const {
0188       return QLatin1String("MatrixSelector");
0189     } //do not translate
0190     QWidget *createWidget(QWidget *parent) {
0191       return new MatrixSelector(parent);
0192     }
0193 };
0194 
0195 class ScalarSelectorPlugin : public WidgetPlugin {
0196   Q_OBJECT
0197   Q_INTERFACES(QDesignerCustomWidgetInterface)
0198   public:
0199     explicit ScalarSelectorPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0200     QString name() const {
0201       return QLatin1String("ScalarSelector");
0202     } //do not translate
0203     QWidget *createWidget(QWidget *parent) {
0204       return new ScalarSelector(parent);
0205     }
0206 };
0207 
0208 class StringSelectorPlugin : public WidgetPlugin {
0209   Q_OBJECT
0210   Q_INTERFACES(QDesignerCustomWidgetInterface)
0211   public:
0212     explicit StringSelectorPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0213     QString name() const {
0214       return QLatin1String("StringSelector");
0215     } //do not translate
0216     QWidget *createWidget(QWidget *parent) {
0217       return new StringSelector(parent);
0218     }
0219 };
0220 
0221 class CurveAppearancePlugin : public WidgetPlugin {
0222   Q_OBJECT
0223   Q_INTERFACES(QDesignerCustomWidgetInterface)
0224   public:
0225     explicit CurveAppearancePlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0226     QString name() const {
0227       return QLatin1String("CurveAppearance");
0228     } //do not translate
0229     QWidget *createWidget(QWidget *parent) {
0230       return new CurveAppearance(parent);
0231     }
0232 };
0233 
0234 class CurvePlacementPlugin : public WidgetPlugin {
0235   Q_OBJECT
0236   Q_INTERFACES(QDesignerCustomWidgetInterface)
0237   public:
0238     explicit CurvePlacementPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0239     QString name() const {
0240       return QLatin1String("CurvePlacement");
0241     } //do not translate
0242     QWidget *createWidget(QWidget *parent) {
0243       return new CurvePlacement(parent);
0244     }
0245 };
0246 
0247 class FFTOptionsPlugin : public WidgetPlugin {
0248   Q_OBJECT
0249   Q_INTERFACES(QDesignerCustomWidgetInterface)
0250   public:
0251     explicit FFTOptionsPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0252     QString name() const {
0253       return QLatin1String("FFTOptions");
0254     } //do not translate
0255     QWidget *createWidget(QWidget *parent) {
0256       return new FFTOptions(parent);
0257     }
0258 };
0259 
0260 
0261 class ColorPalettePlugin : public WidgetPlugin {
0262   Q_OBJECT
0263   Q_INTERFACES(QDesignerCustomWidgetInterface)
0264   public:
0265     explicit ColorPalettePlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0266     QString name() const {
0267       return QLatin1String("ColorPalette");
0268     } //do not translate
0269     QWidget *createWidget(QWidget *parent) {
0270       return new ColorPalette(parent);
0271     }
0272 };
0273 
0274 class LabelBuilderPlugin : public WidgetPlugin {
0275   Q_OBJECT
0276   Q_INTERFACES(QDesignerCustomWidgetInterface)
0277   public:
0278     explicit LabelBuilderPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0279     QString name() const {
0280       return QLatin1String("LabelBuilder");
0281     } //do not translate
0282     QWidget *createWidget(QWidget *parent) {
0283       return new LabelBuilder(parent);
0284     }
0285 };
0286 
0287 class LabelLineEditPlugin : public WidgetPlugin {
0288   Q_OBJECT
0289   Q_INTERFACES(QDesignerCustomWidgetInterface)
0290   public:
0291     explicit LabelLineEditPlugin(QObject *parent = 0) : WidgetPlugin(parent) {}
0292     QString name() const {
0293       return QLatin1String("LabelLineEdit");
0294     } //do not translate
0295     QWidget *createWidget(QWidget *parent) {
0296       return new LabelLineEdit(parent);
0297     }
0298 };
0299 
0300 }
0301 
0302 #endif // __QNX__
0303 
0304 #endif
0305 
0306 // vim: ts=2 sw=2 et