For many menu commands, convention dictates where these items will be placed. For instance, the Edit menu always starts with the Undo command if such a feature is available in the application, followed by Redo, Cut, Copy, Paste, and so forth.
Some menu items have specific common labels or locations where certain menu items would go that differ on each platform. For instance, on Windows, the menu item which exits the application is labeled "Exit" and is normally placed at the end of the File menu.
The Mac application menu
On the Macintosh, an extra menu exists beside the File menu; its name is the same as the name of the application. This menu contains a number of items that pertain to the application. For instance, this is the proper place to put the menu items which open the application preferences and which quit the application.
This can be accomplished by ensuring that certain common ids are set for the menu items that need to be placed on the application menu. On the Mac, these menu items will be moved onto the application menu, but on other platforms, they will be left in their original locations. This makes it easier to write the same XUL code for all platforms. Here is a list of the menu item ids which are automatically handled.
||The separator just before the Quit/Exit item.|
||The item which exits the application.|
||The separator just before the Preferences/Options item.|
||The item which opens the application preferences.|
||The separator just before the About item.|
||The item which opens the about dialog for the application.|
||A menu which provides system services.|
||Selecting this item will hide the application.|
||Selecting this item will hide all other applications except this one.|
||Selecting this item will show the windows for all applications.|
||The item that opens the Update dialog for the application, for applications that have one (such as SeaMonkey; Firefox does not have this item).|
The last five items aren't normally used but are listed for completeness.
Here is an example:
<menubar> <menu label="Tools"> <menupopup> <menuitem label="Spell Check"/> <menuitem id="menu_preferences" label="Preferences" oncommand="window.openDialog('options.xul', '_new', 'chrome');"/> </menupopup> </menu> </menubar>
This menu item will be placed on the application menu on the Macintosh but left in the Tools menu on other platforms. When moved to the application menu, the label and shortcut keys are overridden by platform conventions. However, regardless of the platform, the command event will be fired on the menu item when it is activated by the user.
Notes for Firefox extension developers
browser.xul. For example, using
document.getElementById() for the Quit menu item returns the hidden item that still sits in the File menu. To change these items in Firefox, overlay