Eneboo - Documentación para desarrolladores
|
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** 00002 * Qwt Widget Library 00003 * Copyright (C) 1997 Josef Wilgen 00004 * Copyright (C) 2002 Uwe Rathmann 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the Qwt License, Version 1.0 00008 *****************************************************************************/ 00009 00010 #ifndef QWT_DESIGNER_PLUGIN_H 00011 #define QWT_DESIGNER_PLUGIN_H 00012 00013 #include <qglobal.h> 00014 00015 #if QT_VERSION < 0x040000 00016 00017 #ifdef __GNUC__ 00018 #error This code is Qt4 only 00019 #endif 00020 00021 #endif 00022 00023 #include <QDesignerCustomWidgetInterface> 00024 #include <QDesignerTaskMenuExtension> 00025 #include <QExtensionFactory> 00026 00027 namespace QwtDesignerPlugin 00028 { 00029 00030 class CustomWidgetInterface: public QObject, 00031 public QDesignerCustomWidgetInterface 00032 { 00033 Q_OBJECT 00034 Q_INTERFACES(QDesignerCustomWidgetInterface) 00035 00036 public: 00037 CustomWidgetInterface(QObject *parent); 00038 00039 virtual bool isContainer() const; 00040 virtual bool isInitialized() const; 00041 virtual QIcon icon() const; 00042 virtual QString codeTemplate() const; 00043 virtual QString domXml() const; 00044 virtual QString group() const; 00045 virtual QString includeFile() const; 00046 virtual QString name() const; 00047 virtual QString toolTip() const; 00048 virtual QString whatsThis() const; 00049 virtual void initialize(QDesignerFormEditorInterface *); 00050 00051 protected: 00052 QString d_name; 00053 QString d_include; 00054 QString d_toolTip; 00055 QString d_whatsThis; 00056 QString d_domXml; 00057 QString d_codeTemplate; 00058 QIcon d_icon; 00059 00060 private: 00061 bool d_isInitialized; 00062 }; 00063 00064 class CustomWidgetCollectionInterface: public QObject, 00065 public QDesignerCustomWidgetCollectionInterface 00066 { 00067 Q_OBJECT 00068 Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) 00069 00070 public: 00071 CustomWidgetCollectionInterface(QObject *parent = NULL); 00072 00073 virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const; 00074 00075 private: 00076 QList<QDesignerCustomWidgetInterface*> d_plugins; 00077 }; 00078 00079 #ifndef NO_QWT_PLOT 00080 class PlotInterface: public CustomWidgetInterface 00081 { 00082 Q_OBJECT 00083 Q_INTERFACES(QDesignerCustomWidgetInterface) 00084 00085 public: 00086 PlotInterface(QObject *parent); 00087 virtual QWidget *createWidget(QWidget *parent); 00088 }; 00089 #endif 00090 00091 #ifndef NO_QWT_WIDGETS 00092 class AnalogClockInterface: public CustomWidgetInterface 00093 { 00094 Q_OBJECT 00095 Q_INTERFACES(QDesignerCustomWidgetInterface) 00096 00097 public: 00098 AnalogClockInterface(QObject *parent); 00099 virtual QWidget *createWidget(QWidget *parent); 00100 }; 00101 #endif 00102 00103 #ifndef NO_QWT_WIDGETS 00104 class CompassInterface: public CustomWidgetInterface 00105 { 00106 Q_OBJECT 00107 Q_INTERFACES(QDesignerCustomWidgetInterface) 00108 00109 public: 00110 CompassInterface(QObject *parent); 00111 virtual QWidget *createWidget(QWidget *parent); 00112 }; 00113 #endif 00114 00115 #ifndef NO_QWT_WIDGETS 00116 class CounterInterface: public CustomWidgetInterface 00117 { 00118 Q_OBJECT 00119 Q_INTERFACES(QDesignerCustomWidgetInterface) 00120 00121 public: 00122 CounterInterface(QObject *parent); 00123 virtual QWidget *createWidget(QWidget *parent); 00124 }; 00125 #endif 00126 00127 #ifndef NO_QWT_WIDGETS 00128 class DialInterface: public CustomWidgetInterface 00129 { 00130 Q_OBJECT 00131 Q_INTERFACES(QDesignerCustomWidgetInterface) 00132 00133 public: 00134 DialInterface(QObject *parent); 00135 virtual QWidget *createWidget(QWidget *parent); 00136 }; 00137 #endif 00138 00139 #ifndef NO_QWT_WIDGETS 00140 class KnobInterface: public CustomWidgetInterface 00141 { 00142 Q_OBJECT 00143 Q_INTERFACES(QDesignerCustomWidgetInterface) 00144 00145 public: 00146 KnobInterface(QObject *parent); 00147 virtual QWidget *createWidget(QWidget *parent); 00148 }; 00149 #endif 00150 00151 #ifndef NO_QWT_PLOT 00152 class ScaleWidgetInterface: public CustomWidgetInterface 00153 { 00154 Q_OBJECT 00155 Q_INTERFACES(QDesignerCustomWidgetInterface) 00156 00157 public: 00158 ScaleWidgetInterface(QObject *parent); 00159 virtual QWidget *createWidget(QWidget *parent); 00160 }; 00161 #endif 00162 00163 #ifndef NO_QWT_WIDGETS 00164 class SliderInterface: public CustomWidgetInterface 00165 { 00166 Q_OBJECT 00167 Q_INTERFACES(QDesignerCustomWidgetInterface) 00168 00169 public: 00170 SliderInterface(QObject *parent); 00171 virtual QWidget *createWidget(QWidget *parent); 00172 }; 00173 #endif 00174 00175 class TextLabelInterface: public CustomWidgetInterface 00176 { 00177 Q_OBJECT 00178 Q_INTERFACES(QDesignerCustomWidgetInterface) 00179 00180 public: 00181 TextLabelInterface(QObject *parent); 00182 virtual QWidget *createWidget(QWidget *parent); 00183 }; 00184 00185 #ifndef NO_QWT_WIDGETS 00186 class ThermoInterface: public CustomWidgetInterface 00187 { 00188 Q_OBJECT 00189 Q_INTERFACES(QDesignerCustomWidgetInterface) 00190 00191 public: 00192 ThermoInterface(QObject *parent); 00193 virtual QWidget *createWidget(QWidget *parent); 00194 }; 00195 #endif 00196 00197 #ifndef NO_QWT_WIDGETS 00198 class WheelInterface: public CustomWidgetInterface 00199 { 00200 Q_OBJECT 00201 Q_INTERFACES(QDesignerCustomWidgetInterface) 00202 00203 public: 00204 WheelInterface(QObject *parent); 00205 virtual QWidget *createWidget(QWidget *parent); 00206 }; 00207 #endif 00208 00209 class TaskMenuFactory: public QExtensionFactory 00210 { 00211 Q_OBJECT 00212 00213 public: 00214 TaskMenuFactory(QExtensionManager *parent = 0); 00215 00216 protected: 00217 QObject *createExtension(QObject *object, 00218 const QString &iid, QObject *parent) const; 00219 }; 00220 00221 class TaskMenuExtension: public QObject, 00222 public QDesignerTaskMenuExtension 00223 { 00224 Q_OBJECT 00225 Q_INTERFACES(QDesignerTaskMenuExtension) 00226 00227 public: 00228 TaskMenuExtension(QWidget *widget, QObject *parent); 00229 00230 QAction *preferredEditAction() const; 00231 QList<QAction *> taskActions() const; 00232 00233 private slots: 00234 void editProperties(); 00235 void applyProperties(const QString &); 00236 00237 private: 00238 QAction *d_editAction; 00239 QWidget *d_widget; 00240 }; 00241 00242 }; 00243 00244 #endif