kexi

containerfactory.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
00003    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00004    Copyright (C) 2006-2007 Jaroslaw Staniek <js@iidea.pl>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef CONTAINERFACTORY_H
00023 #define CONTAINERFACTORY_H
00024 
00025 #include <kcommand.h>
00026 
00027 #include "widgetfactory.h"
00028 #include "../utils.h"
00029 
00030 namespace KFormDesigner
00031 {
00032     class Form;
00033     class FormManager;
00034     class Container;
00035 }
00036 
00037 class InsertPageCommand : public KCommand
00038 {
00039     public:
00040         InsertPageCommand(KFormDesigner::Container *container, QWidget *widget);
00041 
00042         virtual void execute();
00043         virtual void unexecute();
00044         virtual QString name() const;
00045 
00046     protected:
00047         KFormDesigner::Form *m_form;
00048         QString  m_containername;
00049         QString  m_name;
00050         QString  m_parentname;
00051         int      m_pageid;
00052 };
00053 
00055 class KFORMEDITOR_EXPORT HBox : public QFrame
00056 {
00057     Q_OBJECT
00058 
00059     public:
00060         HBox(QWidget *parent, const char *name);
00061         virtual ~HBox(){;}
00062         void setPreviewMode() {m_preview = true;}
00063         virtual void paintEvent(QPaintEvent *ev);
00064 
00065     protected:
00066         bool  m_preview;
00067 };
00068 
00070 class KFORMEDITOR_EXPORT VBox : public QFrame
00071 {
00072     Q_OBJECT
00073 
00074     public:
00075         VBox(QWidget *parent, const char *name);
00076         virtual ~VBox(){;}
00077         void setPreviewMode() {m_preview = true;}
00078         virtual void paintEvent(QPaintEvent *ev);
00079 
00080     protected:
00081         bool  m_preview;
00082 };
00083 
00085 class KFORMEDITOR_EXPORT Grid : public QFrame
00086 {
00087     Q_OBJECT
00088 
00089     public:
00090         Grid(QWidget *parent, const char *name);
00091         virtual ~Grid(){;}
00092         void setPreviewMode() {m_preview = true;}
00093         virtual void paintEvent(QPaintEvent *ev);
00094 
00095     protected:
00096         bool  m_preview;
00097 };
00098 
00100 class KFORMEDITOR_EXPORT HFlow : public QFrame
00101 {
00102     Q_OBJECT
00103 
00104     public:
00105         HFlow(QWidget *parent, const char *name);
00106         virtual ~HFlow(){;}
00107         void setPreviewMode() {m_preview = true;}
00108         virtual void paintEvent(QPaintEvent *ev);
00109 
00110     protected:
00111         bool  m_preview;
00112 };
00113 
00115 class KFORMEDITOR_EXPORT VFlow : public QFrame
00116 {
00117     Q_OBJECT
00118 
00119     public:
00120         VFlow(QWidget *parent, const char *name);
00121         virtual ~VFlow(){;}
00122         void setPreviewMode() {m_preview = true;}
00123         virtual void paintEvent(QPaintEvent *ev);
00124         virtual QSize sizeHint() const;
00125 
00126     protected:
00127         bool  m_preview;
00128 };
00129 
00131 class KFORMEDITOR_EXPORT ContainerWidget : public QWidget
00132 {
00133     Q_OBJECT
00134 
00135     friend class KFDTabWidget;
00136 
00137     public:
00138         ContainerWidget(QWidget *parent, const char *name);
00139         virtual ~ContainerWidget();
00140 
00141         virtual QSize sizeHint() const;
00142 
00144         virtual void dragMoveEvent( QDragMoveEvent *e );
00145 
00147         virtual void dropEvent( QDropEvent *e );
00148 
00149     signals:
00151         void handleDragMoveEvent(QDragMoveEvent *e);
00152 
00154         void handleDropEvent(QDropEvent *e);
00155 };
00156 
00158 class KFORMEDITOR_EXPORT KFDTabWidget : public KFormDesigner::TabWidget
00159 {
00160     Q_OBJECT
00161 
00162     public:
00163         KFDTabWidget(QWidget *parent, const char *name);
00164         virtual ~KFDTabWidget();
00165 
00166         virtual QSize sizeHint() const;
00167 
00169         virtual void dragMoveEvent( QDragMoveEvent *e );
00170 
00172         virtual void dropEvent( QDropEvent *e );
00173 
00174     signals:
00176         void handleDragMoveEvent(QDragMoveEvent *e);
00177 
00179         void handleDropEvent(QDropEvent *e);
00180 };
00181 
00183 class KFORMEDITOR_EXPORT GroupBox : public QGroupBox
00184 {
00185     Q_OBJECT
00186 
00187     public:
00188         GroupBox(const QString & title, QWidget *parent, const char *name);
00189         virtual ~GroupBox();
00190 
00192         virtual void dragMoveEvent( QDragMoveEvent *e );
00193 
00195         virtual void dropEvent( QDropEvent *e );
00196 
00197     signals:
00199         void handleDragMoveEvent(QDragMoveEvent *e);
00200 
00202         void handleDropEvent(QDropEvent *e);
00203 };
00204 
00206 class KFORMEDITOR_EXPORT SubForm : public QScrollView
00207 {
00208     Q_OBJECT
00209     Q_PROPERTY(QString formName READ formName WRITE setFormName DESIGNABLE true)
00210 
00211     public:
00212         SubForm(QWidget *parent, const char *name);
00213         ~SubForm() {}
00214 
00216         QString   formName() const { return m_formName; }
00217         void      setFormName(const QString &name);
00218 
00219     private:
00220 //      KFormDesigner::FormManager *m_manager;
00221         KFormDesigner::Form   *m_form;
00222         QWidget  *m_widget;
00223         QString   m_formName;
00224 };
00225 
00227 class ContainerFactory : public KFormDesigner::WidgetFactory
00228 {
00229     Q_OBJECT
00230 
00231     public:
00232         ContainerFactory(QObject *parent, const char *name, const QStringList &args);
00233         virtual ~ContainerFactory();
00234 
00235         virtual QWidget *createWidget(const QCString & classname, QWidget *parent, const char *name, KFormDesigner::Container *container,
00236             int options = DefaultOptions);
00237         virtual bool createMenuActions(const QCString& classname, QWidget *w, QPopupMenu *menu,
00238             KFormDesigner::Container *container);
00239         virtual bool startEditing(const QCString &classname, QWidget *w,
00240             KFormDesigner::Container *container);
00241         virtual bool previewWidget(const QCString &classname, QWidget *widget,
00242             KFormDesigner::Container *container);
00243         virtual bool saveSpecialProperty(const QCString &classname, const QString &name,
00244             const QVariant &value, QWidget *w, QDomElement &parentNode, QDomDocument &parent);
00245         virtual bool readSpecialProperty(const QCString &classname, QDomElement &node, QWidget *w,
00246             KFormDesigner::ObjectTreeItem *item);
00247         virtual QValueList<QCString> autoSaveProperties(const QCString &classname);
00248 
00249     protected:
00250         virtual bool isPropertyVisibleInternal(const QCString &classname, QWidget *w, 
00251             const QCString &property, bool isTopLevel);
00252         virtual bool changeText(const QString &newText);
00253         virtual void resizeEditor(QWidget *editor, QWidget *widget, const QCString &classname);
00254 
00255     public slots:
00256         void addTabPage();
00257         void addStackPage();
00258         void renameTabPage();
00259         void removeTabPage();
00260         void removeStackPage();
00261         void prevStackPage();
00262         void nextStackPage();
00263         void reorderTabs(int oldpos, int newpos);
00264 
00265     private:
00266 //      QWidget *m_widget;
00267 //      KFormDesigner::Container *m_container;
00268 //      KFormDesigner::FormManager  *m_manager;
00269 };
00270 
00271 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys