Files
haiku-beta6/src/kits/app/Cursor.cpp
T

100 lines
1.9 KiB
C++
Raw Normal View History

/*
* Copyright 2001-2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Frans van Nispen ([email protected])
* Gabe Yoder ([email protected])
*/
/** BCursor describes a view-wide or application-wide cursor. */
2002-07-09 12:24:59 +00:00
/**
@note: As BeOS only supports 16x16 monochrome cursors, and I would like
to see a nice shadowes one, we will need to extend this one.
*/
#include <AppDefs.h>
2002-07-09 12:24:59 +00:00
#include <Cursor.h>
2002-11-02 23:33:33 +00:00
#include <AppServerLink.h>
#include <ServerProtocol.h>
2002-07-09 12:24:59 +00:00
const BCursor *B_CURSOR_SYSTEM_DEFAULT;
const BCursor *B_CURSOR_I_BEAM;
// these are initialized in BApplication::InitData()
2002-07-09 12:24:59 +00:00
BCursor::BCursor(const void *cursorData)
{
2003-09-17 18:36:14 +00:00
int8 *data = (int8 *)cursorData;
m_serverToken = 0;
if (data == NULL
|| data[0] != 16 // size
|| data[1] != 1 // depth
|| data[2] >= 16 || data[3] >= 16) // hot-spot
2003-09-17 18:36:14 +00:00
return;
2003-09-17 18:36:14 +00:00
// Send data directly to server
BPrivate::AppServerLink serverlink;
int32 code = SERVER_FALSE;
serverlink.StartMessage(AS_CREATE_BCURSOR);
serverlink.Attach(cursorData, 68);
serverlink.FlushWithReply(code);
if (code == SERVER_TRUE)
serverlink.Read<int32>(&m_serverToken);
2002-07-09 12:24:59 +00:00
}
2002-07-09 12:24:59 +00:00
// undefined on BeOS
2002-07-09 12:24:59 +00:00
BCursor::BCursor(BMessage *data)
{
m_serverToken = 0;
2002-07-09 12:24:59 +00:00
}
2002-07-09 12:24:59 +00:00
BCursor::~BCursor()
{
2003-09-17 18:36:14 +00:00
// Notify server to deallocate server-side objects for this cursor
BPrivate::AppServerLink serverlink;
serverlink.StartMessage(AS_DELETE_BCURSOR);
serverlink.Attach<int32>(m_serverToken);
serverlink.Flush();
2002-07-09 12:24:59 +00:00
}
2002-07-09 12:24:59 +00:00
// not implemented on BeOS
2003-06-23 02:48:28 +00:00
status_t BCursor::Archive(BMessage *into, bool deep) const
2002-07-09 12:24:59 +00:00
{
return B_OK;
}
2002-07-09 12:24:59 +00:00
// not implemented on BeOS
2002-07-09 12:24:59 +00:00
BArchivable *BCursor::Instantiate(BMessage *data)
{
return NULL;
}
status_t
BCursor::Perform(perform_code d, void *arg)
2002-07-09 12:24:59 +00:00
{
2002-11-02 23:33:33 +00:00
/*
2002-07-09 12:24:59 +00:00
printf("perform %d\n", (int)d);
2002-11-02 23:33:33 +00:00
*/
2002-07-09 12:24:59 +00:00
return B_OK;
}
2002-11-02 23:33:33 +00:00
void BCursor::_ReservedCursor1() {}
void BCursor::_ReservedCursor2() {}
void BCursor::_ReservedCursor3() {}
void BCursor::_ReservedCursor4() {}