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 <tqframe.h>
00033 #include <tqcolor.h>
00034 #include <tqtooltip.h>
00035 #include <tqmap.h>
00036
00037 class TQDragEnterEvent;
00038 class TQDragMoveEvent;
00039 class TQDragLeaveEvent;
00040 class TQDropEvent;
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( TQWidget *parent );
00065
00066 protected:
00073 void maybeTip( const TQPoint &pos );
00074
00075 private:
00077 KODayMatrix *mMatrix;
00078 };
00079
00105 class KODayMatrix: public TQFrame, public KCal::Calendar::Observer
00106 {
00107 Q_OBJECT
00108 public:
00115 KODayMatrix( TQWidget *parent, const char *name );
00116
00119 ~KODayMatrix();
00120
00124 static QPair<TQDate,TQDate> matrixLimits( const TQDate &month );
00125
00130 void setCalendar( Calendar * );
00131
00139 void updateView( const TQDate &actdate );
00140
00145 void updateEvents();
00146
00150 const TQDate& getDate( int offset );
00151
00155 TQString getHolidayLabel( int offset );
00156
00160 void addSelectedDaysTo( DateList & );
00161
00166 void setSelectedDaysFrom( const TQDate &start, const TQDate &end );
00167
00171 void clearSelection();
00172
00176 bool isTodayVisible() const { return mToday >= 0; }
00177
00184 bool isBeginningOfMonth() const { return mToday <= 8; }
00185 bool isEndOfMonth() const { return mToday >= 27; }
00186
00187
00188 void calendarIncidenceAdded( Incidence *incidence );
00189 void calendarIncidenceChanged( Incidence *incidence );
00190 void calendarIncidenceDeleted( Incidence *incidence );
00191
00192 void setUpdateNeeded();
00193
00194 public slots:
00198 void updateView();
00199
00204 void recalculateToday();
00205
00209 void resourcesChanged();
00210
00211 signals:
00217 void selected( const KCal::DateList &daylist );
00218
00224 void incidenceDropped( Incidence *incidence, const TQDate &dt );
00230 void incidenceDroppedMove( Incidence *oldincidence, const TQDate &dt );
00231
00232 protected:
00233 void paintEvent( TQPaintEvent *ev );
00234
00235 void mousePressEvent( TQMouseEvent *e );
00236
00237 void mouseReleaseEvent( TQMouseEvent *e );
00238
00239 void mouseMoveEvent( TQMouseEvent *e );
00240
00241 void dragEnterEvent( TQDragEnterEvent * );
00242
00243 void dragMoveEvent( TQDragMoveEvent * );
00244
00245 void dragLeaveEvent( TQDragLeaveEvent * );
00246
00247 void dropEvent( TQDropEvent * );
00248
00249 void resizeEvent( TQResizeEvent * );
00250
00251 private:
00257 int getDayIndexFrom( int x, int y );
00258
00264 TQColor getShadedColor( const TQColor &color );
00265
00268 static const int NUMDAYS;
00269
00271 Calendar *mCalendar;
00272
00274 TQDate mStartDate;
00275
00277 TQString *mDayLabels;
00278
00281 TQDate *mDays;
00282
00286 int *mEvents;
00287
00289 TQMap<int,TQString> mHolidays;
00290
00292 int mToday;
00293
00296 int mSelInit;
00297
00300 static const int NOSELECTION;
00301
00303 int mSelStart;
00304
00306 int mSelEnd;
00307
00309 DynamicTip* mToolTip;
00310
00312 int mTodayMarginWidth;
00313
00317 TQRect mDaySize;
00318
00322 bool mPendingChanges;
00323 };
00324
00325 #endif
|