xref: /haiku/src/preferences/time/DateTimeView.h (revision c90684742e7361651849be4116d0e5de3a817194)
1 /*
2  * Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Andrew McCall <mccall@@digitalparadise.co.uk>
7  *		Mike Berg <mike@berg-net.us>
8  *		Julun <host.haiku@gmx.de>
9  *		Philippe Saint-Pierre <stpere@gmail.com>
10  */
11 #ifndef _DATE_TIME_VIEW_H
12 #define _DATE_TIME_VIEW_H
13 
14 
15 #include <View.h>
16 
17 
18 class TDateEdit;
19 class TTimeEdit;
20 class BRadioButton;
21 class TAnalogClock;
22 
23 
24 namespace BPrivate {
25 	class BCalendarView;
26 }
27 using BPrivate::BCalendarView;
28 
29 
30 class DateTimeView : public BView {
31 public:
32 								DateTimeView(BRect frame);
33 	virtual 					~DateTimeView();
34 
35 	virtual	void			 	AttachedToWindow();
36 	virtual	void 				Draw(BRect updaterect);
37 	virtual	void 				MessageReceived(BMessage* message);
38 
39 			bool				CheckCanRevert();
40 			bool				GetUseGmtTime();
41 
42 private:
43 			void 				_InitView();
44 			void 				_ReadRTCSettings();
45 			void				_WriteRTCSettings();
46 			void				_UpdateGmtSettings();
47 			void 				_UpdateDateTime(BMessage* message);
48 			void				_Revert();
49 			time_t				_PrefletUptime() const;
50 
51 private:
52 			BRadioButton*		fLocalTime;
53 			BRadioButton*		fGmtTime;
54 			TDateEdit*			fDateEdit;
55 			TTimeEdit*			fTimeEdit;
56 			BCalendarView*		fCalendarView;
57 			TAnalogClock*		fClock;
58 
59 			bool				fUseGmtTime;
60 			bool				fOldUseGmtTime;
61 			bool				fInitialized;
62 
63 			time_t				fTimeAtStart;
64 			bigtime_t			fSystemTimeAtStart;
65 };
66 
67 
68 #endif	// _DATE_TIME_VIEW_H
69