DR Developer's Guide
DR Interfaces | DR Methods | DR Types and Misc API

IMoaDrCursor

Interface ID: IID_IMoaDrCursor
Pointer type: PIMoaDrCursor
Inheritance: IMoaUnknown
Header file: driservc.h

Description

The IMoaDrCursor interface consists of a single method, which lets Xtras set animated cursors or static cursors on Sprites or the Stage.

Methods

SetSpriteCursor()

SetSpriteCursor()

Syntax
SetSpriteCursor(MoaDrSpriteChanIndex spriteNum, MoaDrCursorID cursorID, PMoaDrCMRef pCursorBitmap, PMoaDrCMRef pCursorMask)
Parameters
spriteNum
The sprite channel number of the sprite whose cursor you wish to set. A value of 0 indicates setting the stage cursor
cursorID
One of the built in types or a resource ID. The built in cursors are as follows:
#define kMoaDrCursor_Arrow      -1
#define kMoaDrCursor_Default     0
#define kMoaDrCursor_IBeam       1
#define kMoaDrCursor_Crosshair   2
#define kMoaDrCursor_Crossbar    3
#define kMoaDrCursor_Watch       4
#define kMoaDrCursor_Finger    280
typedef MoaLong MoaDrCursorID;
pCursorBitmap
The CMRef of a cast member (either a 1-bit bitmap or a Cursor Xtra asset) to be used as the sprite cursor
pCursorMask
An optional 1-bit mask bitmap (used only with a 1-bit bitmap cursor)
Returns
MoaError
Description
This method sets the cursor from within an Xtra.
Examples
The following example sets the cursor of the Xtra's sprite to either the arrow or the I-Beam.
PIMoaDrSpriteCallback    pDrSpriteCallback = NULL;
PIMoaDrCursor            pDrCursor = NULL;
MoaDrCursorID            cursorID = kMoaDrCursor_Arrow;
MoaDrSpriteChanIndex     spriteChanIndex = 0;    /* our own sprite channel index */

/* fpSpriteCallback was saved earlier as an instance variable.
/  First get the DrSpriteCallback and find out what your sprite channel index is. */
pObj->fpSpriteCallback->QueryInterface(&IID_IMoaDrSpriteCallback, (PPMoaVoid)&pDrSpriteCallback);
if(pDrSpriteCallback)
    pDrSpriteCallback->GetSpriteChanIndex(&spriteChanIndex);

pObj->pCallback->QueryInterface(&IID(IMoaDrCursor), (PPMoaVoid)&pDrCursor);

if ( foo == 1 ) /* whatever :) */
    // Set the Arrow cursor
    cursorID = kMoaDrCursor_Arrow;
else
    // Set the I-Beam cursor
    cursorID = kMoaDrCursor_IBeam;

/* Set the sprite cursor of your own sprite to the appropriate type, determined above.
/  Don't do this if no sprite was returned because we don't want to set the stage cursor
/  ( 0 as the sprite channel means set the stage cursor) */
if(pDrCursor & spriteChanIndex)
    pDrCursor->SetSpriteCursor(spriteChanIndex, cursorID, NULL, NULL);

Copyright © 1995-2008 Adobe Macromedia Software LLC, Inc.