kexi

kexiinternalpart.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KEXIINTERNALPART_H
22#define KEXIINTERNALPART_H
23
24#include <tqobject.h>
25#include <tqguardedptr.h>
26#include <tqvariant.h>
27
28class KexiMainWindow;
29class KexiDialogBase;
30class KexiViewBase;
31
32namespace KexiDB {
33 class MessageHandler;
34}
35
36class TQWidget;
37
49class KEXICORE_EXPORT KexiInternalPart : public TQObject
50{
51 TQ_OBJECT
52
53
54 public:
55 KexiInternalPart(TQObject *parent, const char *name, const TQStringList &);
56 virtual ~KexiInternalPart();
57
58 KexiDialogBase *instance(KexiMainWindow *parent);
59
68 static TQWidget* createWidgetInstance(const char* partName, const char* widgetClass,
69 KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin,
70 TQWidget *parent, const char *objName = 0, TQMap<TQString,TQString>* args = 0);
71
73 static TQWidget* createWidgetInstance(const char* partName,
74 KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin,
75 TQWidget *parent, const char *objName = 0, TQMap<TQString,TQString>* args = 0)
76 { return createWidgetInstance(partName, 0, msgHdr, mainWin, parent, objName, args); }
77
85 static KexiDialogBase* createKexiDialogInstance(const char* partName,
86 KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin, const char *objName = 0);
87
101 static TQDialog* createModalDialogInstance(const char* partName,
102 const char* dialogClass, KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin,
103 const char *objName = 0, TQMap<TQString,TQString>* args = 0);
104
106 static TQDialog* createModalDialogInstance(const char* partName,
107 KexiDB::MessageHandler *msgHdr, KexiMainWindow* mainWin, const char *objName = 0,
108 TQMap<TQString,TQString>* args = 0)
109 { return createModalDialogInstance(partName, 0, msgHdr, mainWin, objName, args); }
110
113 static bool executeCommand(const char* partName,
114 KexiMainWindow* mainWin, const char* commandName, TQMap<TQString,TQString>* args = 0);
115
117 static const KexiInternalPart* part(KexiDB::MessageHandler *msgHdr, const char* partName);
118
120 inline bool uniqueDialog() const { return m_uniqueDialog; }
121
125 inline bool cancelled() const { return m_cancelled; }
126
127 protected:
129 KexiDialogBase *findOrCreateKexiDialog(KexiMainWindow* mainWin,
130 const char *objName);
131
134 virtual TQWidget *createWidget(const char* widgetClass, KexiMainWindow* mainWin,
135 TQWidget * parent, const char * objName = 0, TQMap<TQString,TQString>* args = 0);
136
137// //! Reimplement this if your internal part has to return dialogs
138// virtual KexiDialogBase *createDialog(KexiMainWindow* /*mainWin*/,
139// const char * /*objName*/ =0)
140// { return 0; }
141
143 virtual KexiViewBase *createView(KexiMainWindow* mainWin, TQWidget * parent,
144 const char *objName = 0);
145
149 virtual bool executeCommand(KexiMainWindow* mainWin, const char* commandName,
150 TQMap<TQString,TQString>* args = 0);
151
153 TQGuardedPtr<TQWidget> m_uniqueWidget;
154
155 bool m_uniqueDialog : 1;
156
157 bool m_cancelled : 1;
158};
159
160#endif
Base class for child window of Kexi's main application window.
A prototype for Kexi Internal Parts (plugins) implementation.
bool uniqueDialog() const
static TQDialog * createModalDialogInstance(const char *partName, KexiDB::MessageHandler *msgHdr, KexiMainWindow *mainWin, const char *objName=0, TQMap< TQString, TQString > *args=0)
TQGuardedPtr< TQWidget > m_uniqueWidget
Unique dialog - we're using guarded ptr for the dialog so can know if it has been closed.
bool cancelled() const
bool m_cancelled
Used in cancelled()
bool m_uniqueDialog
true if createDialogInstance() should return only one dialog
static TQWidget * createWidgetInstance(const char *partName, KexiDB::MessageHandler *msgHdr, KexiMainWindow *mainWin, TQWidget *parent, const char *objName=0, TQMap< TQString, TQString > *args=0)
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Base class for single view embeddable of in KexiDialogBase.
High-level database connectivity library with database backend drivers.