kexi

kexitimetableedit.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004,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 KEXITIMETABLEEDIT_H
00021 #define KEXITIMETABLEEDIT_H
00022 
00023 #include <qregexp.h>
00024 
00025 #include "kexiinputtableedit.h"
00026 
00030 class KEXIDATATABLE_EXPORT KexiTimeFormatter
00031 {
00032     public:
00034         KexiTimeFormatter();
00035 
00038 
00039         ~KexiTimeFormatter();
00040 
00043         QTime stringToTime( const QString& str );
00044 
00047         QString timeToString( const QTime& time ) const;
00048 
00051         QString inputMask() const { return m_inputMask; }
00052 
00053     protected:
00055         QString m_inputMask;
00056 
00057 //      //! Order of date sections
00058 //      QDateEdit::Order m_order;
00059 
00061         bool m_24h;
00062 
00063         bool m_hoursWithLeadingZero;
00064 
00066         QString m_outputFormat;
00067 
00069         int m_hourpos, m_minpos, m_secpos, m_ampmpos;
00070 
00071         QRegExp m_hmsRegExp, m_hmRegExp;
00072 };
00073 
00080 class KEXIDATATABLE_EXPORT KexiTimeTableEdit : public KexiInputTableEdit
00081 {
00082     Q_OBJECT
00083 
00084     public:
00085         KexiTimeTableEdit(KexiTableViewColumn &column, QScrollView *parent=0);
00086         virtual ~KexiTimeTableEdit();
00087         virtual void setupContents( QPainter *p, bool focused, QVariant val, 
00088             QString &txt, int &align, int &x, int &y_offset, int &w, int &h );
00089         virtual QVariant value();
00090         virtual bool valueIsNull();
00091         virtual bool valueIsEmpty();
00092         virtual bool valueIsValid();
00093 
00094     protected:
00095         virtual void setValueInternal(const QVariant& add, bool removeOld);
00096         QTime timeValue();
00097 
00099         KexiTimeFormatter m_formatter;
00100 };
00101 
00102 KEXI_DECLARE_CELLEDITOR_FACTORY_ITEM(KexiTimeEditorFactoryItem)
00103 
00104 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys