The Application Kit Table of Contents | The Application Kit Index

# BCursor

Derived from: public BArchivable

Declared in: be/app/Cursor.h

Library: libbe.so

###### Summary

You can use a BCursor to represent a mouse cursor as an object instead of as a block of pixel data; this can be more convenient in some situations. Also, if you want to call `BApplication::SetCursor()` without forcing an immediate sync of the Application Server, you have to use a BCursor.

The default BCursors are `B_CURSOR_SYSTEM_DEFAULT` for the hand cursor and `B_CURSOR_I_BEAM` for the I-beam text editing cursor.

### Cursor Data Format

- The first four bytes of cursor data give information about the cursor:

- Byte 1: Size in pixels-per-side. Cursors are always square; currently, only 16-by-16 cursors are allowed.

- Byte 2: Color depth in bits-per-pixel. Currently, only one-bit monochrome is allowed.

- Bytes 3&4: Hot spot coordinates. Given in "cursor coordinates" where (0,0) is the upper left corner of the cursor grid, byte 3 is the hot spot's y coordinate, and byte 4 is its x coordinate. The hot spot is a single pixel that's "activated" when the user clicks the mouse. To push a button, for example, the hot spot must be within the button's bounds.

- Next comes an array of pixel color data. Pixels are specified from left to right in rows starting at the top of the image and working downward. The size of an array element is the depth of the image. In one-bit depth...

- the 16x16 array fits in 32 bytes.

- 1 is black and 0 is white.

- Then comes the pixel transparency bitmask, given left-to-right and top-to-bottom. 1 is opaque, 0 is transparent. Transparency only applies to white pixels—black pixels are always opaque.

## Constructor and Destructor

### BCursor()

`BCursor(`const void *cursorData`)`
`BCursor(`BMessage *archive`)`

Initializes the new cursor object. If you specify a non-`NULL` value for cursorData, the cursor is initialized with the specified cursor data.

If you specify a `NULL` value for cursorData, the cursor is useless; since this class doesn't currently provide a means of setting the cursor data once the object is instantiated, you're out of luck, so why bother?

BCursor doesn't currently implement archiving, so you shouldn't use the second form.

### ~BCursor()

virtual `~BCursor()`

Releases any resources used by the cursor.

## Static Functions

### Instantiate()

static BArchivable *`Instantiate(`BMessage *archive`)`

Not currently implemented; always returns `NULL`.

See also: `BArchivable::Instantiate()`, `instantiate_object()`, `Archive()`

The Application Kit Table of Contents | The Application Kit Index

The B e Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..