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