kalarm/lib

dateedit.h

00001 /*
00002  *  dateedit.h  -  date entry widget
00003  *  Program:  kalarm
00004  *  Copyright (C) 2002 - 2004 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 <libkdepim/kdateedit.h>
00024 
00037 class DateEdit : public KDateEdit
00038 {
00039         Q_OBJECT
00040     public:
00045         DateEdit(QWidget* parent = 0, const char* name = 0);
00047         bool         isValid() const              { return date().isValid(); }
00051         const QDate& minDate() const              { return mMinDate; }
00055         const QDate& maxDate() const              { return mMaxDate; }
00061         void         setMinDate(const QDate& date, const QString& errorDate = QString::null);
00067         void         setMaxDate(const QDate& date, const QString& errorDate = QString::null);
00069         void         setInvalid();
00070 
00071     protected:
00072         virtual void mousePressEvent(QMouseEvent*);
00073         virtual void mouseReleaseEvent(QMouseEvent*);
00074         virtual void mouseMoveEvent(QMouseEvent*);
00075         virtual void keyPressEvent(QKeyEvent*);
00076         virtual void keyReleaseEvent(QKeyEvent*);
00080         virtual bool assignDate(const QDate& date);
00081 
00082     private:
00083         void         pastLimitMessage(const QDate& limit, const QString& error, const QString& defaultError);
00084 
00085         QDate        mMinDate;             // minimum allowed date, or invalid for no minimum
00086         QDate        mMaxDate;             // maximum allowed date, or invalid for no maximum
00087         QString      mMinDateErrString;    // error message when entered date < mMinDate
00088         QString      mMaxDateErrString;    // error message when entered date > mMaxDate
00089 };
00090 
00091 #endif // DATEEDIT_H
KDE Home | KDE Accessibility Home | Description of Access Keys