xref: /haiku/src/servers/app/ScreenManager.h (revision 1294543de9ac0eff000eaea1b18368c36435d08e)
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 ~ScreenOwner() {};
28 		virtual void	ScreenRemoved(Screen* screen) = 0;
29 		virtual void	ScreenAdded(Screen* screen) = 0;
30 
31 		virtual bool	ReleaseScreen(Screen* screen) = 0;
32 };
33 
34 
35 class ScreenManager : public BLooper {
36 	public:
37 		ScreenManager();
38 		virtual ~ScreenManager();
39 
40 		Screen*			ScreenAt(int32 index) const;
41 		int32			CountScreens() const;
42 
43 		status_t		AcquireScreens(ScreenOwner* owner, int32* wishList,
44 							int32 wishCount, const char* target, bool force,
45 							ScreenList& list);
46 		void			ReleaseScreens(ScreenList& list);
47 
48 		virtual void	MessageReceived(BMessage* message);
49 
50 	private:
51 		struct screen_item {
52 			Screen*			screen;
53 			ScreenOwner*	owner;
54 		};
55 
56 		void			_ScanDrivers();
57 		screen_item*	_AddHWInterface(HWInterface* interface);
58 
59 		BObjectList<screen_item>	fScreenList;
60 };
61 
62 extern ScreenManager *gScreenManager;
63 
64 #endif	/* SCREEN_MANAGER_H */
65