2006-02-05 18:14:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2006, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
#ifndef SERVER_CURSOR_H
|
|
|
|
#define SERVER_CURSOR_H
|
2003-01-12 22:51:01 +00:00
|
|
|
|
2005-04-14 00:04:26 +00:00
|
|
|
|
2003-01-12 22:51:01 +00:00
|
|
|
#include "ServerBitmap.h"
|
|
|
|
|
2006-02-05 18:14:14 +00:00
|
|
|
#include <Point.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
2003-01-23 00:37:53 +00:00
|
|
|
class ServerApp;
|
2003-01-23 01:20:28 +00:00
|
|
|
class CursorManager;
|
2003-01-23 00:37:53 +00:00
|
|
|
|
2006-02-05 18:14:14 +00:00
|
|
|
|
2005-04-14 00:04:26 +00:00
|
|
|
class ServerCursor : public ServerBitmap {
|
|
|
|
public:
|
|
|
|
ServerCursor(BRect r, color_space space,
|
|
|
|
int32 flags, BPoint hotspot,
|
|
|
|
int32 bytesperrow = -1,
|
|
|
|
screen_id screen = B_MAIN_SCREEN_ID);
|
|
|
|
ServerCursor(const int8* cursorDataFromR5);
|
|
|
|
ServerCursor(const uint8* alreadyPaddedData,
|
|
|
|
uint32 width, uint32 height,
|
|
|
|
color_space format);
|
|
|
|
ServerCursor(const ServerCursor* cursor);
|
|
|
|
|
2005-11-07 01:16:50 +00:00
|
|
|
virtual ~ServerCursor();
|
2003-01-12 22:51:01 +00:00
|
|
|
|
|
|
|
//! Returns the cursor's hot spot
|
2005-04-14 00:04:26 +00:00
|
|
|
void SetHotSpot(BPoint pt);
|
2005-11-07 01:16:50 +00:00
|
|
|
BPoint GetHotSpot() const
|
2005-04-14 00:04:26 +00:00
|
|
|
{ return fHotSpot; }
|
|
|
|
|
|
|
|
void SetOwningTeam(team_id tid)
|
2005-11-07 01:16:50 +00:00
|
|
|
{ fOwningTeam = tid; }
|
|
|
|
team_id OwningTeam() const
|
2005-04-14 00:04:26 +00:00
|
|
|
{ return fOwningTeam; }
|
2006-02-05 18:14:14 +00:00
|
|
|
|
|
|
|
int32 Token() const
|
2005-04-14 00:04:26 +00:00
|
|
|
{ return fToken; }
|
2006-02-05 19:43:44 +00:00
|
|
|
|
|
|
|
void Acquire() { atomic_add(&fReferenceCount, 1); }
|
|
|
|
bool Release() { return atomic_add(&fReferenceCount, -1) == 1; }
|
|
|
|
|
2005-04-14 00:04:26 +00:00
|
|
|
private:
|
2003-06-23 02:54:52 +00:00
|
|
|
friend class CursorManager;
|
2006-02-05 19:43:44 +00:00
|
|
|
|
2005-04-14 00:04:26 +00:00
|
|
|
BPoint fHotSpot;
|
|
|
|
team_id fOwningTeam;
|
2006-02-05 19:43:44 +00:00
|
|
|
int32 fReferenceCount;
|
2003-01-12 22:51:01 +00:00
|
|
|
};
|
|
|
|
|
2006-02-05 18:14:14 +00:00
|
|
|
#endif // SERVER_CURSOR_H
|