kdateedit.h
00001 /* 00002 This file is part of libtdepim. 00003 00004 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 00005 Copyright (c) 2002 David Jarvie <software@astrojar.org.uk> 00006 Copyright (c) 2004 Tobias Koenig <tokoe@kde.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #ifndef KDATEEDIT_H 00025 #define KDATEEDIT_H 00026 00027 #include <tqcombobox.h> 00028 #include <tqdatetime.h> 00029 #include <tqmap.h> 00030 00031 #include <tdepimmacros.h> 00032 00033 #include "kdatepickerpopup.h" 00034 00035 class TQEvent; 00036 00054 class KDE_EXPORT KDateEdit : public TQComboBox 00055 { 00056 Q_OBJECT 00057 00058 00059 public: 00060 KDateEdit( TQWidget *parent = 0, const char *name = 0 ); 00061 virtual ~KDateEdit(); 00062 00067 TQDate date() const; 00068 00075 void setReadOnly( bool readOnly ); 00076 00080 bool isReadOnly() const; 00081 00082 virtual void popup(); 00083 00084 signals: 00091 void dateEntered( const TQDate &date ); 00092 00097 void dateChanged( const TQDate &date ); 00098 00099 public slots: 00106 void setDate( const TQDate &date ); 00107 00108 protected slots: 00109 void lineEnterPressed(); 00110 void slotTextChanged( const TQString& ); 00111 void dateSelected( TQDate ); 00112 00113 protected: 00114 virtual bool eventFilter( TQObject*, TQEvent* ); 00115 virtual void mousePressEvent( TQMouseEvent* ); 00116 00128 virtual bool assignDate( const TQDate &date ); 00129 00134 void setupKeywords(); 00135 00136 private: 00137 TQDate parseDate( bool* = 0 ) const; 00138 void updateView(); 00139 00140 KDatePickerPopup *mPopup; 00141 00142 TQDate mDate; 00143 bool mReadOnly; 00144 bool mTextChanged; 00145 bool mDiscardNextMousePress; 00146 00147 TQMap<TQString, int> mKeywordMap; 00148 }; 00149 00150 #endif