xref: /haiku/src/servers/app/CursorManager.h (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 /*
2  * Copyright 2001-2006, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		DarkWyrm <bpmagic@columbus.rr.com>
7  */
8 #ifndef CURSOR_MANAGER_H
9 #define CURSOR_MANAGER_H
10 
11 
12 #include <List.h>
13 #include <Locker.h>
14 
15 #include <TokenSpace.h>
16 
17 #include "CursorSet.h"
18 
19 using BPrivate::BTokenSpace;
20 class ServerCursor;
21 
22 
23 /*!
24 	\class CursorManager CursorManager.h
25 	\brief Handles almost all cursor management functions for the system
26 
27 	The Cursor manager provides system cursor support, previous unseen on
28 	any BeOS platform. It also provides tokens for BCursors and frees all
29 	of an application's cursors whenever an application closes.
30 */
31 class CursorManager : public BLocker {
32 	public:
33 						CursorManager();
34 		virtual			~CursorManager();
35 
36 		ServerCursor*	CreateCursor(team_id clientTeam,
37 									 const uint8* cursorData);
38 
39 		int32			AddCursor(ServerCursor* cursor, int32 token = -1);
40 		void			DeleteCursors(team_id team);
41 
42 		bool			RemoveCursor(ServerCursor* cursor);
43 
44 		void			SetCursorSet(const char* path);
45 		ServerCursor*	GetCursor(cursor_which which);
46 		cursor_which	GetCursorWhich();
47 		void			ChangeCursor(cursor_which which, int32 token);
48 		void			SetDefaults();
49 
50 		ServerCursor*	FindCursor(int32 token);
51 
52 	private:
53 		ServerCursor*	_FindCursor(team_id cientTeam,
54 									const uint8* cursorData);
55 		void			_RemoveCursor(ServerCursor* cursor);
56 //		ServerCursor*	_RemoveCursor(int32 index);
57 
58 		BList			fCursorList;
59 		BTokenSpace		fTokenSpace;
60 
61 		// System cursor members
62 		ServerCursor	*fDefaultCursor,
63 						*fTextCursor,
64 						*fMoveCursor,
65 						*fDragCursor,
66 						*fResizeCursor,
67 						*fNWSECursor,
68 						*fNESWCursor,
69 						*fNSCursor,
70 						*fEWCursor;
71 		cursor_which	fCurrentWhich;
72 };
73 
74 #endif	/* CURSOR_MANAGER_H */
75