xref: /haiku/src/servers/app/Screen.h (revision 4f2fd49bdc6078128b1391191e4edac647044c3d)
1 /*
2  * Copyright (c) 2001-2008, 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 <Accelerant.h>
15 #include <GraphicsDefs.h>
16 #include <Point.h>
17 
18 
19 class DrawingEngine;
20 class HWInterface;
21 
22 class Screen {
23  public:
24 								Screen(::HWInterface *interface, int32 id);
25 								Screen();
26 	virtual						~Screen();
27 
28 			status_t			Initialize();
29 			void				Shutdown();
30 
31 			int32				ID() const { return fID; }
32 			status_t			GetMonitorInfo(monitor_info& info) const;
33 
34 			status_t			SetMode(const display_mode& mode,
35 									bool makeDefault);
36 			status_t			SetMode(uint16 width, uint16 height,
37 									uint32 colorspace,
38 									const display_timing& timing,
39 									bool makeDefault);
40 			status_t			SetPreferredMode();
41 			status_t			SetBestMode(uint16 width, uint16 height,
42 									uint32 colorspace, float frequency,
43 									bool strict = true);
44 
45 			void				GetMode(display_mode* mode) const;
46 			void				GetMode(uint16 &width, uint16 &height,
47 									uint32 &colorspace, float &frequency) const;
48 			BRect				Frame() const;
49 			color_space			ColorSpace() const;
50 
51 			bool				IsDefaultMode() const { return fIsDefault; }
52 
53 	inline	DrawingEngine*		GetDrawingEngine() const
54 									{ return fDriver; }
55 	inline	::HWInterface*		HWInterface() const
56 									{ return fHWInterface; }
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 			DrawingEngine*		fDriver;
65 			::HWInterface*		fHWInterface;
66 			bool				fIsDefault;
67 };
68 
69 #endif	/* SCREEN_H */
70