xref: /haiku/src/servers/app/Screen.h (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1 /*
2  * Copyright 2001-2009, Haiku, Inc.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Adi Oanca <adioanca@myrealbox.com>
7  *		Axel Dörfler, axeld@pinc-software.de
8  *		Stephan Aßmus, <superstippi@gmx.de>
9  */
10 #ifndef SCREEN_H
11 #define SCREEN_H
12 
13 
14 #include <AutoDeleter.h>
15 #include <Accelerant.h>
16 #include <GraphicsDefs.h>
17 #include <Point.h>
18 
19 
20 class DrawingEngine;
21 class HWInterface;
22 
23 class Screen {
24 public:
25 								Screen(::HWInterface *interface, int32 id);
26 								Screen();
27 	virtual						~Screen();
28 
29 			status_t			Initialize();
30 			void				Shutdown();
31 
32 			int32				ID() const { return fID; }
33 			status_t			GetMonitorInfo(monitor_info& info) const;
34 
35 			status_t			SetMode(const display_mode& mode);
36 			status_t			SetMode(uint16 width, uint16 height,
37 									uint32 colorspace,
38 									const display_timing& timing);
39 			status_t			SetPreferredMode();
40 			status_t			SetBestMode(uint16 width, uint16 height,
41 									uint32 colorspace, float frequency,
42 									bool strict = true);
43 
44 			void				GetMode(display_mode& mode) const;
45 			void				GetMode(uint16 &width, uint16 &height,
46 									uint32 &colorspace, float &frequency) const;
47 
48 			void				SetFrame(const BRect& rect);
49 
50 			BRect				Frame() const;
51 			color_space			ColorSpace() const;
52 
53 	inline	DrawingEngine*		GetDrawingEngine() const
54 									{ return fDriver.Get(); }
55 	inline	::HWInterface*		HWInterface() const
56 									{ return fHWInterface.Get(); }
57 
58 private:
59 			int32				_FindBestMode(const display_mode* modeList,
60 									uint32 count, uint16 width, uint16 height,
61 									uint32 colorspace, float frequency) const;
62 
63 			int32				fID;
64 			ObjectDeleter< ::HWInterface>
65 								fHWInterface;
66 			ObjectDeleter<DrawingEngine>
67 								fDriver;
68 };
69 
70 #endif	/* SCREEN_H */
71