xref: /haiku/src/preferences/time/ZoneView.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*
2 	ZoneView.h
3 		Header file for the base class of the Time Zone tab in Time Pref App.
4 */
5 
6 #ifndef ZONE_VIEW_H
7 #define ZONE_VIEW_H
8 
9 
10 #include <ListItem.h>
11 #include <Path.h>
12 #include <View.h>
13 
14 #include "TZDisplay.h"
15 
16 class TZoneItem: public BStringItem {
17 	public:
18 		TZoneItem(const char *text, const char *zone);
19 		virtual ~TZoneItem();
20 
21 		const char *Zone() const;
22 		const char *Path() const;
23 
24 	private:
25 		BPath *f_zone;
26 };
27 
28 
29 
30 class TZoneView: public BView{
31 	public:
32 		TZoneView(BRect frame);
33 		virtual ~TZoneView();
34 
35 		virtual void AttachedToWindow();
36 		virtual void AllAttached();
37 		virtual void Draw(BRect);
38 		virtual void MessageReceived(BMessage *message);
39 	protected:
40 		void UpdateDateTime(BMessage *message);
41 		void ChangeRegion(BMessage *);
42 		void SetTimeZone();
43 		void SetTimeZone(const char *zone);
44 		void SetPreview();
45 		void SetCurrent(const char *text);
46 	private:
47 		virtual void InitView();
48 		void ReadTimeZoneLink();
49 
50 		// set widest to font width of longest item
51 		void BuildRegionMenu(float *widest);
52 
53 		// returns index of current zone
54 		int FillCityList(const char *area);
55 
56 		BPopUpMenu *f_regionpopup;
57 		BListView *f_citylist;
58 		BButton *f_setzone;
59 		TTZDisplay *f_current;
60 		TTZDisplay *f_preview;
61 
62 		BPath f_currentzone;
63 		int32 f_hour;
64 		int32 f_minute;
65 		int32 f_diff;
66 		bool f_first;
67 };
68 
69 #endif //Zone_View_H
70