I'm looking for a tutorial/guide on GUI programming in c++ for Mac OSX.
I've made a small library and would like to make a simple graphic interface for it, since I would like to port my code someday I would like to do the programming in c++.
I know about Qt, but would like to know how apples does it. As I understand it there are two frameworks for doing gui programming on macosx, Cocoa and Carbon, I have no preference, but would just like to play around with some buttons and other widgets.
if anyone knows of such a tutorial this would be nice.
My advice: Avoid Carbon -- it is a legacy technology. You will not get good support for modern releases of the OS, or for 64 bit targets -- and then you'll have a bunch of code to rewrite once you want to support recent releases.
First, get comfortable with Cocoa APIs. Cocoa interfaces (e.g. AppKit) are written in Objective-C. If you want to use C++, you'll need to at least be familiar with Cocoa (unless you bypass Cocoa entirely and go straight to OpenGL). There is a lot of Cocoa sample code, and several books.
Once you have a grasp on Cocoa and you are ready to use your C++, look into libraries like OpenGL, CoreGraphics, and CoreText. You can access all of these technologies and use them in Cocoa.
A bit of a roundabout approach, but it's more or less necessary for modern, native OSX UIs. Many OSX developers don't even go beyond Cocoa.
Lastly, you can mix ObjC with C++, it's called Objective-C++.
Carbon is pretty old stuff. Today, you use Cocoa for Mac OS X Programming which is mostly done in ObjC. You have "Interface Builder" in Xcode for building your interfaces. Most OS X developers use Xcode, you can download Xcode 3 from dev.apple.com or Xcode 4 from the AppStore.
There is a pretty good book for learning ObjectiveC, Cocoa and Xcode: Cocoa Programming for Mac OS X by Aaron Hillegas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With