kexi

kexiinternalpart.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
00003    Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIINTERNALPART_H
00022 #define KEXIINTERNALPART_H
00023 
00024 #include <qobject.h>
00025 #include <qguardedptr.h>
00026 #include <qvariant.h>
00027 
00028 class KexiMainWindow;
00029 class KexiDialogBase;
00030 class KexiViewBase;
00031 
00032 namespace KexiDB {
00033     class MessageHandler;
00034 }
00035 
00036 class QWidget;
00037 
00049 class KEXICORE_EXPORT KexiInternalPart : public QObject
00050 {
00051     Q_OBJECT
00052 
00053     public:
00054         KexiInternalPart(QObject *parent, const char *name, const QStringList &);
00055         virtual ~KexiInternalPart();
00056     
00057         KexiDialogBase *instance(KexiMainWindow *parent);
00058 
00067         static QWidget* createWidgetInstance(const char* partName, const char* widgetClass, 
00068             KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin, 
00069             QWidget *parent, const char *objName = 0, QMap<QString,QString>* args = 0);
00070 
00072         static QWidget* createWidgetInstance(const char* partName,
00073             KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin, 
00074             QWidget *parent, const char *objName = 0, QMap<QString,QString>* args = 0)
00075          { return createWidgetInstance(partName, 0, msgHdr, mainWin, parent, objName, args); }
00076 
00084         static KexiDialogBase* createKexiDialogInstance(const char* partName, 
00085             KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin, const char *objName = 0);
00086 
00100         static QDialog* createModalDialogInstance(const char* partName, 
00101             const char* dialogClass, KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin, 
00102             const char *objName = 0, QMap<QString,QString>* args = 0);
00103 
00105         static QDialog* createModalDialogInstance(const char* partName, 
00106             KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin, const char *objName = 0, 
00107             QMap<QString,QString>* args = 0)
00108         { return createModalDialogInstance(partName, 0, msgHdr, mainWin, objName, args); }
00109 
00111         static const KexiInternalPart* part(KexiDB::MessageHandler *msgHdr, const char* partName);
00112 
00114         inline bool uniqueDialog() const { return m_uniqueDialog; }
00115 
00119         inline bool cancelled() const { return m_cancelled; }
00120         
00121     protected:
00123         KexiDialogBase *findOrCreateKexiDialog(KexiMainWindow* mainWin, 
00124          const char *objName);
00125 
00128         virtual QWidget *createWidget(const char* /*widgetClass*/, KexiMainWindow* /*mainWin*/, 
00129          QWidget * /*parent*/, const char * /*objName*/ =0, QMap<QString,QString>* /*args*/ = 0) { return 0; }
00130         
00131 //      //! Reimplement this if your internal part has to return dialogs
00132 //      virtual KexiDialogBase *createDialog(KexiMainWindow* /*mainWin*/, 
00133 //       const char * /*objName*/ =0)
00134 //       { return 0; }
00135         
00136         virtual KexiViewBase *createView(KexiMainWindow* /*mainWin*/, QWidget * /*parent*/,
00137          const char * /*objName */=0) { return 0; }
00138         
00140         QGuardedPtr<QWidget> m_uniqueWidget; 
00141         
00142         bool m_uniqueDialog : 1; 
00143 
00144         bool m_cancelled : 1;
00145     
00146     //friend class KexiInternalPart;
00147 };
00148 
00149 #endif
00150 
KDE Home | KDE Accessibility Home | Description of Access Keys