2 * Copyright 2004-2011, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Mike Berg <mike@berg-net.us>
7 * Julun <host.haiku@gmx.de>
8 * Hamish Morrison <hamish@lavabit.com>
10 #ifndef _ANALOG_CLOCK_H
11 #define _ANALOG_CLOCK_H
17 class TAnalogClock
: public BView
{
19 TAnalogClock(const char* name
,
20 bool drawSecondHand
= true,
21 bool interactive
= true);
22 virtual ~TAnalogClock();
24 virtual void Draw(BRect updateRect
);
25 virtual void MessageReceived(BMessage
* message
);
26 virtual void MouseDown(BPoint point
);
27 virtual void MouseUp(BPoint point
);
28 virtual void MouseMoved(BPoint point
, uint32 transit
,
29 const BMessage
* message
);
30 virtual void DoLayout();
32 virtual BSize
MaxSize();
33 virtual BSize
MinSize();
34 virtual BSize
PreferredSize();
36 void SetTime(int32 hour
, int32 minute
, int32 second
);
37 bool IsChangingTime();
38 void ChangeTimeFinished();
40 void GetTime(int32
* hour
, int32
* minute
, int32
* second
);
43 bool InHourHand(BPoint point
);
44 bool InMinuteHand(BPoint point
);
46 void SetHourHand(BPoint point
);
47 void SetMinuteHand(BPoint point
);
49 void SetHourDragging(bool dragging
);
50 void SetMinuteDragging(bool dragging
);
52 float _GetPhi(BPoint point
);
53 bool _InHand(BPoint point
, int32 ticks
, float radius
);
54 void _DrawHands(float x
, float y
, float radius
,
55 rgb_color hourHourColor
,
56 rgb_color hourMinuteColor
,
57 rgb_color secondsColor
, rgb_color knobColor
);
73 bool fTimeChangeIsOngoing
;
77 #endif // _ANALOG_CLOCK_H