mkdatepicker.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 MKDATEPICKER_H 00021 #define MKDATEPICKER_H 00022 #include <qdatetime.h> 00023 #include <qframe.h> 00024 // CALSYS 00025 #include "kcalendarsystem.h" 00026 00027 class QLineEdit; 00028 class QToolButton; 00029 class KDateValidator; 00030 class KDateTable; 00031 00051 class KDatePicker: public QFrame 00052 { 00053 Q_OBJECT 00054 Q_PROPERTY( QDate date READ date WRITE setDate) 00055 public: 00059 // CALSYS Added optional calType parameter for different calendar types support 00060 KDatePicker(const QString& calType = "gregorian", 00061 QWidget *parent=0, 00062 QDate=QDate::currentDate(), 00063 const char *name=0); 00067 virtual ~KDatePicker(); 00068 00075 QSize sizeHint() const; 00076 00083 bool setDate(const QDate&); 00084 00089 const QDate& getDate() const; 00090 00094 const QDate &date() const; 00095 00099 void setEnabled(bool); 00100 00104 void setFontSize(int); 00108 int fontSize() const 00109 { return fontsize; } 00110 00111 protected: 00113 void resizeEvent(QResizeEvent*); 00115 QToolButton *yearForward; 00117 QToolButton *yearBackward; 00119 QToolButton *monthForward; 00121 QToolButton *monthBackward; 00123 QToolButton *selectMonth; 00125 QToolButton *selectYear; 00127 QLineEdit *line; 00129 KDateValidator *val; 00131 KDateTable *table; 00133 // QSize sizehint; 00135 QSize maxMonthRect; 00136 // CALSYS 00137 KCalendarSystem *calendarSystem; 00138 00139 protected slots: 00140 void dateChangedSlot(QDate); 00141 void tableClickedSlot(); 00142 void monthForwardClicked(); 00143 void monthBackwardClicked(); 00144 void yearForwardClicked(); 00145 void yearBackwardClicked(); 00146 void selectMonthClicked(); 00147 void selectYearClicked(); 00148 void lineEnterPressed(); 00149 signals: 00156 void dateChanged(QDate); 00162 void dateSelected(QDate); 00168 void dateEntered(QDate); 00172 void tableClicked(); 00173 00174 private: 00176 int fontsize; 00177 00178 protected: 00179 virtual void virtual_hook( int id, void* data ); 00180 private: 00181 class KDatePickerPrivate; 00182 KDatePickerPrivate *d; 00183 }; 00184 00185 #endif // KDATEPICKER_H