summaryrefslogtreecommitdiffstats
path: root/kteatime/timeedit.h
blob: cc03f58dfba0f706bc5e56c51b78714258ed6bcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* -------------------------------------------------------------

   timeedit.h

   (C) 2003 by Daniel Teske (teske@bigfoot.com)

 ------------------------------------------------------------- */
#ifndef TIMEEDIT_H
#define TIMEEDIT_H

#include <qspinbox.h>
#include <qwidget.h>

class QBoxLayout;


/**
 * @short   A spinbox that wraps around after reaching minValue resp. maxValue.
 * @author  Daniel Teske
 */
class WrappingSpinBox : public QSpinBox
{
	Q_OBJECT

public:
	WrappingSpinBox(int minValue, int maxValue, int step = 1, QWidget *parent=0, const char *name=0);
	~WrappingSpinBox();

	void stepUp();
	void stepDown();

signals:
	void wrapUp();
	void wrapDown();
};


/**
 * @short   A widget for entering a timeout in minutes and seconds.
 * @author  Daniel Teske
 */
class TimeEdit : public QWidget
{
	Q_OBJECT

public:
	TimeEdit(QWidget* parent = 0, const char* name = 0);
	~TimeEdit();

	void setValue(int value);
	int value();

public slots:
	void setFocus();

private slots:
	void spinBoxValueChanged(int);
	void wrappedUp();
	void wrappedDown();

signals:
	void valueChanged(int);


protected:
	QSpinBox *minuteBox;
	WrappingSpinBox *secondBox;
	QBoxLayout* layout;
};

#endif