blogUsing the new Cocoa-Eiffel framework

dfurrer's picture

I am busy working on the Vision2-Cocoa implementation and have some nice additions for better interaction with Objective-C ready, the code is now void-safe and the Cocoa-Eiffel wrapper is much more complete. But more about that some other time. For now I just want to take a short break and present you the "New Cocoa Application Wizard" which I wrote yesterday.

This new wizard is similar to those for creating a new EiffelVision2 or WEL projects and should get you started right away. This wizard and the current Cocoa-Eiffel library will be available in a development version of EiffelStudio soon after 6.4 is out and will hopefully make it in the official version 6.5.

Further down are a couple of screenshots where you can see the new wizard. Note that the wizard, written in EiffelVision2, is already running with the new Cocoa backend, while the EiffelStudio window you can see in the background is still using the GTK+ implementation.

If you are interested in writing a graphical application on Mac OS X using Eiffel make sure you give the new Cocoa-Eiffel framework a shot.

The code for creating an application with a single window is pretty easy:

note
	description	: "Root class for this application."
	author		: "Generated by the New Cocoa Application Wizard."
	date		: "$Date: 2009/6/19 13:26:18 $"
	revision	: "1.0.0"
 
class
	APPLICATION
 
inherit
	EV_APPLICATION
 
create
	make_and_launch 
 
feature {NONE} -- Initialization
 
	make_and_launch
			-- Initialize and launch application
		do
			make
			prepare
			launch
		end
 
	prepare
			-- Prepare the first window to be displayed.
		do
				-- create and initialize the main window.
			create main_window.make (create {NS_RECT}.make_rect (100, 100, 300, 300),
				{NS_WINDOW}.titled_window_mask | {NS_WINDOW}.closable_window_mask, False)
 
				-- set the title of the window.
			main_window.set_title (create {NS_STRING}.make_with_string ("My cocoa application"))
 
				-- Show the main window.
			main_window.make_key_and_order_front
		end
 
feature {NONE} -- Implementation
 
	main_window: NS_WINDOW
			-- Main window.
 
end -- class APPLICATION

link=http://eiffelroom.com/node/359?size=_original

Comments

Very cool!!

manus_eiffel's picture

Very cool!!

thanks, on a side note...

dfurrer's picture

some icons on OS X should be available in a much higher resolution (and maybe even adapted to Apple's Human Interface Guidelines). How does the process of creating those icons work at Eiffel Software? I might know somebody who is interested in doing those icons.

Here's a screenshot of the problem (wizard icon):

We usually do them ourselves

manus_eiffel's picture

We usually do them ourselves and for not being graphic designer to start with, it is usually pretty good. Currently EiffelStudio uses a 16x16 pixmap to set the title icon of a Window, although I guess it would be possible to provide a 32x32 pixmap, but then the 16x16 version would be interpreted from the 32x32 and might not be of such good quality.

It is definitely something we should improve since various platforms may have a restriction on this icon.

32x32 is not enough

peter_gummer's picture

It still won't look good at 32x32.

http://en.wikipedia.org/wiki/Apple_Icon_Image

- Peter

How does one get this

How does one get this program to compile. I made a basic vision2 application, set vision_implementation to cocoa and tried to compile it. It's exploding in the C compilation section with a bunch of errors that seem to indicate the compiler isn't set to compile objective-c. I'm on OSX leopard.

Please locate your config.sh

dfurrer's picture

Please locate your config.sh file and add -ObjC in the line where ccflags is set.

	ccflags='-ObjC -pipe -no-cpp-precomp -fno-common -fPIC'

Where is it?

Hi,

There is no link in this post.

How can I get access to EiffelVision for Cocoa?

Thanks,

  Quenio


Syndicate content