kexi

containerfactory.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef CONTAINERFACTORY_H
00021 #define CONTAINERFACTORY_H
00022 
00023 #if KDE_VERSION < KDE_MAKE_VERSION(3,1,9)
00024 # define KTabWidget QTabWidget
00025 #include <qtabwidget.h>
00026 #else
00027 #include <ktabwidget.h>
00028 #endif
00029 
00031 #define TabWidgetBase QTabWidget
00032 //#define USE_KTabWidget //todo: uncomment
00033 
00034 #include <kcommand.h>
00035 
00036 #include "widgetfactory.h"
00037 
00038 namespace KFormDesigner
00039 {
00040     class Form;
00041     class FormManager;
00042     class Container;
00043 }
00044 
00045 class InsertPageCommand : public KCommand
00046 {
00047     public:
00048         InsertPageCommand(KFormDesigner::Container *container, QWidget *widget);
00049 
00050         virtual void execute();
00051         virtual void unexecute();
00052         virtual QString name() const;
00053 
00054     protected:
00055         KFormDesigner::Form *m_form;
00056         QString  m_containername;
00057         QString  m_name;
00058         QString  m_parentname;
00059         int      m_pageid;
00060 };
00061 
00063 class KFORMEDITOR_EXPORT HBox : public QFrame
00064 {
00065     Q_OBJECT
00066 
00067     public:
00068         HBox(QWidget *parent, const char *name);
00069         ~HBox(){;}
00070         void setPreviewMode() {m_preview = true;}
00071         void paintEvent(QPaintEvent *ev);
00072 
00073     protected:
00074         bool  m_preview;
00075 };
00076 
00078 class KFORMEDITOR_EXPORT VBox : public QFrame
00079 {
00080     Q_OBJECT
00081 
00082     public:
00083         VBox(QWidget *parent, const char *name);
00084         ~VBox(){;}
00085         void setPreviewMode() {m_preview = true;}
00086         void paintEvent(QPaintEvent *ev);
00087 
00088     protected:
00089         bool  m_preview;
00090 };
00091 
00093 class KFORMEDITOR_EXPORT Grid : public QFrame
00094 {
00095     Q_OBJECT
00096 
00097     public:
00098         Grid(QWidget *parent, const char *name);
00099         ~Grid(){;}
00100         void setPreviewMode() {m_preview = true;}
00101         void paintEvent(QPaintEvent *ev);
00102 
00103     protected:
00104         bool  m_preview;
00105 };
00106 
00108 class KFORMEDITOR_EXPORT HFlow : public QFrame
00109 {
00110     Q_OBJECT
00111 
00112     public:
00113         HFlow(QWidget *parent, const char *name);
00114         ~HFlow(){;}
00115         void setPreviewMode() {m_preview = true;}
00116         void paintEvent(QPaintEvent *ev);
00117 
00118     protected:
00119         bool  m_preview;
00120 };
00121 
00123 class KFORMEDITOR_EXPORT VFlow : public QFrame
00124 {
00125     Q_OBJECT
00126 
00127     public:
00128         VFlow(QWidget *parent, const char *name);
00129         ~VFlow(){;}
00130         void setPreviewMode() {m_preview = true;}
00131         void paintEvent(QPaintEvent *ev);
00132         QSize  sizeHint() const;
00133 
00134     protected:
00135         bool  m_preview;
00136 };
00137 
00138 class KFORMEDITOR_EXPORT KFDTabWidget : public TabWidgetBase
00139 {
00140     Q_OBJECT
00141 
00142     public:
00143         KFDTabWidget(QWidget *parent, const char *name)
00144          : TabWidgetBase(parent, name)
00145         {}
00146         ~KFDTabWidget() {;}
00147 
00148         virtual QSize sizeHint() const;
00149 };
00150 
00152 class KFORMEDITOR_EXPORT SubForm : public QScrollView
00153 {
00154     Q_OBJECT
00155     Q_PROPERTY(QString formName READ formName WRITE setFormName DESIGNABLE true)
00156 
00157     public:
00158         SubForm(QWidget *parent, const char *name);
00159         ~SubForm() {}
00160 
00162         QString   formName() const { return m_formName; }
00163         void      setFormName(const QString &name);
00164 
00165     private:
00166 //      KFormDesigner::FormManager *m_manager;
00167         KFormDesigner::Form   *m_form;
00168         QWidget  *m_widget;
00169         QString   m_formName;
00170 };
00171 
00173 class ContainerFactory : public KFormDesigner::WidgetFactory
00174 {
00175     Q_OBJECT
00176 
00177     public:
00178         ContainerFactory(QObject *parent, const char *name, const QStringList &args);
00179         ~ContainerFactory();
00180 
00181         virtual QWidget *createWidget(const QCString & classname, QWidget *parent, const char *name, KFormDesigner::Container *container,
00182             int options = DefaultOptions);
00183         virtual bool createMenuActions(const QCString& classname, QWidget *w, QPopupMenu *menu,
00184             KFormDesigner::Container *container);
00185         virtual bool startEditing(const QCString &classname, QWidget *w,
00186             KFormDesigner::Container *container);
00187         virtual bool previewWidget(const QCString &classname, QWidget *widget,
00188             KFormDesigner::Container *container);
00189         virtual bool saveSpecialProperty(const QCString &classname, const QString &name,
00190             const QVariant &value, QWidget *w, QDomElement &parentNode, QDomDocument &parent);
00191         virtual bool readSpecialProperty(const QCString &classname, QDomElement &node, QWidget *w,
00192             KFormDesigner::ObjectTreeItem *item);
00193         virtual QValueList<QCString> autoSaveProperties(const QCString &classname);
00194 
00195     protected:
00196         virtual bool isPropertyVisibleInternal(const QCString &classname, QWidget *w, 
00197             const QCString &property, bool isTopLevel);
00198         virtual bool changeText(const QString &newText);
00199         virtual void resizeEditor(QWidget *editor, QWidget *widget, const QCString &classname);
00200 
00201     public slots:
00202         void addTabPage();
00203         void addStackPage();
00204         void renameTabPage();
00205         void removeTabPage();
00206         void removeStackPage();
00207         void prevStackPage();
00208         void nextStackPage();
00209         void reorderTabs(int oldpos, int newpos);
00210 
00211     private:
00212 //      QWidget *m_widget;
00213 //      KFormDesigner::Container *m_container;
00214 //      KFormDesigner::FormManager  *m_manager;
00215 };
00216 
00217 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys