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 
00025 class QLineEdit;
00026 class QToolButton;
00027 class KDateValidator;
00028 class KDateTable;
00029 
00049 class KDatePicker: public QFrame
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   KDatePicker(QWidget *parent=0,
00060           QDate=QDate::currentDate(),
00061           const char *name=0);
00062 
00067   KDatePicker(QWidget *parent,
00068           QDate,
00069           const char *name,
00070           WFlags f); // ### KDE 4.0: Merge
00071 
00077   KDatePicker( QWidget *parent, const char *name );
00078 
00082   virtual ~KDatePicker();
00083 
00090   QSize sizeHint() const;
00091 
00098   bool setDate(const QDate&);
00099 
00104   const QDate& getDate() const;
00105 
00109   const QDate &date() const;
00110 
00114   void setEnabled(bool);
00115 
00119   void setFontSize(int);
00123   int fontSize() const
00124     { return fontsize; }
00125 
00135   void setCloseButton( bool enable );
00136 
00142   bool hasCloseButton() const;
00143 
00144 protected:
00146   virtual bool eventFilter(QObject *o, QEvent *e );
00148   virtual void resizeEvent(QResizeEvent*);
00150   QToolButton *yearForward;
00152   QToolButton *yearBackward;
00154   QToolButton *monthForward;
00156   QToolButton *monthBackward;
00158   QToolButton *selectMonth;
00160   QToolButton *selectYear;
00162   QLineEdit *line;
00164   KDateValidator *val;
00166   KDateTable *table;
00168     //  QSize sizehint;
00170   QSize maxMonthRect;
00171 protected slots:
00172   void dateChangedSlot(QDate);
00173   void tableClickedSlot();
00174   void monthForwardClicked();
00175   void monthBackwardClicked();
00176   void yearForwardClicked();
00177   void yearBackwardClicked();
00179   void selectWeekClicked();
00180   void selectMonthClicked();
00181   void selectYearClicked();
00182   void lineEnterPressed();
00183 signals:
00190   void dateChanged(QDate);
00196   void dateSelected(QDate);
00202   void dateEntered(QDate);
00206   void tableClicked();
00207 
00208 private:
00210   int fontsize;
00211 
00212 protected:
00213   virtual void virtual_hook( int id, void* data );
00214 private:
00215   void init( const QDate &dt );
00216   class KDatePickerPrivate;
00217   KDatePickerPrivate *d;
00218   // calculate ISO 8601 week number
00219   int weekOfYear(QDate);
00220 };
00221 
00222 #endif //  KDATEPICKER_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:02 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001