xref: /haiku/headers/os/app/Cursor.h (revision 06ed32b8c4ed857f589da5eb5a5a4d668f271645)
1 /*
2  * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _CURSOR_H
6 #define _CURSOR_H
7 
8 
9 #include <Archivable.h>
10 #include <InterfaceDefs.h>
11 
12 
13 enum BCursorID {
14 	B_CURSOR_ID_SYSTEM_DEFAULT					= 1,
15 
16 	B_CURSOR_ID_CONTEXT_MENU					= 3,
17 	B_CURSOR_ID_COPY							= 4,
18 	B_CURSOR_ID_CREATE_LINK						= 29,
19 	B_CURSOR_ID_CROSS_HAIR						= 5,
20 	B_CURSOR_ID_FOLLOW_LINK						= 6,
21 	B_CURSOR_ID_GRAB							= 7,
22 	B_CURSOR_ID_GRABBING						= 8,
23 	B_CURSOR_ID_HELP							= 9,
24 	B_CURSOR_ID_I_BEAM							= 2,
25 	B_CURSOR_ID_I_BEAM_HORIZONTAL				= 10,
26 	B_CURSOR_ID_MOVE							= 11,
27 	B_CURSOR_ID_NO_CURSOR						= 12,
28 	B_CURSOR_ID_NOT_ALLOWED						= 13,
29 	B_CURSOR_ID_PROGRESS						= 14,
30 	B_CURSOR_ID_RESIZE_NORTH					= 15,
31 	B_CURSOR_ID_RESIZE_EAST						= 16,
32 	B_CURSOR_ID_RESIZE_SOUTH					= 17,
33 	B_CURSOR_ID_RESIZE_WEST						= 18,
34 	B_CURSOR_ID_RESIZE_NORTH_EAST				= 19,
35 	B_CURSOR_ID_RESIZE_NORTH_WEST				= 20,
36 	B_CURSOR_ID_RESIZE_SOUTH_EAST				= 21,
37 	B_CURSOR_ID_RESIZE_SOUTH_WEST				= 22,
38 	B_CURSOR_ID_RESIZE_NORTH_SOUTH				= 23,
39 	B_CURSOR_ID_RESIZE_EAST_WEST				= 24,
40 	B_CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST	= 25,
41 	B_CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST	= 26,
42 	B_CURSOR_ID_ZOOM_IN							= 27,
43 	B_CURSOR_ID_ZOOM_OUT						= 28
44 };
45 
46 
47 class BCursor : BArchivable {
48 public:
49 								BCursor(const void* cursorData);
50 								BCursor(const BCursor& other);
51 								BCursor(BCursorID id);
52 								BCursor(BMessage* data);
53 								BCursor(const BBitmap* bitmap,
54 									const BPoint& hotspot);
55 	virtual	~BCursor();
56 
57 			status_t			InitCheck() const;
58 
59 	virtual	status_t			Archive(BMessage* archive,
60 									bool deep = true) const;
61 	static	BArchivable*		Instantiate(BMessage* archive);
62 
63 			BCursor&			operator=(const BCursor& other);
64 			bool				operator==(const BCursor& other) const;
65 			bool				operator!=(const BCursor& other) const;
66 
67 private:
68 	virtual	status_t			Perform(perform_code d, void* arg);
69 
70 	virtual	void				_ReservedCursor1();
71 	virtual	void				_ReservedCursor2();
72 	virtual	void				_ReservedCursor3();
73 	virtual	void				_ReservedCursor4();
74 
75 			void				_FreeCursorData();
76 
77 private:
78 	friend class BApplication;
79 	friend class BView;
80 
81 			int32				fServerToken;
82 			bool				fNeedToFree;
83 
84 			bool				_reservedWasPendingViewCursor;
85 				// Probably bogus because of padding.
86 			uint32				_reserved[6];
87 };
88 
89 #endif	// _CURSOR_H
90