On Jul 3, 2013, at 19:23, Chris Paveglio <[email protected]> wrote:

> I've got a project that I am working with, that I did not create. I am trying 
> to understand it and I would like to remove the Carbon framework dependencies 
> in it. I don't know anything about Carbon. Is there a good resource to read 
> up on it? Are there replacement methods in other frameworks to replace some 
> of the Carbon apis? I'm not really sure where to start.
> 
> For example, here's a function I will need to replace, where could I find any 
> of the same calls or another function to replace OSStatus?

 OSStatus is an error code. I blogged about it ages ago here: 
http://orangejuiceliberationfront.com/carbon-for-the-cocoa-guy-oserror-and-osstatus/

 AFAIK, OSStatus is still being used in CoreFoundation, so you don’t have to 
get rid of it. However, Carbon Events are kinda on the way out, I think, 
(though I think the very basics are still available in 64 bit, they’re not much 
use without the event types etc.). To find out what this handler does, we’d 
need to know what types the event is registered for in sAppEvents.

 As a general rule of thumb, most event handlers match to methods in 
NSResponder, though of course there are lots of specific types where there’s 
dedicated callback APIs in Quartz, NSEvent, etc.

> pascal OSStatus AppEventHandler( EventHandlerCallRef inCallRef, EventRef 
> inEvent, void* controller ) 
> {
>   OSStatusstatus = eventNotHandledErr;
>   
>   if(GetEventClass(inEvent) == kEventClassApplication) 
>   {
>     UInt32 mode = 0;
>     (void) GetEventParameter(inEvent,
>                              kEventParamSystemUIMode,
>                              typeUInt32,
>                              NULL,
>                              sizeof(UInt32),
>                              NULL,
>                              &mode);
>     [controller modeDidChange:mode];
>     status = noErr;
>   }
>   return status;
> }
> ------
> and later
> ------
> InstallApplicationEventHandler( NewEventHandlerUPP( AppEventHandler),
>                                  GetEventTypeCount( sAppEvents ),
>                                  sAppEvents, self, NULL );
> -------
> Thanks for any help.
> Chris
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/witness.of.teachtext%40gmx.net
> 
> This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to