summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/timebox.h
blob: cc6b19fa4ea80d925034aa3c042fb09fe34d2b48 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/***************************************************************************
                          timebox.h  -  description
                             -------------------
    begin                : Sun Jan 20 2002
    copyright            : (C) 2002 by Pablo de Vicente
    email                : vicente@oan.es
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TIMEBOX_H
#define TIMEBOX_H

#include <tqhbox.h>
#include <tqlineedit.h>
#include <tqstring.h>

class QTime;
class ExtDate;

/**@class timeBox
	* This class creates a TQHBox with 3 TQLineEdit Fields which will contain
	* either Time (Hour, Minute, Second) or Date (Day, Month, Year).
	*
	* Inherits QHBox
	*@author Pablo de Vicente
	*@version 1.0
	*/

class timeBox : public TQLineEdit  {
public:
	/**
	 * Constructor for the timeBox object.
	 * @param parent is the parent QWidget
	 * @param n name is the name of the object
	 * @param tt boolean. true means that the object will hold a Time.
	 * false means that the object will hold a Date.
	 */
	timeBox(TQWidget *parent, const char *n, bool tt=TRUE);

	~timeBox();

	/**
	* Fills the TQLineEdit fields of the timebox object from a TQTime object
	* showing hours, minutes and seconds.
	* @param t TQTime object from which to fill the entry fields
	*/
	void showTime(TQTime t);

	/**
	* Fills the TQLineEdit fields of the timebox object from a TQTime object
	* showing hours, minutes and seconds.
	* @param t TQTime object from which to fill the entry fields
	*/
	void showDate(ExtDate t);

	/**
	* returns a TQTime object constructed from the fields of the timebox
	*/
	TQTime createTime(bool *ok=0);

	/**
	* returns a ExtDate object constructed from the fields of the timebox
	*/
	ExtDate createDate(bool *ok=0);


	/**
	* Fills the degrees entry field with string @p s
	*                 */
	void setEntry(TQString s) { setText(s); }

	/**
	* returns a boolean. True indicates that the object holds a
	* Time Box. False that the object holds a Date Box.
	*/
	bool timeType(void) const {return timet;}

	/**
	* Clears all entries.
	*/
	void clearFields (void) { setEntry(""); }

private:
	bool timet;
};

#endif