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,
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
128// virtual void paintEvent( TQPaintEvent * );
129
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
A DB-aware form widget, acting as form's toplevel widget.
Definition kexidbform.h:44
virtual void clear()
clears item's data, so the data will contain NULL data
virtual void setReadOnly(bool readOnly)
This implementation just disables read only widget.
virtual bool cursorAtEnd()
virtual bool cursorAtStart()
virtual void setValueInternal(const TQVariant &, bool)
no effect
Definition kexidbform.h:118
virtual bool valueIsNull()
virtual bool valueIsEmpty()
KexiFormDataItemInterface * editedItem
Points to a currently edited data item.
Definition kexidbform.h:132
virtual void dragMoveEvent(TQDragMoveEvent *e)
Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface.
void updateReadOnlyFlags()
called from KexiFormScrollView::initDataContents()
TQVariant value()
no effect
Definition kexidbform.h:62
virtual void dropEvent(TQDropEvent *e)
Used to emit handleDropEvent() signal needed to control dropping on the container's surface.
virtual TQWidget * widget()
virtual bool isReadOnly() const
The KexiDataAwareObjectInterface is an interface for record-based data object.
An interface for declaring form widgets to be data-aware.
void setDataSourceMimeType(const TQCString &ds)
void setDataSource(const TQString &ds)
Sets the name of the data source for this widget.
virtual void setInvalidState(const TQString &displayText)=0
KexiFormScrollView class provides a widget for displaying data in a form view.
type * findParent(TQObject *o, const char *className, TQObject *&prevPrev)