summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/timestepbox.h
blob: c05ec1d3a7e144d0171c07aaa35b01a3e580c435 (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
/***************************************************************************
                          timestepbox.h  -  description
                             -------------------
    begin                : Sat Apr 13 2002
    copyright            : (C) 2002 by Jason Harris
    email                : kstars@30doradus.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 TIMESTEPBOX_H
#define TIMESTEPBOX_H

#include <tqframe.h>
#include <tqlayout.h>
#include "timespinbox.h"
#include "timeunitbox.h"

/**@class TimeStepBox 
	*This composite widget consists of a TimeSpinBox (a TQSpinBox), coupled with a 
	*TimeUnitBox (a second pair of up/down buttons).
	*The second set of buttons makes larger steps through the 82 possible 
	*time-step values, skipping to the next even unit of time.
	*@short Composite spinbox for specifying a time step.
	*@author Jason Harris
	*@version 1.0
	*/

class TimeStepBox : public TQFrame  {
Q_OBJECT
  
public:
	/**Constructor. */
	TimeStepBox( TQWidget *parent=0, const char* name=0, bool daysonly=false );
	/**Destructor. (empty)*/
	~TimeStepBox() {}

	/**@return a pointer to the child TimeSpinBox */
	TimeSpinBox* tsbox() const { return timeBox; }

	/**@return a pointer to the child TimeUnitBox*/
	TimeUnitBox* unitbox() const { return unitBox; }

	bool daysOnly() const { return DaysOnly; }
	void setDaysOnly( bool daysonly );

signals:
	void scaleChanged( float );

private slots:
	/**Set the TimeSpinBox value according to the current UnitBox value.
		*This is connected to the UnitBox valueChanged() Signal. */
	void changeUnits( void );

	/**Make sure the current UnitBox value represents the correct units for the
		*current TimeBox value. This slot is connected to the TimeBox valueChanged() Slot. */
	void syncUnits( int );
private:
	bool DaysOnly;
	TQHBoxLayout *hlay;
	TimeSpinBox *timeBox;
	TimeUnitBox *unitBox;
};

#endif