1 // BASE_WCL.H : a platform-independent window client base class.
2 
3 // Copyright (C) 2005 Tommi Hassinen.
4 
5 // This package is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 
10 // This package is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 
15 // You should have received a copy of the GNU General Public License
16 // along with this package; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 /*################################################################################################*/
20 
21 //#include "config.h"
22 
23 #ifndef BASE_WCL_H
24 #define BASE_WCL_H
25 
26 /*################################################################################################*/
27 
28 class base_wcl;
29 
30 #include "base_wnd.h"
31 #include "ogl_camera.h"
32 
33 /*################################################################################################*/
34 
35 // base_wcl (window client) class defines the properties of all window
36 // client classes.
37 
38 // a window client object knows how to display information in a window
39 // (using OpenGL API commands) and how to process the user input which
40 // the user generates using mouse events.
41 
42 class base_wcl
43 {
44 	private:
45 
46 	base_wnd * wnd;		// link/unlink will handle this...
47 
48 	protected:
49 
50 // cam is set protected so that a derived object can set it's own camera
51 // object at ctor and also delete it at dtor ; no other access is needed.
52 
53 	ogl_camera * cam;
54 	bool delete_cam_plz;	// true if derived class cannot delete...
55 
56 	float vdim[2];		// view dimensions, in dist-units.
57 	char * title;
58 
59 	friend class ogl_camera;
60 
61 	public:
62 
63 	base_wcl(ogl_camera *);
64 	virtual ~base_wcl(void);
65 
66 	base_wnd * GetWnd(void);
67 	ogl_camera * GetCam(void);
68 
69 	void LinkWnd(base_wnd *);
70 	void UnlinkWnd(void);
71 
72 	const char * GetTitle(void);
73 	void SetTitle(const char *);
74 
75 	virtual void ButtonEvent(int, int) = 0;
76 	virtual void MotionEvent(int, int) = 0;
77 
78 	virtual void UpdateWnd(void) = 0;
79 
80 	virtual void InitGL(void) = 0;
81 	virtual void RenderGL(rmode) = 0;
82 };
83 
84 /*################################################################################################*/
85 
86 #endif	// BASE_WCL_H
87 
88 // eof
89