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 #ifndef _KODAYMAT_H
00024 #define _KODAYMAT_H
00025
00026 #include <libkcal/calendar.h>
00027
00028 #include <qstring.h>
00029 #include <qframe.h>
00030 #include <qcolor.h>
00031 #include <qpen.h>
00032 #include <qdatetime.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 using namespace KCal;
00044
00045
00051 class DynamicTip : public QToolTip
00052 {
00053 public:
00054
00060 DynamicTip(QWidget* parent );
00061
00062 protected:
00063
00070 void maybeTip( const QPoint & pos);
00071
00072 private:
00073
00075 KODayMatrix* matrix;
00076 };
00077
00103 class KODayMatrix: public QFrame {
00104
00105 Q_OBJECT
00106
00107 public:
00108
00118 KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name );
00119
00122 ~KODayMatrix();
00123
00131 void updateView(QDate actdate);
00132
00136 const QDate& getDate(int offset);
00137
00141 QString getHolidayLabel(int offset);
00142
00146 void addSelectedDaysTo(DateList&);
00147
00152 void setSelectedDaysFrom(const QDate& start, const QDate& end);
00153
00154
00158 bool isTodayVisible() const { return today>=0; } ;
00159
00166 bool isBeginningOfMonth() const { return today<=8; } ;
00167 bool isEndOfMonth() const { return today>=27; } ;
00168
00169 public slots:
00173 void updateView();
00174
00179 void recalculateToday();
00180
00181
00182
00183
00184
00185 signals:
00186
00192 void selected( const KCal::DateList &daylist );
00193
00198 void eventDropped(Event *event);
00199
00200 protected:
00201
00202 void paintEvent(QPaintEvent *ev);
00203
00204 void mousePressEvent (QMouseEvent* e);
00205
00206 void mouseReleaseEvent (QMouseEvent* e);
00207
00208 void mouseMoveEvent (QMouseEvent* e);
00209
00210 void dragEnterEvent(QDragEnterEvent *);
00211
00212 void dragMoveEvent(QDragMoveEvent *);
00213
00214 void dragLeaveEvent(QDragLeaveEvent *);
00215
00216 void dropEvent(QDropEvent *);
00217
00218 void resizeEvent(QResizeEvent *);
00219
00220 private:
00221
00227 int getDayIndexFrom(int x, int y);
00228
00234 QColor getShadedColor(QColor color);
00235
00238 static const int NUMDAYS;
00239
00241 Calendar *mCalendar;
00242
00244 QDate startdate;
00245
00247 QString *daylbls;
00248
00251 QDate *days;
00252
00256 int *events;
00257
00259 QMap<int,QString> mHolidays;
00260
00262 int today;
00263
00266 int mSelInit;
00267
00270 static const int NOSELECTION;
00271
00273 int mSelStart;
00274
00276 int mSelEnd;
00277
00279 DynamicTip* mToolTip;
00280
00281
00283 QColor mDefaultBackColor;
00284
00286 QColor mDefaultTextColor;
00287
00289 QColor mDefaultTextColorShaded;
00290
00292 QColor mHolidayColorShaded;
00293
00295 QColor mSelectedDaysColor;
00296
00298 int mTodayMarginWidth;
00299
00303 QRect daysize;
00304
00305 };
00306
00307 #endif
This file is part of the documentation for kdelibs Version 3.1.4.