Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rate Thread Display Modes
Old 11-15-2006, 06:30 AM   #1
NovaScotian
League Commissioner
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 5,153
Carbon or Cocoa?

Is there a simple test to tell whether an application is Carbon or Cocoa?
__________________
17" MBP, OS X; 27" iMac, both OS X 10.10.x (latest)
NovaScotian is offline   Reply With Quote
Old 11-15-2006, 06:58 AM   #2
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,463
1) Why do you care?

2) The question isn't particularly well-defined since it is quite possible for an app to use both Carbon and Cocoa libraries.

To look at what libraries are used by a particular executable, you can use 'otool -L' on the command-line. To restrict the results to just the Carbon and Cocoa libraries, pipe the results through grep. For example:
Code:
% otool -L iTunes.app/Contents/MacOS/iTunes | egrep -i 'carbon|cocoa'
        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)

% otool -L Safari.app/Contents/MacOS/Safari | egrep -i 'carbon|cocoa'
        /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
The above shows that iTunes uses Carbon, while Safari uses both.

3) Perhaps what you are asking is which library is used for the widgets that are used for the user-interface. Even that is not well-defined since I think it is possible (although not likely) for an app to mix & match Carbon & Cocoa widgets.

You could go into the Resources sub-folder of the app and then open up the NIB files (e.g. under English.lproj") and look to see what type of widgets are being used. (Click on a part of the window in Interface Builder and then do Command-1 to get the Inspector)
__________________
hayne.net/macosx.html
hayne is offline   Reply With Quote
Old 11-15-2006, 07:11 AM   #3
NovaScotian
League Commissioner
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 5,153
Thanks for the methods, Hayne. I care because I was considering whether I could profitably make use of a ~/Library/KeyBindings/DefaultKeyBinding.dict to add features to word processing. Only Cocoa apps are "aware" of KeyBinding.dict files, and I was encouraged by this thread and its links to believe that useful things could be accomplished.
__________________
17" MBP, OS X; 27" iMac, both OS X 10.10.x (latest)

Last edited by NovaScotian; 11-15-2006 at 07:13 AM.
NovaScotian is offline   Reply With Quote
Old 11-15-2006, 09:18 AM   #4
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,463
Quote:
Originally Posted by NovaScotian
Only Cocoa apps are "aware" of KeyBinding.dict files

More precisely, only the Cocoa text widgets are aware of those files.
So what you care about is whether an app is using one of the widgets that uses the Cocoa text system.
(It is theoretically possible, although of course very unlikely, for a developer to use a Carbon text widget, or even a home-grown widget, in an app that otherwise uses Cocoa.)
__________________
hayne.net/macosx.html
hayne is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 04:41 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.