kdeui Library API Documentation

kdatepicker.h

00001 /*  -*- C++ -*-
00002     This file is part of the KDE libraries
00003     Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
00004               (C) 1998-2001 Mirko Boehm (mirko@kde.org)
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library 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 GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef KDATEPICKER_H
00021 #define KDATEPICKER_H
00022 #include <qdatetime.h>
00023 #include <qframe.h>
00024 #include <kdemacros.h>
00025 
00026 class QLineEdit;
00027 class QToolButton;
00028 class KDateValidator;
00029 class KDateTable;
00030 
00050 class KDatePicker: public QFrame
00051 {
00052   Q_OBJECT
00053   Q_PROPERTY( QDate date READ date WRITE setDate)
00054   Q_PROPERTY( bool closeButton READ hasCloseButton WRITE setCloseButton )
00055   Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize )
00056   
00057 public:
00061   KDatePicker(QWidget *parent=0,
00062           QDate=QDate::currentDate(),
00063           const char *name=0);
00064 
00069   KDatePicker(QWidget *parent,
00070           QDate,
00071           const char *name,
00072           WFlags f); // ### KDE 4.0: Merge
00073 
00079   KDatePicker( QWidget *parent, const char *name );
00080 
00084   virtual ~KDatePicker();
00085 
00092   QSize sizeHint() const;
00093 
00100   bool setDate(const QDate&);
00101 
00106   const QDate& getDate() const KDE_DEPRECATED;
00107 
00111   const QDate &date() const;
00112 
00116   void setEnabled(bool);
00117 
00123   KDateTable *dateTable() const { return table; };
00124   
00128   void setFontSize(int);
00132   int fontSize() const
00133     { return fontsize; }
00134 
00144   void setCloseButton( bool enable );
00145 
00151   bool hasCloseButton() const;
00152 
00153 protected:
00155   virtual bool eventFilter(QObject *o, QEvent *e );
00157   virtual void resizeEvent(QResizeEvent*);
00159   QToolButton *yearForward;
00161   QToolButton *yearBackward;
00163   QToolButton *monthForward;
00165   QToolButton *monthBackward;
00167   QToolButton *selectMonth;
00169   QToolButton *selectYear;
00171   QLineEdit *line;
00173   KDateValidator *val;
00175   KDateTable *table;
00177     //  QSize sizehint;
00179   QSize maxMonthRect;
00180 protected slots:
00181   void dateChangedSlot(QDate);
00182   void tableClickedSlot();
00183   void monthForwardClicked();
00184   void monthBackwardClicked();
00185   void yearForwardClicked();
00186   void yearBackwardClicked();
00191   void selectWeekClicked() KDE_DEPRECATED;
00195   void selectMonthClicked();
00199   void selectYearClicked();
00203   void lineEnterPressed();
00207   void todayButtonClicked();
00211   void weekSelected(int);
00212 
00213 signals:
00214   // ### KDE 4.0 Make all QDate parameters const references
00215 
00222   void dateChanged(QDate);
00228   void dateSelected(QDate);
00234   void dateEntered(QDate);
00238   void tableClicked();
00239 
00240 private:
00242   int fontsize;
00243 
00244 protected:
00245   virtual void virtual_hook( int id, void* data );
00246 private:
00247   void init( const QDate &dt );
00248   void fillWeeksCombo(const QDate &date);
00249   class KDatePickerPrivate;
00250   KDatePickerPrivate *d;
00251 };
00252 
00253 #endif //  KDATEPICKER_H
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 5 07:16:06 2004 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003