kodaymatrix.h
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 #ifndef KODAYMATRIX_H
00026 #define KODAYMATRIX_H
00027
00028 #include <libkcal/incidencebase.h>
00029
00030 #include <qframe.h>
00031 #include <qcolor.h>
00032 #include <qtooltip.h>
00033 #include <qmap.h>
00034
00035 class QDragEnterEvent;
00036 class QDragMoveEvent;
00037 class QDragLeaveEvent;
00038 class QDropEvent;
00039
00040 class KODayMatrix;
00041
00042 namespace KCal {
00043 class Incidence;
00044 class Calendar;
00045 }
00046 using namespace KCal;
00047
00048
00054 class DynamicTip : public QToolTip
00055 {
00056 public:
00062 DynamicTip( QWidget *parent );
00063
00064 protected:
00071 void maybeTip( const QPoint &pos );
00072
00073 private:
00075 KODayMatrix *mMatrix;
00076 };
00077
00103 class KODayMatrix: public QFrame
00104 {
00105 Q_OBJECT
00106 public:
00116 KODayMatrix( QWidget *parent, const char *name );
00117
00120 ~KODayMatrix();
00121
00126 void setCalendar( Calendar * );
00127
00135 void updateView( QDate actdate );
00136
00141 void updateEvents();
00142
00146 const QDate& getDate( int offset );
00147
00151 QString getHolidayLabel( int offset );
00152
00156 void addSelectedDaysTo( DateList & );
00157
00162 void setSelectedDaysFrom( const QDate &start, const QDate &end );
00163
00167 void clearSelection();
00168
00172 bool isTodayVisible() const { return mToday >= 0; }
00173
00180 bool isBeginningOfMonth() const { return mToday <= 8; }
00181 bool isEndOfMonth() const { return mToday >= 27; }
00182
00183 public slots:
00187 void updateView();
00188
00193 void recalculateToday();
00194
00195 signals:
00201 void selected( const KCal::DateList &daylist );
00202
00207 void incidenceDropped( Incidence * );
00213 void incidenceDroppedMove( Incidence *oldincidence, Incidence *newincidence );
00214
00215 protected:
00216 void paintEvent( QPaintEvent *ev );
00217
00218 void mousePressEvent( QMouseEvent *e );
00219
00220 void mouseReleaseEvent( QMouseEvent *e );
00221
00222 void mouseMoveEvent( QMouseEvent *e );
00223
00224 void dragEnterEvent( QDragEnterEvent * );
00225
00226 void dragMoveEvent( QDragMoveEvent * );
00227
00228 void dragLeaveEvent( QDragLeaveEvent * );
00229
00230 void dropEvent( QDropEvent * );
00231
00232 void resizeEvent( QResizeEvent * );
00233
00234 private:
00240 int getDayIndexFrom( int x, int y );
00241
00247 QColor getShadedColor( QColor color );
00248
00251 static const int NUMDAYS;
00252
00254 Calendar *mCalendar;
00255
00257 QDate mStartDate;
00258
00260 QString *mDayLabels;
00261
00264 QDate *mDays;
00265
00269 int *mEvents;
00270
00272 QMap<int,QString> mHolidays;
00273
00275 int mToday;
00276
00279 int mSelInit;
00280
00283 static const int NOSELECTION;
00284
00286 int mSelStart;
00287
00289 int mSelEnd;
00290
00292 DynamicTip* mToolTip;
00293
00294
00296 QColor mDefaultBackColor;
00297
00299 QColor mDefaultTextColor;
00300
00302 QColor mDefaultTextColorShaded;
00303
00305 QColor mHolidayColorShaded;
00306
00308 QColor mSelectedDaysColor;
00309
00311 int mTodayMarginWidth;
00312
00316 QRect mDaySize;
00317 };
00318
00319 #endif
This file is part of the documentation for korganizer Library Version 3.3.2.