How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
- Subject: How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
- From: Oshrat Fahima <email@hidden>
- Date: Sun, 25 Mar 2012 05:25:00 -0400
- Acceptlanguage: en-US
- Thread-topic: How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
Hi
In our plug-ins we are using cursors kept in a *.CUR file.
In windows there's no problem to identify the hot spot from the *.CUR file (because it's a WIN file, LoadCursor already knows where is the hot spot automatically).
But in MAC Cocoa, we've encountered a problem when we create a new NSCursor object in which we must transfer the hot spot to it by calculating it and maintaining it hard coded
(we prefer not to do that).
Are you familiar with a method that can help retrieve the hot spot from a given *.CUR file?
That way we can create the NSCursor directly using this point rather than calculating it ourselves.
Here's a sample of our code.
Thanks a lot for your time and knowledge
Oshrat
NewCursor(const resContainerRef, const short cursorID, const WTPoint2s hotSpotPoint)
{
WTCursorHandle retVal = 0;
NSCursor* crsr = 0;
wvFM::WCStPath imgPath;
WTResType resType = "Crsr";
wvRM::GetPathToActualFile (resContainerRef, resType, cursorID, imgPath);
NSString* imgPathAsNSString = 0;
imgPathAsNSString = [NSString stringWithFormat:@"%s", imgPath.GetNativePathString().c_str()];
NSImage * img = [[NSImage alloc] :imgPathAsNSString];
crsr = [[NSCursor alloc]initWithImage:img hotSpot:NSMakePoint(hotSpotPoint.m_x,hotSpotPoint.m_y)];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden