xref: /haiku/src/preferences/time/ZoneView.h (revision dfc8a217db488098641462dfc334dcc0f7d62456)
1 /*
2  * Copyright 2004-2010, 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  */
9 #ifndef ZONE_VIEW_H
10 #define ZONE_VIEW_H
11 
12 
13 #include <TimeZone.h>
14 #include <View.h>
15 
16 
17 class BButton;
18 class BMessage;
19 class BOutlineListView;
20 class BPopUpMenu;
21 class BTextToolTip;
22 class BTimeZone;
23 class TimeZoneListItem;
24 class TTZDisplay;
25 
26 
27 class TimeZoneView : public BView {
28 public:
29 								TimeZoneView(BRect frame);
30 	virtual						~TimeZoneView();
31 
32 	virtual	void				AttachedToWindow();
33 	virtual	void				AllAttached();
34 	virtual	void				MessageReceived(BMessage* message);
35 			bool				CheckCanRevert();
36 
37 protected:
38 	virtual	bool				GetToolTipAt(BPoint point, BToolTip** _tip);
39 
40 private:
41 			void				_UpdateDateTime(BMessage* message);
42 
43 			void				_SetSystemTimeZone();
44 
45 			void				_UpdatePreview();
46 			void				_UpdateCurrent();
47 			BString				_FormatTime(const BTimeZone& timeZone);
48 
49 			void				_InitView();
50 			void				_BuildZoneMenu();
51 
52 			void				_Revert();
53 
54 private:
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