00001 #ifndef _QDBTCOMBOCELL_H 00002 #define _QDBTCOMBOCELL_H 00003 00004 #include <qrect.h> 00005 00006 #include <qdbt/qdbtglobal.h> 00007 #include "qdbtintcell.h" 00008 00009 class QPainter; 00010 class QString; 00011 class QStringList; 00012 class QdbtComboEditor; 00013 class QdbtBaseTabular; 00014 00015 class QDBT_EXPORT QdbtComboCell : public QdbtIntCell 00016 { 00017 public: 00018 QdbtComboCell(); 00019 QdbtComboCell( const QdbtComboCell & ); 00020 QdbtComboCell( int value, int align = Qt::AlignLeft ); 00021 virtual ~QdbtComboCell(); 00022 00023 virtual QString text() const; 00024 00025 virtual int widthHint( const QFontMetrics &fm ) const; 00026 virtual int heightHint( const QFontMetrics &fm ) const; 00027 00028 enum paintModifiers 00029 { 00030 NO_MODIF = 0x0000, 00031 SUPRESS_BORDER = 0x0001 00032 }; 00033 00034 protected: 00035 virtual QWidget *editor( QdbtBaseTabular * ) const; 00036 virtual void paint( QPainter *p, QdbtBaseTabular *t, const QRect & r, 00037 bool selected, bool editing = FALSE ); 00038 virtual void paintFocus( QPainter *p, QdbtBaseTabular *t, const QRect & r, 00039 bool, bool = FALSE ); 00040 virtual QRect getTextArea() const; 00041 virtual QRect getEditArea( int width ) const; 00042 virtual QdbtBaseCell *clone( QdbtBaseTabular * ) const; 00043 00044 virtual bool beginEdit( QdbtBaseTabular *, int row, int col, 00045 const QRect cellGeometry ) const; 00046 virtual bool acceptEdit( QdbtBaseTabular *, int row, int col ); 00047 virtual bool cancelEdit( QdbtBaseTabular *, int row, int col ); 00048 virtual bool mouseEvent( QdbtBaseTabular *, int row, int col, 00049 QMouseEvent *e, const QRect cellGeometry ); 00050 virtual bool keyEvent( QdbtBaseTabular *, int row, int col, 00051 QKeyEvent *e, const QRect cellGeometry ); 00052 00053 virtual QStringList contentOfPopupMenu() const; 00054 00055 void paintMethod( QPainter *p, QdbtBaseTabular *t, const QRect & r, 00056 bool selected, bool editing = FALSE, 00057 int modif = NO_MODIF ); 00058 void paintFocusMethod( QPainter *p, QdbtBaseTabular *t, const QRect & r, 00059 bool, bool = FALSE, int modif = NO_MODIF ); 00060 00061 private: 00062 QRect tr; 00063 }; 00064 00065 class QDBT_EXPORT QdbtBorderlessComboCell : public QdbtComboCell 00066 { 00067 public: 00068 QdbtBorderlessComboCell(); 00069 QdbtBorderlessComboCell( const QdbtBorderlessComboCell & ); 00070 QdbtBorderlessComboCell( int value, int align = Qt::AlignLeft ); 00071 virtual ~QdbtBorderlessComboCell(); 00072 00073 virtual int heightHint( const QFontMetrics &fm ) const; 00074 00075 protected: 00076 virtual QdbtBaseCell *clone( QdbtBaseTabular * ) const; 00077 virtual void paint( QPainter *p, QdbtBaseTabular *t, const QRect & r, 00078 bool selected, bool editing = FALSE ); 00079 virtual void paintFocus( QPainter *p, QdbtBaseTabular *t, const QRect & r, 00080 bool, bool = FALSE ); 00081 00082 }; 00083 00084 00085 #endif