kexiformdataiteminterface.h
1/* This file is part of the KDE project
2 Copyright (C) 2005-2006 Jaroslaw Staniek <js@iidea.pl>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef KEXIFORMDATAITEMINTERFACE_H
21#define KEXIFORMDATAITEMINTERFACE_H
22
23#include <widget/utils/kexidisplayutils.h>
24#include <kexidataiteminterface.h>
25#include <tqwidget.h>
26
27namespace KexiDB {
28 class Field;
29}
30
32class KEXIFORMUTILS_EXPORT KexiFormDataItemInterface : public KexiDataItemInterface
33{
34 public:
37
40 inline TQString dataSource() const { return m_dataSource; }
41
44 inline void setDataSource(const TQString &ds) { m_dataSource = ds; }
45
50 inline TQCString dataSourceMimeType() const { return m_dataSourceMimeType; }
51
55 inline void setDataSourceMimeType(const TQCString &ds) { m_dataSourceMimeType = ds; }
56
63 virtual void setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue);
64
66 virtual bool hasDisplayedDefaultValue() const { return m_displayDefaultValue; }
67
70 virtual TQWidget* widget() { return dynamic_cast<TQWidget*>(this); }
71
79 virtual void setInvalidState( const TQString& displayText ) = 0;
80
84 virtual void setReadOnly( bool readOnly ) = 0;
85
87 virtual KexiDB::Field* field() const;
88
90 virtual KexiDB::QueryColumnInfo* columnInfo() const { return m_columnInfo; }
91
96 virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo) { m_columnInfo = cinfo; }
97
100 virtual void setVisibleColumnInfo(KexiDB::QueryColumnInfo* cinfo) { Q_UNUSED(cinfo); }
101
105
107 virtual void hideWidget() { }
108
110 virtual void showWidget() { }
111
118 virtual void undoChanges();
119
120 /* Cancels editing of the widget's data. This method just looks for
121 the (grand)parent KexiFormScrollView object and calls
122 KexiFormScrollView::cancelEditor(). */
123 void cancelEditor();
124
132 virtual bool keyPressed(TQKeyEvent *ke) { Q_UNUSED(ke); return false; };
133
134 protected:
135 TQString m_dataSource;
136 TQCString m_dataSourceMimeType;
137 KexiDB::QueryColumnInfo* m_columnInfo;
141
142 friend class KexiDBAutoField;
143};
144
145#endif
Universal "Auto Field" widget for Kexi forms.
Meta-data for a field.
Definition field.h:73
Helper class that assigns additional information for the column in a query.
Definition queryschema.h:49
An interface for declaring widgets to be data-aware.
virtual KexiDB::Field * field() const =0
virtual KexiDB::QueryColumnInfo * columnInfo() const =0
Stores set of display parameters used in utility functions.
An interface for declaring form widgets to be data-aware.
virtual KexiDB::QueryColumnInfo * columnInfo() const
virtual void setVisibleColumnInfo(KexiDB::QueryColumnInfo *cinfo)
void setDataSourceMimeType(const TQCString &ds)
virtual void setColumnInfo(KexiDB::QueryColumnInfo *cinfo)
virtual bool hasDisplayedDefaultValue() const
virtual KexiDB::QueryColumnInfo * visibleColumnInfo() const
KexiDisplayUtils::DisplayParameters * m_displayParametersForEnteredValue
used in setDisplayDefaultValue()
void setDataSource(const TQString &ds)
Sets the name of the data source for this widget.
KexiDisplayUtils::DisplayParameters * m_displayParametersForDefaultValue
used in setDisplayDefaultValue()
bool m_displayDefaultValue
used by setDisplayDefaultValue()
virtual void setInvalidState(const TQString &displayText)=0
virtual void setReadOnly(bool readOnly)=0
High-level database connectivity library with database backend drivers.