Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
曾经有一个名为 PowerPlant 的 C++ 框架,与 Metrowerks 捆绑在一起。现在它已开源:Open PowerPlant。啊,那些日子......
还有一个叫做 MacApp,最初由苹果自己维护。但它在向 OS X 过渡期间被放弃了。一些铁杆支持者似乎维护着一个分支,显然是:ClubMacApp。
您可以使用 Qt,它是一个值得尊敬的跨平台 C++ GUI 库。它是在 Carbon 之上构建的,但现在是在 Cocoa 之上。
wxWidgets 也是一个跨平台的 C++ GUI 库。它再次从碳基向可可基过渡。
Carbon 本身,从 OS X 10.2 Tiger 开始,有一个名为 HIToolbox 的对象系统,通过 C 接口公开,请参见 Apple 指南,但它是为了解旧版经典 Toolbox 的人编写的。围绕它有一个 C++ 框架,包含在 Apple 的示例代码中,名为 HI框架。
也就是说,强烈建议学习 Objective-C 并使用 Cocoa。原因是多方面的:
Apple 实际上停止了向 Carbon 框架的 GUI 部分添加功能。它不适用于 64 位等。
如果您已经了解 C++,并且具备指针等方面的应用知识,那么学习 Objective-C 就非常容易。这实际上需要一天的时间,仅此而已。有关 Objective-C 和 C++ 的比较,请参阅这份精心总结的文档作者:P.夏特列。对于那些已经了解 C++ 的人来说,这真的非常非常好。
无论如何,真正困难的部分是习惯框架本身,无论是 Carbon 还是 Cocoa,它们在很大程度上独立于语言。不幸的是,网上有关 Carbon 的资源非常匮乏,而且也相当过时。 (我唯一知道的是 CarbonDev 和令人尊敬的 Macintosh C Carbon。)Apple 在过渡到 OS X 后对 Carbon 做了许多不错的补充,但除了它们之外,关于它们的信息很少Apple 自己的简洁文档。只需比较 SO 上标记为
carbon
和cocoa
的问题数量即可。关于 Cocoa,您可以获得更多信息。There was once a C++ framework called PowerPlant, bundled with Metrowerks. It's now open sourced: Open PowerPlant. Ah, those were the days...
There was also something called MacApp, originally maintained by Apple itself. But it was abandoned during its transition to OS X. Some hardcore supporters seem to maintain a fork, apparently: ClubMacApp.
You can use Qt which is a respectable cross-platform C++ GUI library. It was built on top of Carbon, but it's now on top of Cocoa.
wxWidgets is also a cross platform C++ GUI library. Again it is in transition from Carbon-based to Cocoa-based.
Carbon itself, since OS X 10.2 Tiger, has an object system called HIToolbox, exposed by a C-interface, see Apple's guide, but it's written for people who knew the older, classic Toolbox. There's a C++ framework around it, included in Apple's sample codes, called HIFramework.
That said, it is strongly recommended to learn Objective-C and use Cocoa. The reasons are manifold:
Apple effectively stopped adding features to the GUI portion of Carbon framework. It's not available in 64 bit, etc.
If you already know C++ and thus have a working knowledge of pointers etc, it's very easy to learn Objective-C. It takes literally a day and that's it. For a comparison of Objective-C and C++, see this nicely summarized document by P. Chatelier. It is really, really good for those who know C++ already.
In any case the really hard part is getting used to the framework itself, be it Carbon or Cocoa, which is largely independent of the language. Unfortunately the resource on Carbon is very meagre on 'Net, and they are also rather dated. (The only things I know are CarbonDev and the venerable Macintosh C Carbon.) Apple made many nice additions to Carbon after they transitioned to OS X, but there is very few info on them except Apple's own terse documentation. Just compare the number of questions tagged
carbon
andcocoa
on SO. You have so much more available about Cocoa.