kalarm

timeselector.h

00001 /*
00002  *  timeselector.h  -  widget to optionally set a time period
00003  *  Program:  kalarm
00004  *  Copyright (C) 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 
00021 #ifndef TIMESELECTOR_H
00022 #define TIMESELECTOR_H
00023 
00024 #include <tqframe.h>
00025 #include "timeperiod.h"
00026 
00027 class TQLabel;
00028 class CheckBox;
00029 
00030 
00031 class TimeSelector : public TQFrame
00032 {
00033         Q_OBJECT
00034   TQ_OBJECT
00035     public:
00036         TimeSelector(const TQString& selectText, const TQString& postfix, const TQString& selectWhatsThis,
00037                      const TQString& valueWhatsThis, bool allowHourMinute, TQWidget* parent, const char* name = 0);
00038         bool         isChecked() const;
00039         void         setChecked(bool on);
00040         int          minutes() const;
00041         void         setMinutes(int minutes, bool dateOnly, TimePeriod::Units defaultUnits);
00042         void         setReadOnly(bool);
00043         void         setDateOnly(bool dateOnly = true);
00044         void         setMaximum(int hourmin, int days);
00045         void         setFocusOnCount();
00046 
00047     signals:
00048         void         toggled(bool);             // selection checkbox has been toggled
00049         void         valueChanged(int minutes); // value has changed
00050 
00051     protected slots:
00052         void         selectToggled(bool);
00053         void         periodChanged(int minutes);
00054 
00055     private:
00056         CheckBox*    mSelect;
00057         TimePeriod*  mPeriod;
00058         TQLabel*      mLabel;
00059         bool         mReadOnly;           // the widget is read only
00060 };
00061 
00062 #endif // TIMESELECTOR_H