kexi
kfd_kdev_part.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KFORMDESIGNER_KDEVELOP_PART_H
00021 #define KFORMDESIGNER_KDEVELOP_PART_H
00022
00023 #include <qwidget.h>
00024 #include <qpixmap.h>
00025
00026 #include <kinterfacedesigner/designer.h>
00027 #include <kparts/factory.h>
00028
00029 #include "form.h"
00030
00031 class KAboutData;
00032 class KInstance;
00033 class QWorkspace;
00034 class QCloseEvent;
00035
00036 using KFormDesigner::Form;
00037 using namespace KInterfaceDesigner;
00038
00039 class KFORMEDITOR_EXPORT KFDFactory : public KParts::Factory
00040 {
00041 Q_OBJECT
00042
00043 public:
00044 KFDFactory();
00045 virtual ~KFDFactory();
00046
00047 virtual KParts::Part* createPartObject(QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0,
00048 const char *classname="KParts::Part", const QStringList &args=QStringList());
00049
00050 static KInstance *instance();
00051 static KAboutData *aboutData();
00052
00053 private:
00054 static KInstance *m_instance;
00055 };
00056
00057 class KFORMEDITOR_EXPORT KFormDesignerKDevPart : public Designer
00058 {
00059 Q_OBJECT
00060
00061 public:
00062 KFormDesignerKDevPart(QWidget *parent, const char *name, bool readOnly=true, const QStringList &args=QStringList());
00063 virtual ~KFormDesignerKDevPart();
00064
00065 virtual DesignerType designerType() { return QtDesigner; }
00066 virtual void openProject(const QString &) {}
00067
00068
00069 void setUniqueFormMode(bool enable) { m_uniqueFormMode = enable; }
00070
00071 bool closeForm(Form *form);
00072 bool closeForms();
00073
00074 virtual bool closeURL();
00075
00076 static KFormDesigner::WidgetLibrary* formsLibrary();
00077
00078 public slots:
00080 void createBlankForm();
00083 void open();
00084 void slotPreviewForm();
00085 void saveAs();
00086 void slotCreateFormSlot(KFormDesigner::Form *form, const QString &widget, const QString &signal);
00087
00088 protected slots:
00089 void slotWidgetSelected(KFormDesigner::Form *form, bool multiple);
00090 void slotFormWidgetSelected(KFormDesigner::Form *form);
00091 void slotNoFormSelected();
00092 void slotFormModified(KFormDesigner::Form *form, bool isDirty);
00093 void setUndoEnabled(bool enabled, const QString &text);
00094 void setRedoEnabled(bool enabled, const QString &text);
00095
00096 protected:
00097 virtual bool openFile();
00098 virtual bool saveFile();
00099 void disableWidgetActions();
00100 void enableFormActions();
00101 void setupActions();
00102
00103 private:
00104 static KFormDesigner::WidgetLibrary* static_formsLibrary;
00105
00106 QWorkspace *m_workspace;
00107 int m_count;
00108 bool m_uniqueFormMode;
00109 bool m_openingFile;
00110 bool m_inShell;
00111 };
00112
00114 class KFORMEDITOR_EXPORT FormWidgetBase : public QWidget, public KFormDesigner::FormWidget
00115 {
00116 Q_OBJECT
00117
00118 public:
00119 FormWidgetBase(KFormDesignerKDevPart *part, QWidget *parent = 0, const char *name = 0, int WFlags = WDestructiveClose)
00120 : QWidget(parent, name, WFlags), m_part(part) {}
00121 ~FormWidgetBase() {;}
00122
00123 void drawRect(const QRect& r, int type);
00124 void drawRects(const QValueList<QRect> &list, int type);
00125 void initRect();
00126 void clearRect();
00127 void highlightWidgets(QWidget *from, QWidget *to);
00128
00129 protected:
00130 void closeEvent(QCloseEvent *ev);
00131
00132 private:
00133 QPixmap buffer;
00134 QRect prev_rect;
00135 KFormDesignerKDevPart *m_part;
00136 };
00137
00138 #endif
00139
|