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 TQToolTip
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 TQ_OBJECT
00109 public:
00116 KODayMatrix( TQWidget *parent, const char *name );
00117
00120 ~KODayMatrix();
00121
00125 static TQPair<TQDate,TQDate> matrixLimits( const TQDate &month );
00126
00131 void setCalendar( Calendar * );
00132
00140 void updateView( const TQDate &actdate );
00141
00146 void updateEvents();
00147
00151 const TQDate& getDate( int offset );
00152
00156 TQString getHolidayLabel( int offset );
00157
00161 void addSelectedDaysTo( DateList & );
00162
00167 void setSelectedDaysFrom( const TQDate &start, const TQDate &end );
00168
00172 void clearSelection();
00173
00177 bool isTodayVisible() const { return mToday >= 0; }
00178
00185 bool isBeginningOfMonth() const { return mToday <= 8; }
00186 bool isEndOfMonth() const { return mToday >= 27; }
00187
00188
00189 void calendarIncidenceAdded( Incidence *incidence );
00190 void calendarIncidenceChanged( Incidence *incidence );
00191 void calendarIncidenceDeleted( Incidence *incidence );
00192
00193 void setUpdateNeeded();
00194
00195 public slots:
00199 void updateView();
00200
00205 void recalculateToday();
00206
00210 void resourcesChanged();
00211
00212 signals:
00218 void selected( const KCal::DateList &daylist );
00219
00225 void incidenceDropped( Incidence *incidence, const TQDate &dt );
00231 void incidenceDroppedMove( Incidence *oldincidence, const TQDate &dt );
00232
00233 protected:
00234 void paintEvent( TQPaintEvent *ev );
00235
00236 void mousePressEvent( TQMouseEvent *e );
00237
00238 void mouseReleaseEvent( TQMouseEvent *e );
00239
00240 void mouseMoveEvent( TQMouseEvent *e );
00241
00242 void dragEnterEvent( TQDragEnterEvent * );
00243
00244 void dragMoveEvent( TQDragMoveEvent * );
00245
00246 void dragLeaveEvent( TQDragLeaveEvent * );
00247
00248 void dropEvent( TQDropEvent * );
00249
00250 void resizeEvent( TQResizeEvent * );
00251
00252 private:
00258 int getDayIndexFrom( int x, int y );
00259
00265 TQColor getShadedColor( const TQColor &color );
00266
00269 static const int NUMDAYS;
00270
00272 Calendar *mCalendar;
00273
00275 TQDate mStartDate;
00276
00278 TQString *mDayLabels;
00279
00282 TQDate *mDays;
00283
00287 int *mEvents;
00288
00290 TQMap<int,TQString> mHolidays;
00291
00293 int mToday;
00294
00297 int mSelInit;
00298
00301 static const int NOSELECTION;
00302
00304 int mSelStart;
00305
00307 int mSelEnd;
00308
00310 DynamicTip* mToolTip;
00311
00313 int mTodayMarginWidth;
00314
00318 TQRect mDaySize;
00319
00323 bool mPendingChanges;
00324 };
00325
00326 #endif
|