korganizer
kodaymatrix.h00001
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 #ifndef KODAYMATRIX_H
00027 #define KODAYMATRIX_H
00028
00029 #include <libkcal/incidencebase.h>
00030
00031 #include <qframe.h>
00032 #include <qcolor.h>
00033 #include <qtooltip.h>
00034 #include <qmap.h>
00035
00036 class QDragEnterEvent;
00037 class QDragMoveEvent;
00038 class QDragLeaveEvent;
00039 class QDropEvent;
00040
00041 class KODayMatrix;
00042
00043 namespace KCal {
00044 class Incidence;
00045 class Calendar;
00046 }
00047 using namespace KCal;
00048
00049
00055 class DynamicTip : public QToolTip
00056 {
00057 public:
00063 DynamicTip( QWidget *parent );
00064
00065 protected:
00072 void maybeTip( const QPoint &pos );
00073
00074 private:
00076 KODayMatrix *mMatrix;
00077 };
00078
00104 class KODayMatrix: public QFrame
00105 {
00106 Q_OBJECT
00107 public:
00114 KODayMatrix( QWidget *parent, const char *name );
00115
00118 ~KODayMatrix();
00119
00124 void setCalendar( Calendar * );
00125
00133 void updateView( const QDate &actdate );
00134
00139 void updateEvents();
00140
00144 const QDate& getDate( int offset );
00145
00149 QString getHolidayLabel( int offset );
00150
00154 void addSelectedDaysTo( DateList & );
00155
00160 void setSelectedDaysFrom( const QDate &start, const QDate &end );
00161
00165 void clearSelection();
00166
00170 bool isTodayVisible() const { return mToday >= 0; }
00171
00178 bool isBeginningOfMonth() const { return mToday <= 8; }
00179 bool isEndOfMonth() const { return mToday >= 27; }
00180
00181 public slots:
00185 void updateView();
00186
00191 void recalculateToday();
00192
00193 signals:
00199 void selected( const KCal::DateList &daylist );
00200
00206 void incidenceDropped( Incidence *incidence, const QDate &dt );
00212 void incidenceDroppedMove( Incidence *oldincidence, const QDate &dt );
00213
00214 protected:
00215 void paintEvent( QPaintEvent *ev );
00216
00217 void mousePressEvent( QMouseEvent *e );
00218
00219 void mouseReleaseEvent( QMouseEvent *e );
00220
00221 void mouseMoveEvent( QMouseEvent *e );
00222
00223 void dragEnterEvent( QDragEnterEvent * );
00224
00225 void dragMoveEvent( QDragMoveEvent * );
00226
00227 void dragLeaveEvent( QDragLeaveEvent * );
00228
00229 void dropEvent( QDropEvent * );
00230
00231 void resizeEvent( QResizeEvent * );
00232
00233 private:
00239 int getDayIndexFrom( int x, int y );
00240
00246 QColor getShadedColor( const QColor &color );
00247
00250 static const int NUMDAYS;
00251
00253 Calendar *mCalendar;
00254
00256 QDate mStartDate;
00257
00259 QString *mDayLabels;
00260
00263 QDate *mDays;
00264
00268 int *mEvents;
00269
00271 QMap<int,QString> mHolidays;
00272
00274 int mToday;
00275
00278 int mSelInit;
00279
00282 static const int NOSELECTION;
00283
00285 int mSelStart;
00286
00288 int mSelEnd;
00289
00291 DynamicTip* mToolTip;
00292
00294 int mTodayMarginWidth;
00295
00299 QRect mDaySize;
00300 };
00301
00302 #endif
|