kalarm/lib

dateedit.h
00001 /*
00002  *  dateedit.h  -  date entry widget
00003  *  Program:  kalarm
00004  *  Copyright © 2002-2007 by David Jarvie <software@astrojar.org.uk>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 #ifndef DATEEDIT_H
00021 #define DATEEDIT_H
00022 
00023 #include <libtdepim/kdateedit.h>
00024 
00037 class DateEdit : public KDateEdit
00038 {
00039         Q_OBJECT
00040   
00041     public:
00046         explicit DateEdit(TQWidget* parent = 0, const char* name = 0);
00048         bool         isValid() const              { return date().isValid(); }
00052         const TQDate& minDate() const              { return mMinDate; }
00056         const TQDate& maxDate() const              { return mMaxDate; }
00062         void         setMinDate(const TQDate& date, const TQString& errorDate = TQString());
00068         void         setMaxDate(const TQDate& date, const TQString& errorDate = TQString());
00070         void         setInvalid();
00071 
00072     protected:
00073         virtual void mousePressEvent(TQMouseEvent*);
00074         virtual void mouseReleaseEvent(TQMouseEvent*);
00075         virtual void mouseMoveEvent(TQMouseEvent*);
00076         virtual void keyPressEvent(TQKeyEvent*);
00077         virtual void keyReleaseEvent(TQKeyEvent*);
00078 
00079     private slots:
00080         void         newDateEntered(const TQDate&);
00081 
00082     private:
00083         void         pastLimitMessage(const TQDate& limit, const TQString& error, const TQString& defaultError);
00084 
00085         TQDate        mMinDate;             // minimum allowed date, or invalid for no minimum
00086         TQDate        mMaxDate;             // maximum allowed date, or invalid for no maximum
00087         TQString      mMinDateErrString;    // error message when entered date < mMinDate
00088         TQString      mMaxDateErrString;    // error message when entered date > mMaxDate
00089 };
00090 
00091 #endif // DATEEDIT_H