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-2007 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 #include "kexitextformatter.h"
00030 
00033 class KEXIDATATABLE_EXPORT KexiInputTableEdit : public KexiTableEdit
00034 {
00035     Q_OBJECT
00036 
00037     public:
00038         KexiInputTableEdit(KexiTableViewColumn &column, QWidget *parent=0);
00039 
00040         virtual ~KexiInputTableEdit();
00041 
00042 #if 0
00043 //moved to KexiTextFormatter
00047         static QString valueToText(KexiDB::Field* field, const QVariant& value, const QString& add);
00048 #endif
00049 
00050         virtual bool valueChanged();
00051 
00053         virtual bool valueIsNull();
00054 
00058         virtual bool valueIsEmpty();
00059 
00060         virtual QVariant value();
00061 
00062         virtual bool cursorAtStart();
00063         virtual bool cursorAtEnd();
00064 
00065 //      virtual bool eventFilter(QObject* watched, QEvent* e);
00066 //js        void end(bool mark);
00067 //js        void backspace();
00068         virtual void clear();
00069 
00071         virtual QSize totalSize();
00072 
00075         virtual void handleAction(const QString& actionName);
00076 
00080         virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue);
00081 
00089         virtual bool showToolTipIfNeeded(const QVariant& value, const QRect& rect, const QFontMetrics& fm,
00090             bool focused);
00091 
00092     public slots:
00094         virtual void moveCursorToEnd();
00095 
00097         virtual void moveCursorToStart();
00098 
00100         virtual void selectAll();
00101 
00102     protected slots:
00103         void setRestrictedCompletion();
00104         void completed(const QString &);
00105 
00106     protected:
00108         virtual void setValueInternal(const QVariant& add, bool removeOld);
00109 
00110         void showHintButton();
00111         void init();
00112         virtual void paintEvent( QPaintEvent *e );
00113 
00114         KexiTextFormatter m_textFormatter;
00115         bool m_calculatedCell;
00116         QString m_decsym; 
00117         QString m_origText; 
00118         KLineEdit *m_lineedit;
00119 
00120     signals:
00121         void hintClicked();
00122 };
00123 
00124 KEXI_DECLARE_CELLEDITOR_FACTORY_ITEM(KexiInputEditorFactoryItem)
00125 
00126 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys