kdeui
kdatepicker.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KDATEPICKER_H
00021 #define KDATEPICKER_H
00022 #include <qdatetime.h>
00023 #include <qframe.h>
00024 #include <kdelibs_export.h>
00025
00026 class QLineEdit;
00027 class QToolButton;
00028 class KDateValidator;
00029 class KDateTable;
00030
00051 class KDEUI_EXPORT KDatePicker: public QFrame
00052 {
00053 Q_OBJECT
00054 Q_PROPERTY( QDate date READ date WRITE setDate)
00055 Q_PROPERTY( bool closeButton READ hasCloseButton WRITE setCloseButton )
00056 Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize )
00057
00058 public:
00062 KDatePicker(QWidget *parent=0,
00063 QDate=QDate::currentDate(),
00064 const char *name=0);
00065
00070 KDatePicker(QWidget *parent,
00071 QDate,
00072 const char *name,
00073 WFlags f);
00074
00080 KDatePicker( QWidget *parent, const char *name );
00081
00085 virtual ~KDatePicker();
00086
00093 QSize sizeHint() const;
00094
00101 bool setDate(const QDate&);
00102
00107 const QDate& getDate() const KDE_DEPRECATED;
00108
00112 const QDate &date() const;
00113
00117 void setEnabled(bool);
00118
00124 KDateTable *dateTable() const { return table; }
00125
00129 void setFontSize(int);
00133 int fontSize() const
00134 { return fontsize; }
00135
00145 void setCloseButton( bool enable );
00146
00152 bool hasCloseButton() const;
00153
00154 protected:
00156 virtual bool eventFilter(QObject *o, QEvent *e );
00158 virtual void resizeEvent(QResizeEvent*);
00160 QToolButton *yearForward;
00162 QToolButton *yearBackward;
00164 QToolButton *monthForward;
00166 QToolButton *monthBackward;
00168 QToolButton *selectMonth;
00170 QToolButton *selectYear;
00172 QLineEdit *line;
00174 KDateValidator *val;
00176 KDateTable *table;
00178
00180 QSize maxMonthRect;
00181 protected slots:
00182 void dateChangedSlot(QDate);
00183 void tableClickedSlot();
00184 void monthForwardClicked();
00185 void monthBackwardClicked();
00186 void yearForwardClicked();
00187 void yearBackwardClicked();
00192 void selectWeekClicked();
00196 void selectMonthClicked();
00200 void selectYearClicked();
00204 void lineEnterPressed();
00208 void todayButtonClicked();
00212 void weekSelected(int);
00213
00214 signals:
00215
00216
00223 void dateChanged(QDate);
00229 void dateSelected(QDate);
00235 void dateEntered(QDate);
00239 void tableClicked();
00240
00241 private slots:
00242 void ensureSelectYearIsUp();
00243
00244 private:
00246 int fontsize;
00247
00248 protected:
00249 virtual void virtual_hook( int id, void* data );
00250 private:
00251 void init( const QDate &dt );
00252 void fillWeeksCombo(const QDate &date);
00253 class KDatePickerPrivate;
00254 KDatePickerPrivate *d;
00255 };
00256
00257 #endif // KDATEPICKER_H