Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create a custom cursor using Carbon ?



On May 22, 2006, at 9:10 AM, Graeme Gill wrote:

After searching for some considerable time on developer.apple.com,
I'm unable to locate the Carbon API's for setting a custom
cursor for a window. Deprecated QuickDraw functions, and
Cocoa functions I've found, but not Carbon. Do they exist ?

It appears not. Not yet, at any rate. (Ah, I see Eric responded already.) Here's the sequence of calls we use:


NewGWorld() with the desired dimensions, probably with bits per pixel == 32.

Draw into the GWorld -- I used QDBeginCGContext to use CoreGraphics.

GetGWorldPixMap to retrieve a PixMap from the GWorld.

QDRegisterNamedPixMap

DisposeGWorld

The trickiest part for us, actually, was making this per-window, as Eric mentioned. The technique I used was to set the name of the current cursor to be used on the window using SetWindowProperty, and then to check this property and respond appropriately during each mouse event at any window. (Note that it may be wise for you to use QDIsNamedPixMapCursorRegistered at this time if you may tear down the cursor before removing it from all windows using it.)

Hope that helps.

Damian

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden
References: 
 >How to create a custom cursor using Carbon ? (From: Graeme Gill <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.