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