[Mono-osx] Is native look on OS X possible?
cocoasharp at carterconsulting.org.uk
Wed Feb 11 04:22:09 EST 2009
niknil a écrit :
> OK, but Monobjc, Mcocoa etc are specifically for the Mac. What I'm looking
> for is a cross platform framework (=the same code on different platforms).
> Sorry I didn't mention that in my previous post, but I thought that
> Mono was
> a cross platform framework. It says so on the mono-project home page, but
> when I look at the Mac and Linux screenshots of my sample app, I can see
> that it's not quite that. Although the app runs at different
> platforms, it's
> not 'true' cross platform in the sense that wxWidgets and QT are.
Unfortunately, you are looking for an unfindable Utopia. Mono is
certainly a cross platform framework, in as much as it provides a great
OO framework for the "business" code.
But, as others have said, the UI side of things really cannot be done as
a single code framework. It is not only the look and feel of the
individual controls that is important but, also, the layout of those
controls, according to the guidelines for form design for the relevant
platform. Now, Linux users might be a relatively eclectic UI experience
but Mac users really do seem to jealously guard how they want their apps
to look. Nowadays that means Cocoa controls, laid out to Cocoa UI
guidelines; even Carbon UIs are now "deprecated"; look at Adobe having
to rewrite Photoshop because Carbon doesn't support 64bit.
I am guessing but, are you writing some or all your business logic in
the form units? If so, this would explain your disappointment with the
UI facilities provided by the Mono framework.
Mac developers are used to using the MVC (Model View Controller) design
pattern to separate out the UI from the underlying business logic.
Unfortunately, most Windows developers come from a tool, like Delphi or
Visual Studio, where it is easy (one might even say encouraged) to code
your entire application with your business logic actually written in the
event handlers on the form class.
I have just spent the past four years working with a client who wanted
to untangle the spaghetti code that had accrued in their Delphi
application. Our answer was to implement the MVP (Model View Presenter)
design pattern, which is a more sophisticated MVC, in C#. Now we have a
UI where the form classes have absolutely no knowledge of the business
classes they are being asked to display.
Now all we have to do, to get our application to run as a native Mac
app, is to write a small hierarchy of generic "Interactor" classes for
the different types of controls, design the forms in Interface Builder,
and use Delphi Prism to link the C# business classes to an authentic
Cocoa UI experience.
More information about the Mono-osx