[Vm-dev] Customize OS X App

Christophe Demarey christophe.demarey at inria.fr
Fri Sep 28 21:33:34 UTC 2018

Hi John,

> Le 28 sept. 2018 à 21:38, John McIntosh <johnmci at smalltalkconsulting.com> a écrit :
> Well there is or was a mac menu bar plugin
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m <https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m>
> you'll need to ensure your vm bundle contains that.  I can't say where the smalltalk code you use to talk to it is, nor can I say how you would build the VM with that included. 

Good to know. I was not aware of that plugin.

> ---------------
> Otherwise you need a VM that has the ObjectiveCPlugin plugin  which I see the pharo people compile. 
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/src/plugins/ObjectiveCPlugin/ObjectiveCPlugin.c <https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/src/plugins/ObjectiveCPlugin/ObjectiveCPlugin.c>
> Then you need the smalltalk code
> http://www.squeaksource.com/ObjectiveCBridge2.html <http://www.squeaksource.com/ObjectiveCBridge2.html>
> Then consider Apple's documentation 
> https://developer.apple.com/documentation/appkit/nsmenu <https://developer.apple.com/documentation/appkit/nsmenu>
> Perhaps someone has written the Smalltalk code to interface to NSMenu ? 

A few months ago, I did some experiments with Alien-MacOSX in Pharo (http://squeaksource.com/Alien).
It was not very successful. I was able to remove menus or menu items but I did not succeed to update existing ones or to create new ones.

Some snippet of my experiments:

nsApp := #NSApplication inObjectiveC sharedApplication.
menu := nsApp mainMenu.

menu removeItemAtIndex: 2. "remove Edit menu item"  => ok

menu addItemWithTitle: 'Quit' asNSString autorelease 
        action: #terminate: asObjectiveCSelector
        keyEquivalent: 'q' asNSString autorelease.  => does not work

#NSMenu inObjectiveC setMenuBarVisible: 0.
#NSMenu inObjectiveC setMenuBarVisible: true asAlien.

Probably I did not succeed probably because I do not know enough on OS X app dev.

It could be an option, but I still think that it would be bettter to be able to customize this static information in the nib file.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180928/54869561/attachment.html>

More information about the Vm-dev mailing list