xref: /haiku/src/apps/clock/cl_view.h (revision 24159a0c7d6d6dcba9f2a0c1a7c08d2c8167f21b)
1 /*
2 
3 	cl_view.h
4 
5 */
6 /*
7 	Copyright 1999, Be Incorporated.   All Rights Reserved.
8 	This file may be used under the terms of the Be Sample Code License.
9 */
10 
11 #ifndef	_CL_VIEW_H_
12 #define _CL_VIEW_H_
13 
14 #include <Application.h>
15 #include <Bitmap.h>
16 #include <View.h>
17 #include <Window.h>
18 
19 #include <time.h>
20 
21 class TOffscreenView : public BView {
22 
23 public:
24 			TOffscreenView(BRect frame, char *name, short mRadius,
25 						short hRadius, short offset, long face, bool show);
26 	virtual		~TOffscreenView();
27 	virtual	void	AttachedToWindow();
28 	virtual	void	DrawX();
29 		void	NextFace();
30 
31 	BBitmap		*fClockFace[9];
32 	BBitmap		*fCenter;
33 	BBitmap		*fInner;
34 	short		fFace;
35 	BPoint		fMinutePoints[60];
36 	BPoint		fHourPoints[60];
37 	short		fMinutesRadius;
38 	short		fHoursRadius;
39 	short		fOffset;
40 	short		fHours;
41 	short		fMinutes;
42 	short		fSeconds;
43 	bool		fShowSeconds;
44 };
45 
46 
47 class _EXPORT TOnscreenView : public BView {
48 
49 public:
50 				TOnscreenView(BRect frame, char *name, short mRadius,
51 						short hRadius, short offset);
52 virtual			~TOnscreenView();
53 						TOnscreenView(BMessage *data);
54 static	BArchivable	*Instantiate(BMessage *data);
55 virtual	status_t		Archive(BMessage *data, bool deep = true) const;
56 		void			InitObject(BRect frame, short mRadius, short hRadius,
57 								short offset, long face, bool show);
58 
59 //+virtual	void	AllAttached();
60 virtual	void	AttachedToWindow();
61 virtual	void	Draw(BRect updateRect);
62 virtual void	MouseDown( BPoint point);
63 virtual	void	MessageReceived(BMessage *msg);
64 virtual void	Pulse();
65 		void	UseFace( short face );
66 		void	ShowSecs( bool secs );
67 		short	ReturnFace( void );
68 		short	ReturnSeconds( void );
69 
70 
71 private:
72 
73 	typedef	BView inherited;
74 
75 	BBitmap	*fOffscreen;
76 	TOffscreenView	*fOffscreenView;
77 	short	fmRadius;
78 	short	fhRadius;
79 	short	fOffset;
80 	BRect	fRect;
81 };
82 
83 #endif
84