kexi

kexiformview.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3 Copyright (C) 2004-2007 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 KEXIFORMVIEW_H
22#define KEXIFORMVIEW_H
23
24#include <tqtimer.h>
25
26#include <kexiviewbase.h>
27#include <widget/kexidataawareview.h>
28
29#include "kexiformpart.h"
30#include <core/kexiblobbuffer.h>
31
32class KexiFormPart;
33class KexiMainWindow;
34class KexiDBForm;
35class KexiTableItem;
38namespace KexiDB { class Cursor; }
39namespace KFormDesigner
40{
41 class Container;
42}
43
45
55class KEXIFORMUTILS_EXPORT KexiFormView : public KexiDataAwareView
56{
57 TQ_OBJECT
58
59
60 public:
61 enum ResizeMode {
62 ResizeAuto = 0,
63 ResizeDefault = ResizeAuto,
64 ResizeFixed = 1,
65 NoResize = 2
66 };
67
68// KexiFormView(KexiMainWindow *win, TQWidget *parent, const char *name, KexiDB::Connection *conn);
69 KexiFormView(KexiMainWindow *mainWin, TQWidget *parent, const char *name = 0,
70 bool dbAware = true);
71 virtual ~KexiFormView();
72
73// KexiDB::Connection* connection() { return m_conn; }
74
75 virtual TQSize preferredSizeHint(const TQSize& otherSize);
76
77 int resizeMode() const { return m_resizeMode; }
78
79 KFormDesigner::Form* form() const;
80
93 void setUnsavedLocalBLOB(TQWidget *widget, KexiBLOBBuffer::Id_t id);
94
95 public slots:
97 virtual void show();
98
113 void insertAutoFields(const TQString& sourceMimeType, const TQString& sourceName,
114 const TQStringList& fields, KFormDesigner::Container* targetContainerWidget,
115 const TQPoint& pos = TQPoint(-1,-1));
116
117 protected slots:
118 void slotPropertySetSwitched(KoProperty::Set *b, bool forceReload = false,
119 const TQCString& propertyToSelect = TQCString());
120 void slotDirty(KFormDesigner::Form *f, bool isDirty);
121 void slotFocus(bool in);
122 void slotHandleDragMoveEvent(TQDragMoveEvent* e);
123
126 void slotHandleDropEvent(TQDropEvent* e);
127
128//moved to formmanager void slotWidgetSelected(KFormDesigner::Form *form, bool multiple);
129//moved to formmanager void slotFormWidgetSelected(KFormDesigner::Form *form);
130//moved to formmanager void slotNoFormSelected();
131
132//moved to formmanager void setUndoEnabled(bool enabled);
133//moved to formmanager void setRedoEnabled(bool enabled);
134
135 protected:
136 virtual tristate beforeSwitchTo(int mode, bool &dontStore);
137 virtual tristate afterSwitchFrom(int mode);
138 virtual KoProperty::Set* propertySet() { return m_propertySet; }
139
140 virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
141 virtual tristate storeData(bool dontAsk = false);
142
143 KexiFormPart::TempData* tempData() const {
144 return dynamic_cast<KexiFormPart::TempData*>(parentDialog()->tempData()); }
145 KexiFormPart* formPart() const { return dynamic_cast<KexiFormPart*>(part()); }
146
147//moved to formmanager void disableWidgetActions();
148//moved to formmanager void enableFormActions();
149
150 void setForm(KFormDesigner::Form *f);
151
152 void initForm();
153
154 void loadForm();
155
157 void updateAutoFieldsDataSource();
158
160 void updateValuesForSubproperties();
161
162 virtual void resizeEvent ( TQResizeEvent * );
163
164 void initDataSource();
165
166 virtual void setFocusInternal();
167
168/* // for navigator
169 virtual void moveToRecordRequested(uint r);
170 virtual void moveToLastRecordRequested();
171 virtual void moveToPreviousRecordRequested();
172 virtual void moveToNextRecordRequested();
173 virtual void moveToFirstRecordRequested();
174 virtual void addNewRecordRequested();*/
175
180
182 void deleteQuery();
183
185 void updateDataSourcePage();
186
189// todo virtual void updateActions(bool activated);
190
192 KexiFormScrollView *m_scrollView;
193 KoProperty::Set *m_propertySet;
194
200
201 int m_resizeMode;
202
203 KexiDB::QuerySchema* m_query;
204
209
210 KexiDB::Cursor *m_cursor;
211
216
218 TQGuardedPtr<TQWidget> m_setFocusInternalOnce;
219
220
227
229// TQMap<TQWidget*, KexiBLOBBuffer::Id_t> m_unsavedLocalBLOBs;
230};
231
232#endif
This class makes a container out of any TQWidget.
Definition container.h:74
A simple class representing a form.
Definition form.h:136
long Id_t
long integer for unique identifying blobs
A DB-aware form widget, acting as form's toplevel widget.
Definition kexidbform.h:44
Provides database cursor functionality.
Definition cursor.h:67
KexiDB::QuerySchema provides information about database query.
KexiDialogTempData * tempData() const
Kexi Form Plugin.
KexiFormScrollView class provides a widget for displaying data in a form view.
void updateTabStopsOrder()
virtual KoProperty::Set * propertySet()
void insertAutoFields(const TQString &sourceMimeType, const TQString &sourceName, const TQStringList &fields, KFormDesigner::Container *targetContainerWidget, const TQPoint &pos=TQPoint(-1,-1))
KexiDBForm * m_dbform
virtual void show()
void setUnsavedLocalBLOB(TQWidget *widget, KexiBLOBBuffer::Id_t id)
TQGuardedPtr< TQWidget > m_setFocusInternalOnce
Used in setFocusInternal().
void slotHandleDropEvent(TQDropEvent *e)
KexiFormView(KexiMainWindow *mainWin, TQWidget *parent, const char *name=0, bool dbAware=true)
int m_delayedFormContentsResizeOnShow
TQString m_previousDataSourceString
TQRect m_widgetGeometryForRecentInsertAutoFields
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
virtual tristate beforeSwitchTo(int mode, bool &dontStore)
virtual tristate afterSwitchFrom(int mode)
KexiPart::Part * part() const
virtual KexiDB::SchemaData * storeNewData(const KexiDB::SchemaData &sdata, bool &cancel)
virtual tristate storeData(bool dontAsk=false)
KexiDialogBase * parentDialog() const
virtual TQSize preferredSizeHint(const TQSize &otherSize)
KexiMainWindow * mainWin() const
3-state logical type with three values: true, false and cancelled and convenient operators.
Definition tristate.h:100
High-level database connectivity library with database backend drivers.