00001 #ifndef _QDBTCASCADE_H
00002 #define _QDBTCASCADE_H
00003
00004 #include <qwidget.h>
00005 #include <qarray.h>
00006 #include <qcursor.h>
00007
00008 #include <qdbt/qdbtglobal.h>
00009
00010 class QFont;
00011
00012 class QdbtHeader;
00013 class QdbtBaseTabular;
00014 class QdbtPImpl;
00015
00016 class QdbtCascade : public QWidget
00017 {
00018 Q_OBJECT
00019
00020 QdbtCascade( const QdbtCascade & );
00021 void operator=( const QdbtCascade & );
00022
00023 struct QdbtCascadeCell
00024 {
00025 int cellWidth;
00026 QString *cellText;
00027 int cellMode;
00028 int cellAlignment;
00029 int position;
00030 };
00031
00032 int _barHeight, _xOffset, _divider;
00033 QArray<QdbtCascadeCell> _cascadeCells;
00034 QCursor _cursorShape;
00035 QdbtPImpl * _pimpl;
00036
00037 public:
00038 QdbtCascade( QdbtPImpl * pimpl );
00039 ~QdbtCascade();
00040
00041 void setFont( const QFont &font );
00042 int height();
00043 int nrOfColumns();
00044
00045 int columnWidth( int column ) const;
00046
00047 public slots:
00048 void setXOffset( int d );
00049 void setColumnWidth( int c, int w, bool update );
00050 void setColumnWidth( int c, int w );
00051 void setNrOfColumns( int cnt, bool update = TRUE );
00052 void insertCol( int col, bool update = TRUE );
00053 void removeCol( int col, bool update = TRUE );
00054
00055 void setColMode( int col, const int &mode, bool update = TRUE );
00056 void setColText( int col, const QString &text, bool update = TRUE );
00057 void setColAlignment( int col, int alignment, bool update = TRUE );
00058 void resizeSection( int x );
00059
00060 protected:
00061 virtual void paintEvent( QPaintEvent * );
00062 void mousePressEvent( QMouseEvent * );
00063 void mouseReleaseEvent( QMouseEvent * );
00064 void mouseMoveEvent( QMouseEvent * );
00065
00066 private:
00067 void computeHeight();
00068 void updateDividerCursor( int mouseX );
00069 };
00070
00071 #endif // QDBTCASCADE_H