F:/KPlato/koffice/kplato/kptcalendarpanel.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002     Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
00003               (C) 1998-2001 Mirko Boehm (mirko@kde.org)
00004               (C) 2004 Dag Andersen <danders@get2net.dk>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 /* This is based on KDatePicker. */
00023 
00024 #ifndef KPTCALENDARPANEL_H
00025 #define KPTCALENDARPANEL_H
00026 
00027 #include "kptmap.h"
00028 
00029 #include <qdatetime.h>
00030 #include <q3frame.h>
00031 //Added by qt3to4:
00032 #include <QResizeEvent>
00033 #include <QEvent>
00034 
00035 class QLineEdit;
00036 class QToolButton;
00037 
00038 namespace KPlato
00039 {
00040 
00041 class DateValidator;
00042 class DateTable;
00043 class Calendar;
00044 
00049 class CalendarPanel: public Q3Frame
00050 {
00051     Q_OBJECT
00052     Q_PROPERTY( QDate date READ date WRITE setDate)
00053     Q_PROPERTY( bool closeButton READ hasCloseButton WRITE setCloseButton )
00054     
00055 public:
00059     CalendarPanel(QWidget *parent=0, QDate=QDate::currentDate(), const char *name=0, Qt::WFlags f=0);
00060     
00065     CalendarPanel( QWidget *parent, const char *name );
00066     
00070     virtual ~CalendarPanel();
00071     
00078     QSize sizeHint() const;
00079     
00080     QSize minimumSizeHint() const { return sizeHint(); }
00087     bool setDate(const QDate&);
00088     
00093     const QDate& getDate() const;
00094     
00098     const QDate &date() const;
00099     
00103     void setEnabled(bool);
00104     
00108     void setFontSize(int);
00112     int fontSize() const
00113         { return fontsize; }
00114     
00123     void setCloseButton( bool enable );
00124     
00129     bool hasCloseButton() const;
00130     
00131     void setCalendar(Calendar *cal);
00132     
00133     DateMap selectedDates();
00134     IntMap selectedWeekdays();
00135     WeekMap selectedWeeks();
00136     
00137     DateMap markedDates();
00138     IntMap markedWeekdays();
00139     WeekMap markedWeeks();
00140     
00141     void clear();
00142     
00143     void markSelected(int state);
00144     
00145 protected:
00147     virtual bool eventFilter(QObject *o, QEvent *e );
00149     virtual void resizeEvent(QResizeEvent*);
00151     QToolButton *yearForward;
00153     QToolButton *yearBackward;
00155     QToolButton *monthForward;
00157     QToolButton *monthBackward;
00159     QToolButton *selectMonth;
00161     QToolButton *selectYear;
00163     QLineEdit *line;
00165     DateValidator *val;
00167     DateTable *table;
00168     // the widest month string in pixels:
00169     QSize maxMonthRect;
00170 
00171 protected slots:
00172     void dateChangedSlot(QDate);
00173     void tableClickedSlot();
00174     void monthForwardClicked();
00175     void monthBackwardClicked();
00176     void yearForwardClicked();
00177     void yearBackwardClicked();
00178     void selectWeekClicked();
00179     void selectMonthClicked();
00180     void selectYearClicked();
00181     void lineEnterPressed();
00182     
00183     void slotWeekdaySelected(int day);
00184     void slotWeekSelected(int week, int year);
00185     void slotSelectionCleared();
00186   
00187 signals:
00194     void dateChanged(QDate);
00198     void dateSelected(QDate);
00204     void dateEntered(QDate);
00208     void tableClicked();
00209     
00210     void weekSelected(int week, int year);
00211     void weekdaySelected(int day);
00215     void selectionCleared();
00216   
00217 private:
00219     int fontsize;
00220     
00221     bool m_selectedDays[7];
00222     
00223 protected:
00224     virtual void virtual_hook( int id, void* data );
00225 private:
00226     void init( const QDate &dt );
00227     class CalendarPanelPrivate;
00228     CalendarPanelPrivate *d;
00229     // calculate ISO 8601 week number
00230     int weekOfYear(QDate);
00231 };
00232 
00233 }  //KPlato namespace
00234 
00235 #endif //  CALENDARPANEL_H

Généré le Wed Nov 22 23:40:55 2006 pour KPlato par  doxygen 1.5.1-p1