xref: /haiku/src/servers/app/ScreenManager.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * Copyright 2005, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  */
8 #ifndef SCREEN_MANAGER_H
9 #define SCREEN_MANAGER_H
10 
11 
12 #include <Looper.h>
13 #include <ObjectList.h>
14 
15 class BMessage;
16 
17 class DrawingEngine;
18 class HWInterface;
19 class Screen;
20 
21 
22 typedef BObjectList<Screen> ScreenList;
23 
24 
25 class ScreenOwner {
26 	public:
27 		virtual void	ScreenRemoved(Screen* screen) = 0;
28 		virtual void	ScreenAdded(Screen* screen) = 0;
29 
30 		virtual bool	ReleaseScreen(Screen* screen) = 0;
31 };
32 
33 
34 class ScreenManager : public BLooper {
35 	public:
36 		ScreenManager();
37 		virtual ~ScreenManager();
38 
39 		Screen*			ScreenAt(int32 index) const;
40 		int32			CountScreens() const;
41 
42 		status_t		AcquireScreens(ScreenOwner* owner, int32* wishList,
43 							int32 wishCount, bool force, ScreenList& list);
44 		void			ReleaseScreens(ScreenList& list);
45 
46 		virtual void	MessageReceived(BMessage* message);
47 
48 	private:
49 		void			_ScanDrivers();
50 		void			_AddHWInterface(HWInterface* interface);
51 
52 		struct screen_item {
53 			Screen*			screen;
54 			ScreenOwner*	owner;
55 		};
56 
57 		BObjectList<screen_item>	fScreenList;
58 };
59 
60 extern ScreenManager *gScreenManager;
61 
62 #endif	/* SCREEN_MANAGER_H */
63