kexiformdataiteminterface.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2005-2006 Jaroslaw Staniek <js@iidea.pl> 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this program; see the file COPYING. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KEXIFORMDATAITEMINTERFACE_H 00021 #define KEXIFORMDATAITEMINTERFACE_H 00022 00023 #include <widget/utils/kexidisplayutils.h> 00024 #include <kexidataiteminterface.h> 00025 #include <qwidget.h> 00026 00027 namespace KexiDB { 00028 class Field; 00029 } 00030 00032 class KEXIFORMUTILS_EXPORT KexiFormDataItemInterface : public KexiDataItemInterface 00033 { 00034 public: 00035 KexiFormDataItemInterface(); 00036 virtual ~KexiFormDataItemInterface(); 00037 00040 inline QString dataSource() const { return m_dataSource; } 00041 00044 inline void setDataSource(const QString &ds) { m_dataSource = ds; } 00045 00050 inline QCString dataSourceMimeType() const { return m_dataSourceMimeType; } 00051 00055 inline void setDataSourceMimeType(const QCString &ds) { m_dataSourceMimeType = ds; } 00056 00063 virtual void setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue); 00064 00066 virtual bool hasDisplayedDefaultValue() const { return m_displayDefaultValue; } 00067 00070 virtual QWidget* widget() { return dynamic_cast<QWidget*>(this); } 00071 00079 virtual void setInvalidState( const QString& displayText ) = 0; 00080 00084 virtual void setReadOnly( bool readOnly ) = 0; 00085 00087 virtual KexiDB::Field* field() const; 00088 00090 virtual KexiDB::QueryColumnInfo* columnInfo() const { return m_columnInfo; } 00091 00096 virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo) { m_columnInfo = cinfo; } 00097 00100 virtual void setVisibleColumnInfo(KexiDB::QueryColumnInfo* cinfo) { Q_UNUSED(cinfo); } 00101 00104 virtual KexiDB::QueryColumnInfo* visibleColumnInfo() const { return columnInfo(); } 00105 00107 virtual void hideWidget() { } 00108 00110 virtual void showWidget() { } 00111 00118 virtual void undoChanges(); 00119 00120 /* Cancels editing of the widget's data. This method just looks for 00121 the (grand)parent KexiFormScrollView object and calls 00122 KexiFormScrollView::cancelEditor(). */ 00123 void cancelEditor(); 00124 00132 virtual bool keyPressed(QKeyEvent *ke) { Q_UNUSED(ke); return false; }; 00133 00134 protected: 00135 QString m_dataSource; 00136 QCString m_dataSourceMimeType; 00137 KexiDB::QueryColumnInfo* m_columnInfo; 00138 KexiDisplayUtils::DisplayParameters *m_displayParametersForEnteredValue; 00139 KexiDisplayUtils::DisplayParameters *m_displayParametersForDefaultValue; 00140 bool m_displayDefaultValue : 1; 00141 00142 friend class KexiDBAutoField; 00143 }; 00144 00145 #endif
