xref: /haiku/src/preferences/time/AnalogClock.h (revision d374a27286b8a52974a97dba0d5966ea026a665d)
1 /*
2  * Copyright 2004-2010, 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  */
9 #ifndef _ANALOG_CLOCK_H
10 #define _ANALOG_CLOCK_H
11 
12 
13 #include <View.h>
14 
15 
16 class BBitmap;
17 class OffscreenClock;
18 
19 
20 class TAnalogClock : public BView {
21 public:
22 								TAnalogClock(BRect frame, const char* name,
23 									bool drawSecondHand = true, bool interactive = true);
24 	virtual						~TAnalogClock();
25 
26 	virtual	void				AttachedToWindow();
27 	virtual	void				Draw(BRect updateRect);
28 	virtual	void				MessageReceived(BMessage* message);
29 	virtual	void				MouseDown(BPoint point);
30 	virtual	void				MouseUp(BPoint point);
31 	virtual	void				MouseMoved(BPoint point, uint32 transit,
32 									const BMessage* message);
33 
34 			void				SetTime(int32 hour, int32 minute, int32 second);
35 
36 			bool				IsChangingTime()
37 									{	return fTimeChangeIsOngoing;	}
38 			void				ChangeTimeFinished();
39 private:
40 			void				_InitView(BRect frame);
41 
42 			BBitmap*			fBitmap;
43 			OffscreenClock*		fClock;
44 
45 			bool				fDrawSecondHand;
46 			bool				fInteractive;
47 			bool				fDraggingHourHand;
48 			bool				fDraggingMinuteHand;
49 
50 			bool				fTimeChangeIsOngoing;
51 };
52 
53 
54 #endif	// _ANALOG_CLOCK_H
55