korganizer Library API Documentation

kdatenavigator.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 KDATENAVIGATOR_H
00024 #define KDATENAVIGATOR_H
00025 
00026 #include <qframe.h>
00027 #include <qdatetime.h>
00028 #include <qlabel.h>
00029 
00030 #include <libkcal/calendar.h>
00031 
00032 #include "kodaymatrix.h"
00033 
00034 class QPushButton;
00035 class QTimer;
00036 
00037 class KCalendarSystem;
00038 
00039 class KDateNavigator: public QFrame
00040 {
00041     Q_OBJECT
00042   public:
00043     KDateNavigator( QWidget *parent = 0, Calendar *calendar = 0,
00044                     bool show_week_numbers = false, const char *name = 0,
00045                     QDate date = QDate::currentDate() );
00046     ~KDateNavigator();
00047 
00058     enum RolloverType { None, FollowDay, FollowMonth } ;
00059     void enableRollover( RolloverType );
00060 
00061     void setShowWeekNums( bool enabled );
00062 
00063   public slots:
00064     void selectDates( const KCal::DateList & );
00065     void updateView();
00066     void updateConfig();
00067     void updateDayMatrix();
00068 
00069   signals:
00070     void datesSelected( const KCal::DateList & );
00071     void eventDropped( Event * );
00072     void weekClicked( const QDate &);
00073 
00074     void goPrevious();
00075     void goNext();
00076 
00077     void goNextMonth();
00078     void goPrevMonth();
00079     void goNextYear();
00080     void goPrevYear();
00081 
00082     // Signals emitted at midnight carrying the new date.
00083     void dayPassed( QDate );
00084     void monthPassed( QDate );
00085 
00086   protected slots:
00087 
00097      void possiblyPastMidnight();
00098 
00102      void passedMidnight();
00103 
00104   protected:
00105     void updateDates();
00106 
00107     void wheelEvent (QWheelEvent *);
00108 
00109     bool eventFilter (QObject *,QEvent *);
00110 
00111   private:
00112     QFrame   *ctrlFrame;
00113     QPushButton *prevYear;
00114     QPushButton *prevMonth;
00115     QPushButton *nextMonth;
00116     QPushButton *nextYear;
00117     QLabel *dateLabel;
00118     QFrame *headingSep;
00119     QFrame *weeknumSep;
00120     QLabel *headings[7];
00121     QLabel *weeknos[7];
00122     KODayMatrix *daymatrix;
00123 
00124     KCal::DateList mSelectedDates;
00125     QDate m_MthYr;
00126     int m_fstDayOfWk;
00127     bool m_bShowWeekNums;
00128 
00129     int dayNum(int row, int col);
00130     int dayToIndex(int dayNum);
00131 
00132     Calendar *mCalendar;
00133     KCalendarSystem *mCalendarSystem;
00134 
00135     const QString *curHeaders;
00136 
00137 
00141      QTimer *updateTimer;
00142      QDate lastDayChecked;
00143      RolloverType updateRollover;
00144 
00145     // Disabling copy constructor and assignment operator
00146     KDateNavigator(const KDateNavigator & );
00147     KDateNavigator &operator=(const KDateNavigator &);
00148 };
00149 
00150 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:41:08 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001