korganizer Library API Documentation

kodaymatrix.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
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     void setStartDate(QDate);
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
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:31 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001