xref: /haiku/src/apps/clock/cl_view.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
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 #ifndef _APPLICATION_H
15 #include <Application.h>
16 #endif
17 #ifndef _WINDOW_H
18 #include <Window.h>
19 #endif
20 #ifndef _VIEW_H
21 #include <View.h>
22 #endif
23 #ifndef _BITMAP_H
24 #include <Bitmap.h>
25 #endif
26 
27 #include <time.h>
28 
29 class TOffscreenView : public BView {
30 
31 public:
32 				TOffscreenView(BRect frame, char *name, short mRadius,
33 						short hRadius, short offset, long face, bool show);
34 virtual			~TOffscreenView();
35 virtual	void	AttachedToWindow();
36 virtual	void	DrawX();
37 		void	NextFace();
38 
39 BBitmap	*fClockFace[9];
40 BBitmap	*fCenter;
41 BBitmap	*fInner;
42 short			fFace;
43 BPoint			fMinutePoints[60];
44 BPoint			fHourPoints[60];
45 short			fMinutesRadius;
46 short			fHoursRadius;
47 short			fOffset;
48 short			fHours;
49 short			fMinutes;
50 short			fSeconds;
51 bool			fShowSeconds;
52 };
53 
54 
55 class _EXPORT TOnscreenView : public BView {
56 
57 public:
58 				TOnscreenView(BRect frame, char *name, short mRadius,
59 						short hRadius, short offset);
60 virtual			~TOnscreenView();
61 						TOnscreenView(BMessage *data);
62 static	BArchivable	*Instantiate(BMessage *data);
63 virtual	status_t		Archive(BMessage *data, bool deep = true) const;
64 		void			InitObject(BRect frame, short mRadius, short hRadius,
65 								short offset, long face, bool show);
66 
67 //+virtual	void	AllAttached();
68 virtual	void	AttachedToWindow();
69 virtual	void	Draw(BRect updateRect);
70 virtual void	MouseDown( BPoint point);
71 virtual	void	MessageReceived(BMessage *msg);
72 virtual void	Pulse();
73 		void	UseFace( short face );
74 		void	ShowSecs( bool secs );
75 		short	ReturnFace( void );
76 		short	ReturnSeconds( void );
77 
78 
79 private:
80 
81 	typedef	BView inherited;
82 
83 BBitmap	*Offscreen;
84 TOffscreenView	*OffscreenView;
85 short	fmRadius;
86 short	fhRadius;
87 short	fOffset;
88 BRect	fRect;
89 };
90 
91 #endif
92