korganizer Library API Documentation

kodaymatrix.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
00005     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 #ifndef KODAYMATRIX_H
00026 #define KODAYMATRIX_H
00027 
00028 #include <libkcal/calendar.h>
00029 
00030 #include <qstring.h>
00031 #include <qframe.h>
00032 #include <qcolor.h>
00033 #include <qpen.h>
00034 #include <qdatetime.h>
00035 #include <qtooltip.h>
00036 #include <qmap.h>
00037 
00038 class QDragEnterEvent;
00039 class QDragMoveEvent;
00040 class QDragLeaveEvent;
00041 class QDropEvent;
00042 
00043 class KODayMatrix;
00044 
00045 using namespace KCal;
00046 
00047 
00053 class DynamicTip : public QToolTip
00054 {
00055   public:
00061     DynamicTip( QWidget *parent );
00062 
00063   protected:
00070     void maybeTip( const QPoint &pos );
00071 
00072   private:
00074     KODayMatrix *mMatrix;
00075 };
00076 
00102 class KODayMatrix: public QFrame
00103 {
00104     Q_OBJECT
00105   public:
00115     KODayMatrix( QWidget *parent, QDate date, const char *name );
00116 
00119     ~KODayMatrix();
00120 
00125     void setCalendar( Calendar * );
00126 
00134     void updateView( QDate actdate );
00135 
00140     void updateEvents();
00141 
00145     const QDate& getDate( int offset );
00146 
00150     QString getHolidayLabel( int offset );
00151 
00155     void addSelectedDaysTo( DateList & );
00156 
00161     void setSelectedDaysFrom( const QDate &start, const QDate &end );
00162 
00163 
00167     bool isTodayVisible() const { return today >= 0; }
00168 
00175     bool isBeginningOfMonth() const { return today <= 8; }
00176     bool isEndOfMonth() const { return today >= 27; }
00177 
00178   public slots:
00182     void updateView();
00183 
00188     void recalculateToday();
00189 
00190 /*
00191     void setStartDate(QDate);
00192 */
00193 
00194   signals:
00200     void selected( const KCal::DateList &daylist );
00201 
00206     void eventDropped( Event *event );
00212     void eventDroppedMove( Event *oldevent, Event *newevent );
00218     void todoDroppedMove( Todo *oldtodo, Todo *newtodo );
00223     void todoDropped( Todo *todo );
00224 
00225   protected:
00226     void paintEvent( QPaintEvent *ev );
00227 
00228     void mousePressEvent( QMouseEvent *e );
00229 
00230     void mouseReleaseEvent( QMouseEvent *e );
00231 
00232     void mouseMoveEvent( QMouseEvent *e );
00233 
00234     void dragEnterEvent( QDragEnterEvent * );
00235 
00236     void dragMoveEvent( QDragMoveEvent * );
00237 
00238     void dragLeaveEvent( QDragLeaveEvent * );
00239 
00240     void dropEvent( QDropEvent * );
00241 
00242     void resizeEvent( QResizeEvent * );
00243 
00244   private:
00250     int getDayIndexFrom( int x, int y );
00251 
00257     QColor getShadedColor( QColor color );
00258 
00261     static const int NUMDAYS;
00262 
00264     Calendar  *mCalendar;
00265 
00267     QDate     startdate;
00268 
00270     QString   *daylbls;
00271 
00274     QDate     *days;
00275 
00279     int      *mEvents;
00280 
00282     QMap<int,QString>  mHolidays;
00283 
00285     int       today;
00286 
00289     int       mSelInit;
00290 
00293     static const int NOSELECTION;
00294 
00296     int       mSelStart;
00297 
00299     int       mSelEnd;
00300 
00302     DynamicTip* mToolTip;
00303 
00304 
00306     QColor    mDefaultBackColor;
00307 
00309     QColor    mDefaultTextColor;
00310 
00312     QColor    mDefaultTextColorShaded;
00313 
00315     QColor    mHolidayColorShaded;
00316 
00318     QColor    mSelectedDaysColor;
00319 
00321     int       mTodayMarginWidth;
00322 
00326     QRect     daysize;
00327 };
00328 
00329 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:28 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003