Apple GUI programming [closed]
Asked Answered
R

3

5

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.

Ruperto answered 12/7, 2011 at 8:18 Comment(0)
P
7

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++.

Parallelogram answered 12/7, 2011 at 8:40 Comment(2)
small addition: carbon proclaimed obsolete technology from OS X 10.8 Mountain LionAaberg
@DaddyM right +1. For historical perspective: I began working to avoid using Carbon (where possible) around 10.3 -- close to one decade ago. It's OOLLLDDDD!!!Parallelogram
I
1

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.

Intersperse answered 12/7, 2011 at 8:42 Comment(0)
H
0

To start with, you beg, borrow or steal a copy of "Cocoa Programming" by Aaron Hillegass.

Hasty answered 12/7, 2011 at 8:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.