开发者

Delphi XE2: Is it possible to create Mac GUI applications without FireMonkey?

Using Delphi XE2, is it possible to cr开发者_如何学运维eate a Mac GUI application without using FireMonkey for the GUI? If so, what could be used and how would one go about it?


In principle, it is possible. But you'd need to translate the Objective-C headers and classes exposed by Apple. That is a huge task, part of which has already been done by the FreePascal people or the Objective-Pascal people.

But nothing prevents you from translating the (missing) headers yourself. You can call methods of a class and perform other functions using the pure C functions in the Objective-C runtime described on this page. It is just a lot of work, as the class library is huge. You could start with the Core Foundation, then the general Foudnation and then Cocoa, Quartz, etc. That is up to you. You'd probably also want to write wrappers for the classes.

Currently, out of the box, there is no easy way to do what you want.

But I plan to write a simple app as proof of concept that it is possible. That might take some time, though.

Update

You can also use the CoreFoundation headers translated by Embarcadero, in the Macapi namespace (i.e. all units that start with Macapi, like Macapi.ObjectiveC.pas, Macapi.ObjcRuntime.pas, Macapi.CocoaTypes.pas, etc), as well as System.Mac.CFUtils. There you'll find (some of) the major CoreFoundation classes and easy ways to use them from Delphi. I am not sure if these are properly documented, though, so you'll have to find out yourself how to use them. The comments in code might be able to help you.

A little more about this can be found in the docwiki. Note that a console app can also have a GUI.

Update 2

Yes, it is definitely possible. See http://rvelthuis.de/zips/sampleniblessapp.7z . Note that the most important Macapi unit turned out to be Macapi.AppKit.


Would you want to create a Windows GUI application without the VCL?
It's about the same idea, using directly the MacAPIs instead of WinAPIs.
Probably a bit more difficult (understatement) as there is not that wealth of documentation on how to do it from a Delphi/Pascal point of view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜