xref: /haiku/src/preferences/time/DateTimeView.h (revision 9829800d2c60d6aba146af7fde09601929161730)
1 /*
2  * Copyright 2004-2011, 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  *		Hamish Morrison <hamish@lavabit.com>
11  */
12 #ifndef _DATE_TIME_VIEW_H
13 #define _DATE_TIME_VIEW_H
14 
15 
16 #include <LayoutBuilder.h>
17 
18 
19 class TDateEdit;
20 class TTimeEdit;
21 class BRadioButton;
22 class TAnalogClock;
23 
24 
25 namespace BPrivate {
26 	class BCalendarView;
27 }
28 using BPrivate::BCalendarView;
29 
30 
31 class DateTimeView : public BGroupView {
32 public:
33 								DateTimeView(const char* name);
34 	virtual 					~DateTimeView();
35 
36 	virtual	void			 	AttachedToWindow();
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 			BRadioButton*		fLocalTime;
52 			BRadioButton*		fGmtTime;
53 			TDateEdit*			fDateEdit;
54 			TTimeEdit*			fTimeEdit;
55 			BCalendarView*		fCalendarView;
56 			TAnalogClock*		fClock;
57 
58 			bool				fUseGmtTime;
59 			bool				fOldUseGmtTime;
60 			bool				fInitialized;
61 
62 			time_t				fTimeAtStart;
63 			bigtime_t			fSystemTimeAtStart;
64 };
65 
66 
67 #endif	// _DATE_TIME_VIEW_H
68