00001 #ifndef _QDBTVALIDATINGCELL_H 00002 #define _QDBTVALIDATINGCELL_H 00003 00004 #include <qrect.h> 00005 #include <qstring.h> 00006 00007 #include "qdbt/qdbtbasecell.h" 00008 00009 class QValidator; 00010 00011 class QDBT_EXPORT QdbtValidatingCell : public QdbtBaseCell 00012 { 00013 QString _value; 00014 QRect _tr; 00015 int _align; 00016 00017 const QValidator *_validator; 00018 int _maxLen; 00019 00020 mutable const QValidator *_editorValidator; 00021 mutable int _editorLen; 00022 00023 public: 00024 QdbtValidatingCell(); 00025 QdbtValidatingCell( const QdbtValidatingCell & ); 00026 QdbtValidatingCell( const QString &, int = -1, const QValidator * = 0, 00027 int = Qt::AlignLeft, bool = FALSE ); 00028 virtual ~QdbtValidatingCell(); 00029 00030 void setText( const QString &value ) { _value = value; } 00031 virtual QString text() const { return _value; } 00032 00033 void setAlignment( int alignment ) { _align = alignment; } 00034 int alignment() const { return _align; } 00035 00036 virtual int widthHint( const QFontMetrics &fm ) const; 00037 virtual int heightHint( const QFontMetrics &fm ) const; 00038 00039 protected: 00040 virtual QWidget *editor( QdbtBaseTabular * ) const; 00041 virtual void paint( QPainter *, QdbtBaseTabular *, const QRect &, bool, 00042 bool = FALSE ); 00043 virtual QRect getTextArea() const; 00044 virtual QRect getEditArea( int ) const; 00045 00046 QdbtBaseCell *clone( QdbtBaseTabular * ) const; 00047 00048 virtual bool beginEdit( QdbtBaseTabular *, int row, int col, 00049 const QRect cellGeometry ) const; 00050 virtual bool acceptEdit( QdbtBaseTabular *, int row, int col ); 00051 virtual bool cancelEdit( QdbtBaseTabular *, int row, int col ); 00052 }; 00053 00054 #endif