xref: /haiku/src/preferences/time/ZoneView.h (revision 93a78ecaa45114d68952d08c4778f073515102f2)
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 <ListView.h>
12 #include <Path.h>
13 #include <PopUpMenu.h>
14 #include <View.h>
15 
16 #include "TZDisplay.h"
17 
18 class TZoneItem: public BStringItem {
19 	public:
20 		TZoneItem(const char *text, const char *zone);
21 		virtual ~TZoneItem();
22 
23 		const char *Zone() const;
24 		const char *Path() const;
25 
26 	private:
27 		BPath *fZone;
28 };
29 
30 
31 
32 class TZoneView: public BView {
33 	public:
34 		TZoneView(BRect frame);
35 		virtual ~TZoneView();
36 
37 		virtual void AttachedToWindow();
38 		virtual void AllAttached();
39 		virtual void MessageReceived(BMessage *message);
40 	protected:
41 		void UpdateDateTime(BMessage *message);
42 		void ChangeRegion(BMessage *);
43 		void SetTimeZone();
44 		void SetTimeZone(const char *zone);
45 		void SetPreview();
46 		void SetCurrent(const char *text);
47 	private:
48 		virtual void InitView();
49 		void ReadTimeZoneLink();
50 
51 		// set widest to font width of longest item
52 		void BuildRegionMenu(float *widest);
53 
54 		// returns index of current zone
55 		int FillCityList(const char *area);
56 
57 		BPopUpMenu *f_regionpopup;
58 		BListView *f_citylist;
59 		BButton *f_setzone;
60 		TTZDisplay *f_current;
61 		TTZDisplay *f_preview;
62 
63 		BPath f_currentzone;
64 		int32 f_hour;
65 		int32 f_minute;
66 		int32 f_diff;
67 		bool f_first;
68 };
69 
70 #endif //Zone_View_H
71