kexi

kexipart.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2003-2005 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 KEXIPART_H
22#define KEXIPART_H
23
24#include <tqobject.h>
25#include <tqmap.h>
26
27#include <kexiutils/tristate.h>
28#include "kexi.h"
29#include "keximainwindow.h"
30
31class TDEActionCollection;
32class KexiDialogBase;
34class KexiViewBase;
36class TDEAction;
37class TDEShortcut;
38class KTabWidget;
39
40namespace KexiPart
41{
42 class Info;
43 class Item;
44 class GUIClient;
45 class PartPrivate;
46 class StaticInfo;
47
49enum ObjectTypes {
50 TableObjectType = KexiDB::TableObjectType,
51 QueryObjectType = KexiDB::QueryObjectType,
52 FormObjectType = 3,
53 ReportObjectType = 4,
54 ScriptObjectType = 5,
55 WebObjectType = 6,
56 MacroObjectType = 7,
57 LastObjectType = 7, //ALWAYS UPDATE THIS
58
59 UserObjectType = 100
60};
61
65class KEXICORE_EXPORT Part : public TQObject
66{
67 TQ_OBJECT
68
69
70 public:
72 Part(TQObject *parent, const char *name, const TQStringList &);
74 virtual ~Part();
75
77
85 virtual bool execute(KexiPart::Item* item, TQObject* sender = 0) {
86 Q_UNUSED(item);
87 Q_UNUSED(sender);
88 return false;
89 }
90
98 inline int supportedViewModes() const { return m_supportedViewModes; }
99
107
109
112 KexiDialogBase* openInstance(KexiMainWindow *win, KexiPart::Item &item,
113 int viewMode = Kexi::DataViewMode, TQMap<TQString,TQString>* staticObjectArgs = 0);
114
116
130 virtual bool remove(KexiMainWindow *win, KexiPart::Item & item);
131
143 virtual tristate rename(KexiMainWindow *win, KexiPart::Item &item, const TQString& newName);
144
149 virtual KexiDialogTempData* createTempData(KexiDialogBase* dialog);
150
153 virtual KexiViewBase* createView(TQWidget *parent, KexiDialogBase* dialog,
154 KexiPart::Item &item, int viewMode = Kexi::DataViewMode, TQMap<TQString,TQString>* staticObjectArgs = 0) = 0;
155
160 TQCString instanceName() const;
161
165 TQString instanceCaption() const;
166
167 inline Info *info() const { return m_info; }
168
171 inline GUIClient *guiClient() const { return m_guiClient; }
172
175 inline GUIClient *instanceGuiClient(int mode = 0) const
176 { return m_instanceGuiClients[mode]; }
177
178#if 0
183 virtual DataSource *dataSource() { return 0; }
184#endif
185
187 TDEActionCollection* actionCollectionForMode(int viewMode) const;
188
189 const Kexi::ObjectStatus& lastOperationStatus() const { return m_status; }
190
205 virtual TQString i18nMessage(const TQCString& englishMessage,
206 KexiDialogBase* dlg) const;
207
208 signals:
209 void newObjectRequest( KexiPart::Info *info );
210
211 protected slots:
212 void slotCreate();
213
214 protected:
216 Part(TQObject* parent, StaticInfo *info);
217
218// virtual KexiDialogBase* createInstance(KexiMainWindow *win, const KexiPart::Item &item, int viewMode = Kexi::DataViewMode) = 0;
219
222 void createGUIClients(KexiMainWindow *win);
223
224#if 0
230 virtual void initPartActions( TDEActionCollection * ) {};
231
244 virtual void initInstanceActions( int mode, TDEActionCollection *col ) {};
245#endif
246
247 virtual void initPartActions();
248 virtual void initInstanceActions();
249
250 virtual KexiDB::SchemaData* loadSchemaData(KexiDialogBase *dlg,
251 const KexiDB::SchemaData& sdata, int viewMode);
252
253 bool loadDataBlock( KexiDialogBase *dlg, TQString &dataString, const TQString& dataID = TQString());
254
260 TDEAction* createSharedAction(int mode, const TQString &text,
261 const TQString &pix_name, const TDEShortcut &cut, const char *name,
262 const char *subclassName = 0);
263
265 TDEAction* createSharedToggleAction(int mode, const TQString &text,
266 const TQString &pix_name, const TDEShortcut &cut, const char *name);
267
273 TDEAction* createSharedPartAction(const TQString &text,
274 const TQString &pix_name, const TDEShortcut &cut, const char *name,
275 const char *subclassName = 0);
276
279 TDEAction* createSharedPartToggleAction(const TQString &text,
280 const TQString &pix_name, const TDEShortcut &cut, const char *name);
281
282 void setActionAvailable(const char *action_name, bool avail);
283
284 inline void setInfo(Info *info) { m_info = info; }
285
292 virtual void setupCustomPropertyPanelTabs(KTabWidget *tab, KexiMainWindow* mainWin);
293
297 TQMap<TQString,TQString> m_names;
298
302
307
308 Info *m_info;
309 GUIClient *m_guiClient;
310 TQIntDict<GUIClient> m_instanceGuiClients;
311 KexiMainWindow* m_mainWin;
312 Kexi::ObjectStatus m_status;
313
319
323
324 PartPrivate *d;
325
326 friend class Manager;
327 friend class ::KexiMainWindow;
328 friend class ::KexiMainWindowImpl;
329 friend class GUIClient;
330};
331
332}
333
334#endif
Base class for child window of Kexi's main application window.
Privides temporary data shared between KexiDialogBase's views (KexiView's).
Kexi's main window implementation.
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
this class provides a datasource framework for e.g.
Information about a Kexi Part (plugin).
Information about a single object that can be instantiated using Kexi Part.
int m_supportedViewModes
Definition kexipart.h:301
int supportedViewModes() const
Definition kexipart.h:98
int m_registeredPartID
Definition kexipart.h:318
bool m_newObjectsAreDirty
Definition kexipart.h:322
int supportedUserViewModes() const
Definition kexipart.h:106
Part(TQObject *parent, const char *name, const TQStringList &)
Definition kexipart.cpp:90
TQString instanceCaption() const
Definition kexipart.cpp:415
virtual bool execute(KexiPart::Item *item, TQObject *sender=0)
Definition kexipart.h:85
TQMap< TQString, TQString > m_names
Definition kexipart.h:297
GUIClient * guiClient() const
Definition kexipart.h:171
GUIClient * instanceGuiClient(int mode=0) const
Definition kexipart.h:175
TQCString instanceName() const
Definition kexipart.cpp:408
int m_supportedUserViewModes
Definition kexipart.h:306
virtual KexiViewBase * createView(TQWidget *parent, KexiDialogBase *dialog, KexiPart::Item &item, int viewMode=Kexi::DataViewMode, TQMap< TQString, TQString > *staticObjectArgs=0)=0
Information about a static Kexi Part (plugin).
Base class for single view embeddable of in KexiDialogBase.
3-state logical type with three values: true, false and cancelled and convenient operators.
Definition tristate.h:100