xref: /haiku/src/servers/app/Desktop.h (revision 5e14f5dae0e5255cd617e013b202dee5bca984db)
1 /*
2  * Copyright 2001-2005, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Adrian Oanca <adioanca@cotty.iren.ro>
7  *		Stephan Aßmus <superstippi@gmx.de>
8  *		Axel Dörfler, axeld@pinc-software.de
9  */
10 #ifndef _DESKTOP_H_
11 #define _DESKTOP_H_
12 
13 
14 #include "ScreenManager.h"
15 #include "ServerScreen.h"
16 #include "VirtualScreen.h"
17 #include "DesktopSettings.h"
18 
19 #include <InterfaceDefs.h>
20 #include <List.h>
21 #include <Locker.h>
22 #include <Menu.h>
23 #include <Autolock.h>
24 
25 
26 class BMessage;
27 
28 class DisplayDriver;
29 class HWInterface;
30 class Layer;
31 class RootLayer;
32 class WinBorder;
33 
34 namespace BPrivate {
35 	class LinkSender;
36 };
37 
38 
39 class Desktop : public BLocker, public ScreenOwner {
40  public:
41 	// startup methods
42 								Desktop();
43 	virtual						~Desktop();
44 
45 			void				Init();
46 
47 	// Methods for multiple monitors.
48 	inline	Screen*				ScreenAt(int32 index) const
49 									{ return fActiveScreen; }
50 	inline	Screen*				ActiveScreen() const
51 									{ return fActiveScreen; }
52 	inline	RootLayer*			ActiveRootLayer() const { return fRootLayer; }
53 
54 	virtual void				ScreenRemoved(Screen* screen) {}
55 	virtual void				ScreenAdded(Screen* screen) {}
56 	virtual bool				ReleaseScreen(Screen* screen) { return false; }
57 
58 	const	::VirtualScreen&	VirtualScreen() const { return fVirtualScreen; }
59 	inline	DisplayDriver*		GetDisplayDriver() const
60 									{ return fVirtualScreen.DisplayDriver(); }
61 	inline	HWInterface*		GetHWInterface() const
62 									{ return fVirtualScreen.HWInterface(); }
63 
64 	// Methods for layer(WinBorder) manipulation.
65 			void				AddWinBorder(WinBorder *winBorder);
66 			void				RemoveWinBorder(WinBorder *winBorder);
67 			void				SetWinBorderFeel(WinBorder *winBorder,
68 												 uint32 feel);
69 			void				AddWinBorderToSubset(WinBorder *winBorder,
70 													 WinBorder *toWinBorder);
71 			void				RemoveWinBorderFromSubset(WinBorder *winBorder,
72 														  WinBorder *fromWinBorder);
73 
74 			WinBorder*			FindWinBorderByClientToken(int32 token, team_id teamID);
75 			//WinBorder*		FindWinBorderByServerToken(int32 token);
76 
77 	// get list of registed windows
78 			const BList&		WindowList() const
79 								{
80 									if (!IsLocked())
81 										debugger("You must lock before getting registered windows list\n");
82 									return fWinBorderList;
83 								}
84 
85 			void				WriteWindowList(team_id team, BPrivate::LinkSender& sender);
86 			void				WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender);
87 
88  private:
89 			friend class DesktopSettings;
90 
91 			::VirtualScreen		fVirtualScreen;
92 			DesktopSettings::Private* fSettings;
93 			BList				fWinBorderList;
94 
95 			RootLayer*			fRootLayer;
96 			Screen*				fActiveScreen;
97 };
98 
99 extern Desktop *gDesktop;
100 
101 #endif	// _DESKTOP_H_
102