korganizer

kdatenavigator.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of TQt, and distribute the resulting executable,
00023     without including the source code for TQt in the source distribution.
00024 */
00025 #ifndef KDATENAVIGATOR_H
00026 #define KDATENAVIGATOR_H
00027 
00028 #include <tqframe.h>
00029 #include <tqdatetime.h>
00030 
00031 #include <libkcal/incidencebase.h>
00032 
00033 class TQPushButton;
00034 class TQLabel;
00035 
00036 namespace KCal {
00037 class Calendar;
00038 class Incidence;
00039 }
00040 class NavigatorBar;
00041 using namespace KCal;
00042 
00043 class KODayMatrix;
00044 
00045 class KDateNavigator: public TQFrame
00046 {
00047     Q_OBJECT
00048   
00049   public:
00050     KDateNavigator( TQWidget *parent = 0, const char *name = 0 );
00051     ~KDateNavigator();
00052 
00056     void setCalendar( Calendar * );
00057 
00058     void setBaseDate( const TQDate & );
00059 
00060     KCal::DateList selectedDates() const { return mSelectedDates; }
00061 
00062     TQSizePolicy sizePolicy () const;
00063 
00064     NavigatorBar *navigatorBar() const { return mNavigatorBar; }
00065     TQDate startDate() const;
00066     TQDate endDate() const;
00067     void setUpdateNeeded();
00068 
00074     TQDate month() const;
00075 
00076   public slots:
00077     void selectDates( const KCal::DateList & );
00078     void updateView();
00079     void updateConfig();
00080     void updateDayMatrix();
00081     void updateToday();
00082 
00083   signals:
00084     void datesSelected( const KCal::DateList & );
00085     void incidenceDropped( Incidence *, const TQDate & );
00086     void incidenceDroppedMove( Incidence *, const TQDate & );
00087     void weekClicked( const TQDate & );
00088 
00089     void goPrevious();
00090     void goNext();
00091     void nextMonthClicked();
00092     void prevMonthClicked();
00093     void nextYearClicked();
00094     void prevYearClicked();
00095 
00096     void monthSelected( int month );
00097     void yearSelected( int year );
00098 
00099   protected:
00100     void updateDates();
00101 
00102     void wheelEvent( TQWheelEvent * );
00103 
00104     bool eventFilter( TQObject *, TQEvent * );
00105 
00106     void setShowWeekNums( bool enabled );
00107 
00108   private:
00109     NavigatorBar *mNavigatorBar;
00110 
00111     TQLabel *mHeadings[ 7 ];
00112     TQLabel *mWeeknos[ 7 ];
00113 
00114     KODayMatrix *mDayMatrix;
00115 
00116     KCal::DateList mSelectedDates;
00117     TQDate mBaseDate;
00118 
00119     // Disabling copy constructor and assignment operator
00120     KDateNavigator( const KDateNavigator & );
00121     KDateNavigator &operator=( const KDateNavigator & );
00122 };
00123 
00124 #endif