tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / preferences / time / AnalogClock.h
blob841aee92f7f9b244243000dc8937939369d12858
1 /*
2 * Copyright 2004-2011, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Mike Berg <mike@berg-net.us>
7 * Julun <host.haiku@gmx.de>
8 * Hamish Morrison <hamish@lavabit.com>
9 */
10 #ifndef _ANALOG_CLOCK_H
11 #define _ANALOG_CLOCK_H
14 #include <View.h>
17 class TAnalogClock : public BView {
18 public:
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);
41 void DrawClock();
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);
51 private:
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);
59 int32 fHours;
60 int32 fMinutes;
61 int32 fSeconds;
62 bool fDirty;
64 float fCenterX;
65 float fCenterY;
66 float fRadius;
68 bool fHourDragging;
69 bool fMinuteDragging;
70 bool fDrawSecondHand;
71 bool fInteractive;
73 bool fTimeChangeIsOngoing;
77 #endif // _ANALOG_CLOCK_H