kalarm

timeselector.h
1/*
2 * timeselector.h - widget to optionally set a time period
3 * Program: kalarm
4 * Copyright (C) 2004 by David Jarvie <software@astrojar.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef TIMESELECTOR_H
22#define TIMESELECTOR_H
23
24#include <tqframe.h>
25#include "timeperiod.h"
26
27class TQLabel;
28class CheckBox;
29
30
31class TimeSelector : public TQFrame
32{
33 TQ_OBJECT
34
35 public:
36 TimeSelector(const TQString& selectText, const TQString& postfix, const TQString& selectWhatsThis,
37 const TQString& valueWhatsThis, bool allowHourMinute, TQWidget* parent, const char* name = 0);
38 bool isChecked() const;
39 void setChecked(bool on);
40 int minutes() const;
41 void setMinutes(int minutes, bool dateOnly, TimePeriod::Units defaultUnits);
42 void setReadOnly(bool);
43 void setDateOnly(bool dateOnly = true);
44 void setMaximum(int hourmin, int days);
45 void setFocusOnCount();
46
47 signals:
48 void toggled(bool); // selection checkbox has been toggled
49 void valueChanged(int minutes); // value has changed
50
51 protected slots:
52 void selectToggled(bool);
53 void periodChanged(int minutes);
54
55 private:
56 CheckBox* mSelect;
57 TimePeriod* mPeriod;
58 TQLabel* mLabel;
59 bool mReadOnly; // the widget is read only
60};
61
62#endif // TIMESELECTOR_H