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 #include <libkcal/calendar.h>
00031
00032 #include <qframe.h>
00033 #include <qcolor.h>
00034 #include <qtooltip.h>
00035 #include <qmap.h>
00036
00037 class QDragEnterEvent;
00038 class QDragMoveEvent;
00039 class QDragLeaveEvent;
00040 class QDropEvent;
00041
00042 class KODayMatrix;
00043
00044 namespace KCal {
00045 class Incidence;
00046 class Calendar;
00047 }
00048 using namespace KCal;
00049
00050
00056 class DynamicTip : public QToolTip
00057 {
00058 public:
00064 DynamicTip( QWidget *parent );
00065
00066 protected:
00073 void maybeTip( const QPoint &pos );
00074
00075 private:
00077 KODayMatrix *mMatrix;
00078 };
00079
00105 class KODayMatrix: public QFrame, public KCal::Calendar::Observer
00106 {
00107 Q_OBJECT
00108 public:
00115 KODayMatrix( QWidget *parent, const char *name );
00116
00119 ~KODayMatrix();
00120
00125 void setCalendar( Calendar * );
00126
00134 void updateView( const QDate &actdate );
00135
00140 void updateEvents();
00141
00145 const QDate& getDate( int offset );
00146
00150 QString getHolidayLabel( int offset );
00151
00155 void addSelectedDaysTo( DateList & );
00156
00161 void setSelectedDaysFrom( const QDate &start, const QDate &end );
00162
00166 void clearSelection();
00167
00171 bool isTodayVisible() const { return mToday >= 0; }
00172
00179 bool isBeginningOfMonth() const { return mToday <= 8; }
00180 bool isEndOfMonth() const { return mToday >= 27; }
00181
00182
00183 void calendarIncidenceAdded( Incidence *incidence );
00184 void calendarIncidenceChanged( Incidence *incidence );
00185 void calendarIncidenceRemoved( Incidence *incidence );
00186
00187 public slots:
00191 void updateView();
00192
00197 void recalculateToday();
00198
00202 void resourcesChanged();
00203
00204 signals:
00210 void selected( const KCal::DateList &daylist );
00211
00217 void incidenceDropped( Incidence *incidence, const QDate &dt );
00223 void incidenceDroppedMove( Incidence *oldincidence, const QDate &dt );
00224
00225 protected:
00226 void paintEvent( QPaintEvent *ev );
00227
00228 void mousePressEvent( QMouseEvent *e );
00229
00230 void mouseReleaseEvent( QMouseEvent *e );
00231
00232 void mouseMoveEvent( QMouseEvent *e );
00233
00234 void dragEnterEvent( QDragEnterEvent * );
00235
00236 void dragMoveEvent( QDragMoveEvent * );
00237
00238 void dragLeaveEvent( QDragLeaveEvent * );
00239
00240 void dropEvent( QDropEvent * );
00241
00242 void resizeEvent( QResizeEvent * );
00243
00244 private:
00250 int getDayIndexFrom( int x, int y );
00251
00257 QColor getShadedColor( const QColor &color );
00258
00261 static const int NUMDAYS;
00262
00264 Calendar *mCalendar;
00265
00267 QDate mStartDate;
00268
00270 QString *mDayLabels;
00271
00274 QDate *mDays;
00275
00279 int *mEvents;
00280
00282 QMap<int,QString> mHolidays;
00283
00285 int mToday;
00286
00289 int mSelInit;
00290
00293 static const int NOSELECTION;
00294
00296 int mSelStart;
00297
00299 int mSelEnd;
00300
00302 DynamicTip* mToolTip;
00303
00305 int mTodayMarginWidth;
00306
00310 QRect mDaySize;
00311
00315 bool mPendingChanges;
00316 };
00317
00318 #endif
|