 |
 |
How define cursors in Cocoa?
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Monopoli, Bary, ITALY
Status:
Offline
|
|
I think that the definition of custom cursors using Cocoa is more convoluted then using Carbon.
In Carbon I can create a 'CURS' resource (with ResEdit) and design all cursors I need. Then with a single function call I can show any cursor I have created.
In Cocoa I need to save a tiff file for every cursor, then create a NSImage and then a NSCursor from the NSImage. I cannot save the cursor hotspot in the tiff file, so I must hardcode it in the code o save in some other file.
There is a simple software to create and manage cursors in OS X?
There is a simple procedure to create an NSImage from a 'CURS' resource?
Any suggestion?
Thanks, and sorry for my poor english.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
If you prefer the Carbon way, why don't you use it? You can call Carbon API from within a Cocoa program, you know.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Monopoli, Bary, ITALY
Status:
Offline
|
|
Yes, I can call Carbon SetCursor(), but how this call interact with some cocoa objects that call NSCursor methods internally?
And calling SetCursor() when exists a Cocoa object developed for this purpose is somewhat unpleasant...
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Originally posted by antofic:
Yes, I can call Carbon SetCursor(), but how this call interact with some cocoa objects that call NSCursor methods internally?
It shouldn't be a problem. The Carbon & Cocoa APIs are both wrappers for the same private API, so the calls are basically equivalent.
And calling SetCursor() when exists a Cocoa object developed for this purpose is somewhat unpleasant...
No argument here. Personally, I don't have any problem with something like:
Code:
NSCursor *myCursor = [[[NSCursor alloc] initWithImage: [NSImage imageNamed: @"ExcitingCursor"] hotspot: NSZeroPoint] autorelease];
[myCursor set];
(untested code). Of course, you've got a hardcoded hotspot, but if you want to be fancy-dancy, you could read it out of a plist or something.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Monopoli, Bary, ITALY
Status:
Offline
|
|
NSZeroPoint may be not the correct value...
And imagine to have 40-50 different cursors (I have a simil-CAD application with automatic snap to objects) scattered in 40-50 different files without saved hotspot offsets.
I need an application to design the cursor with his mask. Then I need to measure and save the hotspot offsets in somewhat other file for every cursor.
When I decide an update the cursor design I need to remember to update the hotspot offsets.
I simply think that this procedure is cumbersome...
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|