xref: /haiku/src/preferences/time/ZoneView.h (revision 5c6260dc232fcb2d4d5d1103c1623dba9663b753)
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 BTextToolTip;
23 class BTimeZone;
24 class TimeZoneListItem;
25 class TTZDisplay;
26 
27 
28 class TimeZoneView : public BGroupView {
29 public:
30 								TimeZoneView(const char* name);
31 	virtual						~TimeZoneView();
32 
33 	virtual	void				AttachedToWindow();
34 	virtual	void				MessageReceived(BMessage* message);
35 			bool				CheckCanRevert();
36 
37 protected:
38 	virtual	bool				GetToolTipAt(BPoint point, BToolTip** _tip);
39 	virtual void				DoLayout();
40 
41 private:
42 			void				_UpdateDateTime(BMessage* message);
43 
44 			void				_SetSystemTimeZone();
45 
46 			void				_UpdatePreview();
47 			void				_UpdateCurrent();
48 			BString				_FormatTime(const BTimeZone& timeZone);
49 
50 			void				_InitView();
51 			void				_BuildZoneMenu();
52 
53 			void				_Revert();
54 
55 			BOutlineListView*	fZoneList;
56 			BButton*			fSetZone;
57 			TTZDisplay*			fCurrent;
58 			TTZDisplay*			fPreview;
59 
60 			BTextToolTip*		fToolTip;
61 
62 			int32				fLastUpdateMinute;
63 
64 			TimeZoneListItem*	fCurrentZoneItem;
65 			TimeZoneListItem*	fOldZoneItem;
66 			bool				fInitialized;
67 };
68 
69 
70 #endif // ZONE_VIEW_H
71