xref: /haiku/src/preferences/time/ZoneView.h (revision 0044a8c39ab5721051b6279506d1a8c511e20453)
1 /*
2  * Copyright 2004-2011, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Mike Berg <mike@berg-net.us>
7  *		Julun <host.haiku@gmx.de>
8  *		Hamish Morrison <hamish@lavabit.com>
9  */
10 #ifndef ZONE_VIEW_H
11 #define ZONE_VIEW_H
12 
13 
14 #include <LayoutBuilder.h>
15 #include <TimeZone.h>
16 
17 
18 class BButton;
19 class BMessage;
20 class BOutlineListView;
21 class BPopUpMenu;
22 class BRadioButton;
23 class BTextToolTip;
24 class BTimeZone;
25 class TimeZoneListItem;
26 class TTZDisplay;
27 
28 
29 class TimeZoneView : public BGroupView {
30 public:
31 								TimeZoneView(const char* name);
32 	virtual						~TimeZoneView();
33 
34 	virtual	void				AttachedToWindow();
35 	virtual	void				MessageReceived(BMessage* message);
36 			bool				CheckCanRevert();
37 
38 protected:
39 	virtual	bool				GetToolTipAt(BPoint point, BToolTip** _tip);
40 	virtual void				DoLayout();
41 
42 private:
43 			void				_UpdateDateTime(BMessage* message);
44 
45 			void				_SetSystemTimeZone();
46 
47 			void				_UpdatePreview();
48 			void				_UpdateCurrent();
49 			void 				_NotifyClockSettingChanged();
50 			BString				_FormatTime(const BTimeZone& timeZone);
51 
52 			void 				_ReadRTCSettings();
53 			void				_WriteRTCSettings();
54 			void				_UpdateGmtSettings();
55 			void				_ShowOrHidePreview();
56 
57 			void				_InitView();
58 			void				_BuildZoneMenu();
59 
60 			void				_Revert();
61 
62 			BOutlineListView*	fZoneList;
63 			BButton*			fSetZone;
64 			TTZDisplay*			fCurrent;
65 			TTZDisplay*			fPreview;
66 			BRadioButton*		fLocalTime;
67 			BRadioButton*		fGmtTime;
68 
69 			BTextToolTip*		fToolTip;
70 
71 			int32				fLastUpdateMinute;
72 			bool				fUseGmtTime;
73 			bool				fOldUseGmtTime;
74 
75 			TimeZoneListItem*	fCurrentZoneItem;
76 			TimeZoneListItem*	fOldZoneItem;
77 			bool				fInitialized;
78 };
79 
80 
81 #endif // ZONE_VIEW_H
82