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

北城余情 提交于 2019-12-17 15:55:15

问题


Using Delphi XE2, is it possible to create a Mac GUI application without using FireMonkey for the GUI? If so, what could be used and how would one go about it?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/7442131/delphi-xe2-is-it-possible-to-create-mac-gui-applications-without-firemonkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!