kexi

containerfactory.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
4 Copyright (C) 2006-2007 Jaroslaw Staniek <js@iidea.pl>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef CONTAINERFACTORY_H
23#define CONTAINERFACTORY_H
24
25#include <kcommand.h>
26
27#include "widgetfactory.h"
28#include "../utils.h"
29
30namespace KFormDesigner
31{
32 class Form;
33 class FormManager;
34 class Container;
35}
36
37class InsertPageCommand : public KCommand
38{
39 public:
40 InsertPageCommand(KFormDesigner::Container *container, TQWidget *widget);
41
42 virtual void execute();
43 virtual void unexecute();
44 virtual TQString name() const;
45
46 protected:
47 KFormDesigner::Form *m_form;
48 TQString m_containername;
49 TQString m_name;
50 TQString m_parentname;
51 int m_pageid;
52};
53
55class KFORMEDITOR_EXPORT HBox : public TQFrame
56{
57 TQ_OBJECT
58
59
60 public:
61 HBox(TQWidget *parent, const char *name);
62 virtual ~HBox(){;}
63 void setPreviewMode() {m_preview = true;}
64 virtual void paintEvent(TQPaintEvent *ev);
65
66 protected:
67 bool m_preview;
68};
69
71class KFORMEDITOR_EXPORT VBox : public TQFrame
72{
73 TQ_OBJECT
74
75
76 public:
77 VBox(TQWidget *parent, const char *name);
78 virtual ~VBox(){;}
79 void setPreviewMode() {m_preview = true;}
80 virtual void paintEvent(TQPaintEvent *ev);
81
82 protected:
83 bool m_preview;
84};
85
87class KFORMEDITOR_EXPORT Grid : public TQFrame
88{
89 TQ_OBJECT
90
91
92 public:
93 Grid(TQWidget *parent, const char *name);
94 virtual ~Grid(){;}
95 void setPreviewMode() {m_preview = true;}
96 virtual void paintEvent(TQPaintEvent *ev);
97
98 protected:
99 bool m_preview;
100};
101
103class KFORMEDITOR_EXPORT HFlow : public TQFrame
104{
105 TQ_OBJECT
106
107
108 public:
109 HFlow(TQWidget *parent, const char *name);
110 virtual ~HFlow(){;}
111 void setPreviewMode() {m_preview = true;}
112 virtual void paintEvent(TQPaintEvent *ev);
113
114 protected:
115 bool m_preview;
116};
117
119class KFORMEDITOR_EXPORT VFlow : public TQFrame
120{
121 TQ_OBJECT
122
123
124 public:
125 VFlow(TQWidget *parent, const char *name);
126 virtual ~VFlow(){;}
127 void setPreviewMode() {m_preview = true;}
128 virtual void paintEvent(TQPaintEvent *ev);
129 virtual TQSize sizeHint() const;
130
131 protected:
132 bool m_preview;
133};
134
136class KFORMEDITOR_EXPORT ContainerWidget : public TQWidget
137{
138 TQ_OBJECT
139
140
141 friend class KFDTabWidget;
142
143 public:
144 ContainerWidget(TQWidget *parent, const char *name);
145 virtual ~ContainerWidget();
146
147 virtual TQSize sizeHint() const;
148
150 virtual void dragMoveEvent( TQDragMoveEvent *e );
151
153 virtual void dropEvent( TQDropEvent *e );
154
155 signals:
157 void handleDragMoveEvent(TQDragMoveEvent *e);
158
160 void handleDropEvent(TQDropEvent *e);
161};
162
164class KFORMEDITOR_EXPORT KFDTabWidget : public KFormDesigner::TabWidget
165{
166 TQ_OBJECT
167
168
169 public:
170 KFDTabWidget(TQWidget *parent, const char *name);
171 virtual ~KFDTabWidget();
172
173 virtual TQSize sizeHint() const;
174
176 virtual void dragMoveEvent( TQDragMoveEvent *e );
177
179 virtual void dropEvent( TQDropEvent *e );
180
181 signals:
183 void handleDragMoveEvent(TQDragMoveEvent *e);
184
186 void handleDropEvent(TQDropEvent *e);
187};
188
190class KFORMEDITOR_EXPORT GroupBox : public TQGroupBox
191{
192 TQ_OBJECT
193
194
195 public:
196 GroupBox(const TQString & title, TQWidget *parent, const char *name);
197 virtual ~GroupBox();
198
200 virtual void dragMoveEvent( TQDragMoveEvent *e );
201
203 virtual void dropEvent( TQDropEvent *e );
204
205 signals:
207 void handleDragMoveEvent(TQDragMoveEvent *e);
208
210 void handleDropEvent(TQDropEvent *e);
211};
212
214class KFORMEDITOR_EXPORT SubForm : public TQScrollView
215{
216 TQ_OBJECT
217
218 TQ_PROPERTY(TQString formName READ formName WRITE setFormName DESIGNABLE true)
219
220 public:
221 SubForm(TQWidget *parent, const char *name);
222 ~SubForm() {}
223
225 TQString formName() const { return m_formName; }
226 void setFormName(const TQString &name);
227
228 private:
229// KFormDesigner::FormManager *m_manager;
230 KFormDesigner::Form *m_form;
231 TQWidget *m_widget;
232 TQString m_formName;
233};
234
237{
238 TQ_OBJECT
239
240
241 public:
242 ContainerFactory(TQObject *parent, const char *name, const TQStringList &args);
243 virtual ~ContainerFactory();
244
245 virtual TQWidget *createWidget(const TQCString & classname, TQWidget *parent, const char *name, KFormDesigner::Container *container,
246 int options = DefaultOptions);
247 virtual bool createMenuActions(const TQCString& classname, TQWidget *w, TQPopupMenu *menu,
248 KFormDesigner::Container *container);
249 virtual bool startEditing(const TQCString &classname, TQWidget *w,
250 KFormDesigner::Container *container);
251 virtual bool previewWidget(const TQCString &classname, TQWidget *widget,
252 KFormDesigner::Container *container);
253 virtual bool saveSpecialProperty(const TQCString &classname, const TQString &name,
254 const TQVariant &value, TQWidget *w, TQDomElement &parentNode, TQDomDocument &parent);
255 virtual bool readSpecialProperty(const TQCString &classname, TQDomElement &node, TQWidget *w,
257 virtual TQValueList<TQCString> autoSaveProperties(const TQCString &classname);
258
259 protected:
260 virtual bool isPropertyVisibleInternal(const TQCString &classname, TQWidget *w,
261 const TQCString &property, bool isTopLevel);
262 virtual bool changeText(const TQString &newText);
263 virtual void resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &classname);
264
265 public slots:
266 void addTabPage();
267 void addStackPage();
268 void renameTabPage();
269 void removeTabPage();
270 void removeStackPage();
271 void prevStackPage();
272 void nextStackPage();
273 void reorderTabs(int oldpos, int newpos);
274
275 private:
276// TQWidget *m_widget;
277// KFormDesigner::Container *m_container;
278// KFormDesigner::FormManager *m_manager;
279};
280
281#endif
virtual TQValueList< TQCString > autoSaveProperties(const TQCString &classname)
virtual bool previewWidget(const TQCString &classname, TQWidget *widget, KFormDesigner::Container *container)
virtual bool changeText(const TQString &newText)
virtual void resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &classname)
ContainerFactory(TQObject *parent, const char *name, const TQStringList &args)
virtual bool saveSpecialProperty(const TQCString &classname, const TQString &name, const TQVariant &value, TQWidget *w, TQDomElement &parentNode, TQDomDocument &parent)
virtual bool createMenuActions(const TQCString &classname, TQWidget *w, TQPopupMenu *menu, KFormDesigner::Container *container)
virtual bool readSpecialProperty(const TQCString &classname, TQDomElement &node, TQWidget *w, KFormDesigner::ObjectTreeItem *item)
virtual bool startEditing(const TQCString &classname, TQWidget *w, KFormDesigner::Container *container)
virtual bool isPropertyVisibleInternal(const TQCString &classname, TQWidget *w, const TQCString &property, bool isTopLevel)
virtual TQWidget * createWidget(const TQCString &classname, TQWidget *parent, const char *name, KFormDesigner::Container *container, int options=DefaultOptions)
Creates a widget (and if needed a KFormDesigner::Container).
void handleDropEvent(TQDropEvent *e)
Needed to control dropping on the container's surface.
virtual void dragMoveEvent(TQDragMoveEvent *e)
Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface.
void handleDragMoveEvent(TQDragMoveEvent *e)
Needed to control dragging over the container's surface.
virtual void dropEvent(TQDropEvent *e)
Used to emit handleDropEvent() signal needed to control dropping on the container's surface.
virtual void dragMoveEvent(TQDragMoveEvent *e)
Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface.
void handleDragMoveEvent(TQDragMoveEvent *e)
Needed to control dragging over the container's surface.
void handleDropEvent(TQDropEvent *e)
Needed to control dropping on the container's surface.
virtual void dropEvent(TQDropEvent *e)
Used to emit handleDropEvent() signal needed to control dropping on the container's surface.
HBox(TQWidget *parent, const char *name)
Various layout widgets /////////////////:
void handleDropEvent(TQDropEvent *e)
Needed to control dropping on the container's surface.
virtual void dragMoveEvent(TQDragMoveEvent *e)
Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface.
virtual void dropEvent(TQDropEvent *e)
Used to emit handleDropEvent() signal needed to control dropping on the container's surface.
void handleDragMoveEvent(TQDragMoveEvent *e)
Needed to control dragging over the container's surface.
This class makes a container out of any TQWidget.
Definition container.h:74
A class to manage (create/load/save) Forms.
Definition formmanager.h:73
A simple class representing a form.
Definition form.h:136
An item representing a widget Holds the properties of a widget (classname, name, parent,...
Definition objecttree.h:59
A tab widget providing information about height of the tab bar.
The base class for all widget Factories.
TQString formName() const