kexi

kexidbform.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
4 Copyright (C) 2005-2007 Jaroslaw Staniek <js@iidea.pl>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21#ifndef KEXIDBFORM_H
22#define KEXIDBFORM_H
23
24#include <tqpixmap.h>
25
26#include <formeditor/form.h>
27#include "../kexiformdataiteminterface.h"
28
29#ifdef KEXI_USE_GRADIENT_WIDGET
30#include <kexigradientwidget.h>
31# define KexiDBFormBase KexiGradientWidget
32#else
33# define KexiDBFormBase TQWidget
34#endif
35
38
40class KEXIFORMUTILS_EXPORT KexiDBForm :
41 public KexiDBFormBase,
43 public KexiFormDataItemInterface
44{
45 TQ_OBJECT
46
47 TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true)
48 TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true)
49 TQ_PROPERTY(bool autoTabStops READ autoTabStops WRITE setAutoTabStops DESIGNABLE true)
50 //original "size" property is not designable, so here's a custom (not storable) replacement
51 TQ_PROPERTY( TQSize sizeInternal READ sizeInternal WRITE resizeInternal DESIGNABLE true STORED false )
52 public:
53 KexiDBForm(TQWidget *parent, KexiDataAwareObjectInterface* dataAwareObject, const char *name="kexi_dbform");
54 virtual ~KexiDBForm();
55
56 KexiDataAwareObjectInterface* dataAwareObject() const;
57
58 inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); }
59 inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); }
60
62 TQVariant value() { return TQVariant(); }
63
64 virtual void setInvalidState( const TQString& displayText );
65
66 virtual void drawRect(const TQRect& r, int type);
67 virtual void drawRects(const TQValueList<TQRect> &list, int type);
68 virtual void initBuffer();
69 virtual void clearForm();
70 virtual void highlightWidgets(TQWidget *from, TQWidget *to/*, const TQPoint &p*/);
71
72 virtual TQSize sizeHint() const;
73
74 bool autoTabStops() const;
75
76 TQPtrList<TQWidget>* orderedFocusWidgets() const;
77
78 TQPtrList<TQWidget>* orderedDataAwareWidgets() const;
79
80 void updateTabStopsOrder(KFormDesigner::Form* form);
81
82 void updateTabStopsOrder();
83
84 virtual bool eventFilter ( TQObject * watched, TQEvent * e );
85
86 virtual bool valueIsNull();
87 virtual bool valueIsEmpty();
88 virtual bool isReadOnly() const;
89 virtual TQWidget* widget();
90 virtual bool cursorAtStart();
91 virtual bool cursorAtEnd();
92 virtual void clear();
93
94 bool preview() const;
95
96 virtual void setCursor( const TQCursor & cursor );
97
98 public slots:
99 void setAutoTabStops(bool set);
100 inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); }
101 inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); }
102
104 virtual void setReadOnly( bool readOnly );
105
107 TQSize sizeInternal() const { return KexiDBFormBase::size(); }
108
110 void resizeInternal(const TQSize& s) { KexiDBFormBase::resize(s); }
111
112 signals:
113 void handleDragMoveEvent(TQDragMoveEvent *e);
114 void handleDropEvent(TQDropEvent *e);
115
116 protected:
118 virtual void setValueInternal(const TQVariant&, bool) {}
119
121 virtual void dragMoveEvent( TQDragMoveEvent *e );
122
124 virtual void dropEvent( TQDropEvent *e );
125
127 void updateReadOnlyFlags();
128// virtual void paintEvent( TQPaintEvent * );
129
132 KexiFormDataItemInterface *editedItem;
133
134 class Private;
135 Private *d;
136
137 friend class KexiFormScrollView;
138};
139
140#endif
Base (virtual) class for all form widgets.
Definition form.h:54
virtual void clearForm()=0
virtual void highlightWidgets(TQWidget *from, TQWidget *to)=0
virtual void initBuffer()=0
virtual void drawRects(const TQValueList< TQRect > &list, int type)=0
A simple class representing a form.
Definition form.h:136
virtual void setValueInternal(const TQVariant &, bool)
no effect
Definition kexidbform.h:118
KexiFormDataItemInterface * editedItem
Definition kexidbform.h:132
TQVariant value()
no effect
Definition kexidbform.h:62
The KexiDataAwareObjectInterface is an interface for record-based data object.
virtual bool cursorAtEnd()=0
virtual bool cursorAtStart()=0
virtual bool isReadOnly() const
virtual bool valueIsNull()=0
virtual bool valueIsEmpty()=0
virtual void clear()=0
clears item's data, so the data will contain NULL data
void setDataSourceMimeType(const TQCString &ds)
void setDataSource(const TQString &ds)
virtual void setInvalidState(const TQString &displayText)=0
virtual void setReadOnly(bool readOnly)=0
KexiFormScrollView class provides a widget for displaying data in a form view.