00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef OPIE_TABLE_VIEW_H
00032 #define OPIE_TABLE_VIEW_H
00033
00034 #include <qtable.h>
00035 #include <qmap.h>
00036 #include <qpixmap.h>
00037
00038 #include "todoview.h"
00039
00040 class QTimer;
00041
00042 namespace Todo {
00043 class CheckItem;
00044 class DueTextItem;
00045 class TableView : public QTable, public TodoView {
00046 Q_OBJECT
00047 public:
00048 TableView( MainWindow*, QWidget* parent );
00049 ~TableView();
00050
00051
00052 QString type()const;
00053 int current();
00054 QString currentRepresentation();
00055 int next();
00056 int prev();
00057
00058 void clear();
00059 void showOverDue( bool );
00060 void updateView();
00061 void setTodo( int uid, const OPimTodo& );
00062 void addEvent( const OPimTodo& event );
00063 void replaceEvent( const OPimTodo& );
00064 void removeEvent( int uid );
00065 void setShowCompleted( bool );
00066 void setShowDeadline( bool );
00067
00068 void setShowCategory(const QString& =QString::null );
00069 void newDay();
00070 QWidget* widget();
00071 void sortColumn(int, bool, bool );
00072
00073
00074
00075
00076
00077
00078
00079 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
00080 private:
00081
00082 void viewportPaintEvent( QPaintEvent* );
00083 bool m_enablePaint:1;
00084 QString m_oleCat;
00085 bool m_first : 1;
00086
00087 QPixmap m_pic_completed;
00088 QPixmap m_pic_priority[ 5 ];
00089
00090 protected:
00091 void keyPressEvent( QKeyEvent* );
00092 void contentsMouseReleaseEvent( QMouseEvent *e );
00093 void contentsMousePressEvent( QMouseEvent *e );
00094 void timerEvent( QTimerEvent* e );
00095 QWidget* createEditor(int row, int col, bool initFromCell )const;
00096 void setCellContentFromEditor( int row, int col );
00101 struct EditorWidget {
00102 EditorWidget();
00103 void setCellWidget(QWidget*, int row, int col );
00104 void releaseCellWidget();
00105 QWidget* cellWidget()const;
00106 int cellRow()const;
00107 int cellCol()const;
00108 private:
00109 QWidget* m_wid;
00110 int m_row, m_col;
00111 };
00112 EditorWidget m_editorWidget;
00113
00114 private slots:
00115 void slotClicked(int, int, int,
00116 const QPoint& );
00117 void slotPriority();
00118 private:
00119 void initConfig();
00120 int m_completeStrokeWidth;
00121 bool m_row : 1;
00122 QPoint m_prevP;
00123 };
00124 };
00125
00126 #endif