xref: /haiku/src/servers/app/CursorManager.h (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
1 /*
2  * Copyright 2001-2010, 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 								~CursorManager();
35 
36 			ServerCursor*		CreateCursor(team_id clientTeam,
37 									 const uint8* cursorData);
38 
39 			int32				AddCursor(ServerCursor* cursor,
40 									int32 token = -1);
41 			void				DeleteCursors(team_id team);
42 
43 			bool				RemoveCursor(ServerCursor* cursor);
44 
45 			void				SetCursorSet(const char* path);
46 			ServerCursor*		GetCursor(BCursorID which);
47 
48 			ServerCursor*		FindCursor(int32 token);
49 
50 private:
51 			void				_InitCursor(ServerCursor*& cursorMember,
52 									const uint8* cursorBits, BCursorID id,
53 									const BPoint& hotSpot = B_ORIGIN);
54 			void				_LoadCursor(ServerCursor*& cursorMember,
55 									const CursorSet& set, BCursorID id);
56 			ServerCursor*		_FindCursor(team_id cientTeam,
57 									const uint8* cursorData);
58 			void				_RemoveCursor(ServerCursor* cursor);
59 
60 private:
61 			BList				fCursorList;
62 			BTokenSpace			fTokenSpace;
63 
64 			// System cursor members
65 			ServerCursor*		fCursorSystemDefault;
66 
67 			ServerCursor*		fCursorContextMenu;
68 			ServerCursor*		fCursorCopy;
69 			ServerCursor*		fCursorCreateLink;
70 			ServerCursor*		fCursorCrossHair;
71 			ServerCursor*		fCursorFollowLink;
72 			ServerCursor*		fCursorGrab;
73 			ServerCursor*		fCursorGrabbing;
74 			ServerCursor*		fCursorHelp;
75 			ServerCursor*		fCursorIBeam;
76 			ServerCursor*		fCursorIBeamHorizontal;
77 			ServerCursor*		fCursorMove;
78 			ServerCursor*		fCursorNoCursor;
79 			ServerCursor*		fCursorNotAllowed;
80 			ServerCursor*		fCursorProgress;
81 			ServerCursor*		fCursorResizeEast;
82 			ServerCursor*		fCursorResizeEastWest;
83 			ServerCursor*		fCursorResizeNorth;
84 			ServerCursor*		fCursorResizeNorthEast;
85 			ServerCursor*		fCursorResizeNorthEastSouthWest;
86 			ServerCursor*		fCursorResizeNorthSouth;
87 			ServerCursor*		fCursorResizeNorthWest;
88 			ServerCursor*		fCursorResizeNorthWestSouthEast;
89 			ServerCursor*		fCursorResizeSouth;
90 			ServerCursor*		fCursorResizeSouthEast;
91 			ServerCursor*		fCursorResizeSouthWest;
92 			ServerCursor*		fCursorResizeWest;
93 			ServerCursor*		fCursorZoomIn;
94 			ServerCursor*		fCursorZoomOut;
95 };
96 
97 #endif	// CURSOR_MANAGER_H
98