BCursor Use Cases and Implementation Details:

This document describes the BCursor interface and some basics of how it is implemented. The document has the following sections:

  1. BCursor Interface
  2. BCursor Use Cases
  3. BCursor Implementation

BCursor Interface:

The BCursor class is a simple class used to represent a mouse cursor as an object instead of an array of pixel data. The best source of information for the BCursor interface can be found here in the Be Book.

BCursor Use Cases:

The following use cases cover the BCursor functionality:

  1. Construction 1: The first BCursor constructor requires a pointer to the pixel data. The format for the pixel data is described here in the Be Book. This pixel data is used to initialize the BCursor, but BCursor does not take ownership of the data, therefore you are responsible for freeing the memory after construction.

  2. Construction 2: The second BCursor constructor requires a BMessage as an archive, however BCursor does not currently support archiving. Do not use this constructor.

  3. Destruction: This releases all resources used by the BCursor.

  4. Instantiate: This always returns NULL since it relies on the second constructor (which is not currently supported). If it were implemented, this would return a new BArchivable consisting of a BCursor created from the archive passed in as an argument.

BCursor Implementation:

All meaningful work of the BCursor is implemented in the first constructor. The constructor establishes a link with the app_server and sends it the pixel data. The app_server provides the BCursor with a token which identifies the pixel data. When BApplication::SetCursor(BCursor) is called, it must get the needed cursor data by obtaining the BCursor's token (BApplication is a friend of BCursor) and using the token to request the data from the app_server. Note that BCursor does not internally store the pixel data.