Axel Dörfler aa1f543799 Some work on cursors:
* Fixed a myriad of bugs all over the place, ranging from locking errors to
  deleting objects that don't belong to the one deleting them (hello HWInterface!)
* Almost all ServerWindow cursor stuff was broken; I've replaced all commands
  to set a cursor with a single one AS_SET_CURSOR.
* Renamed some cursor commands.
* Changed the (broken) way ServerApp::fAppCursor was maintained - the application
  cursor is now NULL as long as possible.
* Removed superfluous ServerCursor app signature stuff.
* The BApplication will no longer duplicate the default/I-beam cursors, it will
  just reuse the default ones which now have fixed tokens.
* As a result, changing the cursor is now working as expected, closing bug #102.
* Rewrote Cursor.h, renamed private members to match our style guide.
* Minor cleanup.

What's still left to be done is reference counting the cursor objects to make them
work right and reliable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-02-05 18:14:14 +00:00

58 lines
1.3 KiB
C++

/*
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
*/
#ifndef CURSOR_SET_H
#define CURSOR_SET_H
#include <Bitmap.h>
#include <Cursor.h>
#include <Message.h>
typedef enum {
B_CURSOR_DEFAULT = 1,
B_CURSOR_TEXT,
B_CURSOR_MOVE,
B_CURSOR_DRAG,
B_CURSOR_RESIZE,
B_CURSOR_RESIZE_NWSE,
B_CURSOR_RESIZE_NESW,
B_CURSOR_RESIZE_NS,
B_CURSOR_RESIZE_EW,
B_CURSOR_OTHER,
B_CURSOR_APP,
B_CURSOR_INVALID
} cursor_which;
class ServerCursor;
/*!
\brief Class to manage system cursor sets
*/
class CursorSet : public BMessage {
public:
CursorSet(const char *name);
status_t Save(const char *path,int32 saveflags=0);
status_t Load(const char *path);
status_t AddCursor(cursor_which which,const BBitmap *cursor, const BPoint &hotspot);
status_t AddCursor(cursor_which which, int8 *data);
void RemoveCursor(cursor_which which);
status_t FindCursor(cursor_which which, BBitmap **cursor, BPoint *hotspot);
status_t FindCursor(cursor_which which, ServerCursor **cursor);
void SetName(const char *name);
const char *GetName(void);
private:
const char *_CursorWhichToString(cursor_which which);
BBitmap *_CursorDataToBitmap(int8 *data);
};
#endif // CURSOR_SET_H