#ifndef TIME_VIEW_H
#define TIME_VIEW_H
#include <DateFormat.h>
#include <DateTimeFormat.h>
#include <Locale.h>
#include <Messenger.h>
#include <OS.h>
#include <View.h>
const uint32 kChangeTime = 'ChTm';
const uint32 kShowCalendar = 'ShCa';
const uint32 kShowHideTime = 'ShTm';
const uint32 kShowSeconds = 'SwSc';
const uint32 kShowDayOfWeek = 'SwDw';
const uint32 kShowTimeZone = 'SwTz';
const uint32 kGetClockSettings = 'GCkS';
class BCountry;
class BMessageRunner;
class CalendarMenuWindow;
class TBarView;
#ifdef AS_REPLICANT
class _EXPORT TTimeView;
#endif
class TTimeView : public BView {
public:
TTimeView(float maxWidth, float height,
TBarView* barView = NULL);
TTimeView(BMessage* data);
~TTimeView();
#ifdef AS_REPLICANT
status_t Archive(BMessage* data,
bool deep = true) const;
static BArchivable* Instantiate(BMessage* data);
#endif
void AttachedToWindow();
void Draw(BRect update);
void FrameMoved(BPoint);
void GetPreferredSize(float* width, float* height);
void MessageReceived(BMessage*);
void MouseDown(BPoint where);
void Pulse();
void ResizeToPreferred();
bool ShowSeconds() const;
void SetShowSeconds(bool show);
bool ShowDayOfWeek() const;
void SetShowDayOfWeek(bool show);
bool ShowTimeZone() const;
void SetShowTimeZone(bool show);
void ShowCalendar(BPoint where);
bool IsShowingCalendar();
private:
friend class TReplicantTray;
void GetCurrentTime();
void GetCurrentDate();
void UpdateTimeFormat();
void CalculateTextPlacement();
void ShowTimeOptions(BPoint);
void Update();
bool Vertical();
TBarView* fBarView;
BView* fParent;
bool fNeedToUpdate;
time_t fCurrentTime;
time_t fLastTime;
char fCurrentTimeStr[64];
char fLastTimeStr[64];
char fCurrentDateStr[64];
char fLastDateStr[64];
int fSeconds;
int fMinute;
int fHour;
float fMaxWidth;
float fHeight;
int16 fShowLevel;
bool fShowSeconds;
bool fShowDayOfWeek;
bool fShowTimeZone;
BPoint fTimeLocation;
BPoint fDateLocation;
BMessenger fCalendarWindowMessenger;
CalendarMenuWindow* fCalendarWindow;
BDateTimeFormat* fTimeFormat;
BDateFormat* fDateFormat;
};
#endif