kfd_kdev_part.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KFORMDESIGNER_KDEVELOP_PART_H
21#define KFORMDESIGNER_KDEVELOP_PART_H
22
23#include <tqwidget.h>
24#include <tqpixmap.h>
25
26#include <kinterfacedesigner/designer.h>
27#include <tdeparts/factory.h>
28
29#include "form.h"
30
31class TDEAboutData;
32class TDEInstance;
33class TQWorkspace;
34class TQCloseEvent;
35
37using namespace KInterfaceDesigner;
38
39class KFORMEDITOR_EXPORT KFDFactory : public KParts::Factory
40{
41 TQ_OBJECT
42
43
44 public:
45 KFDFactory();
46 virtual ~KFDFactory();
47
48 virtual KParts::Part* createPartObject(TQWidget *parentWidget=0, const char *widgetName=0, TQObject *parent=0, const char *name=0,
49 const char *classname="KParts::Part", const TQStringList &args=TQStringList());
50
51 static TDEInstance *instance();
52 static TDEAboutData *aboutData();
53
54 private:
55 static TDEInstance *m_instance;
56};
57
58class KFORMEDITOR_EXPORT KFormDesignerKDevPart : public Designer
59{
60 TQ_OBJECT
61
62
63 public:
64 KFormDesignerKDevPart(TQWidget *parent, const char *name, bool readOnly=true, const TQStringList &args=TQStringList());
65 virtual ~KFormDesignerKDevPart();
66
67 virtual DesignerType designerType() { return TQtDesigner; }
68 virtual void openProject(const TQString &) {}
69
70// KFormDesigner::FormManager* manager() { return m_manager; }
71 void setUniqueFormMode(bool enable) { m_uniqueFormMode = enable; }
72
73 bool closeForm(Form *form);
74 bool closeForms();
75
76 virtual bool closeURL();
77
78 static KFormDesigner::WidgetLibrary* formsLibrary();
79
80 public slots:
82 void createBlankForm();
85 void open();
86 void slotPreviewForm();
87 void saveAs();
88 void slotCreateFormSlot(KFormDesigner::Form *form, const TQString &widget, const TQString &signal);
89
90 protected slots:
91 void slotWidgetSelected(KFormDesigner::Form *form, bool multiple);
92 void slotFormWidgetSelected(KFormDesigner::Form *form);
93 void slotNoFormSelected();
94 void slotFormModified(KFormDesigner::Form *form, bool isDirty);
95 void setUndoEnabled(bool enabled, const TQString &text);
96 void setRedoEnabled(bool enabled, const TQString &text);
97
98 protected:
99 virtual bool openFile();
100 virtual bool saveFile();
101 void disableWidgetActions();
102 void enableFormActions();
103 void setupActions();
104
105 private:
106 static KFormDesigner::WidgetLibrary* static_formsLibrary;
107// KFormDesigner::FormManager *m_manager;
108 TQWorkspace *m_workspace;
109 int m_count;
110 bool m_uniqueFormMode;
111 bool m_openingFile;
112 bool m_inShell;
113};
114
116class KFORMEDITOR_EXPORT FormWidgetBase : public TQWidget, public KFormDesigner::FormWidget
117{
118 TQ_OBJECT
119
120
121 public:
122 FormWidgetBase(KFormDesignerKDevPart *part, TQWidget *parent = 0, const char *name = 0, int WFlags = WDestructiveClose)
123 : TQWidget(parent, name, WFlags), m_part(part) {}
124 ~FormWidgetBase() {;}
125
126 void drawRect(const TQRect& r, int type);
127 void drawRects(const TQValueList<TQRect> &list, int type);
128 void initRect();
129 void clearRect();
130 void highlightWidgets(TQWidget *from, TQWidget *to);//, const TQPoint &p);
131
132 protected:
133 void closeEvent(TQCloseEvent *ev);
134
135 private:
136 TQPixmap buffer;
137 TQRect prev_rect;
138 KFormDesignerKDevPart *m_part;
139};
140
141#endif
142
Helper: this widget is used to create form's surface.
Base (virtual) class for all form widgets.
Definition form.h:54
A simple class representing a form.
Definition form.h:136
This class searches for factories and provides TDEActions for widget creation.