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);