1/*
2 * Copyright 2004-2012, 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 <TimeFormat.h>
16#include <TimeZone.h>
17
18
19class BButton;
20class BMessage;
21class BOutlineListView;
22class BPopUpMenu;
23class BRadioButton;
24class BTimeZone;
25class TimeZoneListItem;
26class TimeZoneListView;
27class TTZDisplay;
28
29
30class TimeZoneView : public BGroupView {
31public:
32								TimeZoneView(const char* name);
33	virtual						~TimeZoneView();
34
35	virtual	void				AttachedToWindow();
36	virtual	void				MessageReceived(BMessage* message);
37			bool				CheckCanRevert();
38
39protected:
40	virtual void				DoLayout();
41
42private:
43			void				_UpdateDateTime(BMessage* message);
44
45			void				_SetSystemTimeZone();
46
47			void				_UpdatePreview();
48			void				_UpdateCurrent();
49			BString				_FormatTime(const BTimeZone& timeZone);
50
51			void 				_ReadRTCSettings();
52			void				_WriteRTCSettings();
53			void				_UpdateGmtSettings();
54			void				_ShowOrHidePreview();
55
56			void				_InitView();
57			void				_BuildZoneMenu();
58
59			void				_Revert();
60
61			TimeZoneListView*	fZoneList;
62			BButton*			fSetZone;
63			TTZDisplay*			fCurrent;
64			TTZDisplay*			fPreview;
65			BRadioButton*		fLocalTime;
66			BRadioButton*		fGmtTime;
67
68			int32				fLastUpdateMinute;
69			bool				fUseGmtTime;
70			bool				fOldUseGmtTime;
71
72			TimeZoneListItem*	fCurrentZoneItem;
73			TimeZoneListItem*	fOldZoneItem;
74			bool				fInitialized;
75
76			BTimeFormat			fTimeFormat;
77};
78
79
80#endif // ZONE_VIEW_H
81