1219019Sgabor/*
2264497Stijl * Copyright 2004-2011, Haiku, Inc. All Rights Reserved.
3219019Sgabor * Distributed under the terms of the MIT License.
4219019Sgabor *
5219019Sgabor * Authors:
6219019Sgabor *		Mike Berg <mike@berg-net.us>
7219019Sgabor *		Julun <host.haiku@gmx.de>
8219019Sgabor *		Hamish Morrison <hamish@lavabit.com>
9219019Sgabor */
10219019Sgabor#ifndef ZONE_VIEW_H
11219019Sgabor#define ZONE_VIEW_H
12219019Sgabor
13219019Sgabor
14219019Sgabor#include <LayoutBuilder.h>
15219019Sgabor#include <TimeZone.h>
16219019Sgabor
17219019Sgabor
18219019Sgaborclass BButton;
19219019Sgaborclass BMessage;
20219019Sgaborclass BOutlineListView;
21219019Sgaborclass BPopUpMenu;
22219019Sgaborclass BRadioButton;
23219019Sgaborclass BTextToolTip;
24219019Sgaborclass BTimeZone;
25219019Sgaborclass TimeZoneListItem;
26219019Sgaborclass TTZDisplay;
27219019Sgabor
28219019Sgabor
29219019Sgaborclass TimeZoneView : public BGroupView {
30219019Sgaborpublic:
31219019Sgabor								TimeZoneView(const char* name);
32219019Sgabor	virtual						~TimeZoneView();
33219019Sgabor
34219019Sgabor	virtual	void				AttachedToWindow();
35219019Sgabor	virtual	void				MessageReceived(BMessage* message);
36219019Sgabor			bool				CheckCanRevert();
37219019Sgabor
38219019Sgaborprotected:
39219019Sgabor	virtual	bool				GetToolTipAt(BPoint point, BToolTip** _tip);
40219019Sgabor	virtual void				DoLayout();
41219019Sgabor
42219019Sgaborprivate:
43219019Sgabor			void				_UpdateDateTime(BMessage* message);
44219019Sgabor
45219019Sgabor			void				_SetSystemTimeZone();
46219019Sgabor
47219019Sgabor			void				_UpdatePreview();
48219019Sgabor			void				_UpdateCurrent();
49219019Sgabor			BString				_FormatTime(const BTimeZone& timeZone);
50219019Sgabor
51219019Sgabor			void 				_ReadRTCSettings();
52219019Sgabor			void				_WriteRTCSettings();
53219019Sgabor			void				_UpdateGmtSettings();
54219019Sgabor			void				_ShowOrHidePreview();
55219019Sgabor
56219019Sgabor			void				_InitView();
57219019Sgabor			void				_BuildZoneMenu();
58219019Sgabor
59219019Sgabor			void				_Revert();
60219019Sgabor
61219019Sgabor			BOutlineListView*	fZoneList;
62219019Sgabor			BButton*			fSetZone;
63219019Sgabor			TTZDisplay*			fCurrent;
64219019Sgabor			TTZDisplay*			fPreview;
65219019Sgabor			BRadioButton*		fLocalTime;
66219019Sgabor			BRadioButton*		fGmtTime;
67219019Sgabor
68219019Sgabor			BTextToolTip*		fToolTip;
69219019Sgabor
70219019Sgabor			int32				fLastUpdateMinute;
71219019Sgabor			bool				fUseGmtTime;
72219019Sgabor			bool				fOldUseGmtTime;
73219019Sgabor
74219019Sgabor			TimeZoneListItem*	fCurrentZoneItem;
75219019Sgabor			TimeZoneListItem*	fOldZoneItem;
76219019Sgabor			bool				fInitialized;
77219019Sgabor};
78219019Sgabor
79219019Sgabor
80219019Sgabor#endif // ZONE_VIEW_H
81219019Sgabor