kexi
kexiinputtableedit.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2002 Lucijan Busch <lucijan@gmx.at> 00003 Copyright (C) 2003-2004 Jaroslaw Staniek <js@iidea.pl> 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this program; see the file COPYING. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KEXIINPUTTABLEEDIT_H 00022 #define KEXIINPUTTABLEEDIT_H 00023 00024 #include <klineedit.h> 00025 #include <qvariant.h> 00026 00027 #include "kexitableedit.h" 00028 #include "kexicelleditorfactory.h" 00029 00032 class KexiInputTableEdit : public KexiTableEdit 00033 { 00034 Q_OBJECT 00035 00036 public: 00037 KexiInputTableEdit(KexiTableViewColumn &column, QWidget *parent=0); 00038 00039 virtual ~KexiInputTableEdit(); 00040 00041 virtual bool valueChanged(); 00042 00044 virtual bool valueIsNull(); 00045 00049 virtual bool valueIsEmpty(); 00050 00051 virtual QVariant value(); 00052 00053 virtual bool cursorAtStart(); 00054 virtual bool cursorAtEnd(); 00055 00056 // virtual bool eventFilter(QObject* watched, QEvent* e); 00057 //js void end(bool mark); 00058 //js void backspace(); 00059 virtual void clear(); 00060 00062 virtual QSize totalSize(); 00063 00066 virtual void handleAction(const QString& actionName); 00067 00071 virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); 00072 00080 virtual bool showToolTipIfNeeded(const QVariant& value, const QRect& rect, const QFontMetrics& fm, 00081 bool focused); 00082 00083 public slots: 00085 virtual void moveCursorToEnd(); 00086 00088 virtual void moveCursorToStart(); 00089 00091 virtual void selectAll(); 00092 00093 protected slots: 00094 void setRestrictedCompletion(); 00095 void completed(const QString &); 00096 00097 protected: 00099 virtual void setValueInternal(const QVariant& add, bool removeOld); 00100 00101 void showHintButton(); 00102 void init(); 00103 virtual void paintEvent( QPaintEvent *e ); 00104 00108 QString valueToText(const QVariant& value, const QString& add, bool setValidator = false); 00109 00110 bool m_calculatedCell; 00111 QString m_decsym; 00112 QString m_origText; 00113 KLineEdit *m_lineedit; 00114 00115 signals: 00116 void hintClicked(); 00117 }; 00118 00119 KEXI_DECLARE_CELLEDITOR_FACTORY_ITEM(KexiInputEditorFactoryItem) 00120 00121 #endif