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