xref: /haiku/src/preferences/time/ZoneView.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
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 *f_zone;
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 Draw(BRect);
40 		virtual void MessageReceived(BMessage *message);
41 	protected:
42 		void UpdateDateTime(BMessage *message);
43 		void ChangeRegion(BMessage *);
44 		void SetTimeZone();
45 		void SetTimeZone(const char *zone);
46 		void SetPreview();
47 		void SetCurrent(const char *text);
48 	private:
49 		virtual void InitView();
50 		void ReadTimeZoneLink();
51 
52 		// set widest to font width of longest item
53 		void BuildRegionMenu(float *widest);
54 
55 		// returns index of current zone
56 		int FillCityList(const char *area);
57 
58 		BPopUpMenu *f_regionpopup;
59 		BListView *f_citylist;
60 		BButton *f_setzone;
61 		TTZDisplay *f_current;
62 		TTZDisplay *f_preview;
63 
64 		BPath f_currentzone;
65 		int32 f_hour;
66 		int32 f_minute;
67 		int32 f_diff;
68 		bool f_first;
69 };
70 
71 #endif //Zone_View_H
72