MainMenu:
Filter:
Classes | GUI

MainMenu : Object

A manager for sclang's application-level menu
Source: Menu.sc

Description

This class allows control over items displayed in the sclang application-level menu. Application-level menus may not exist depending on platform — in particular, macOS and some Linux window managers have it, but Windows does not. On platforms without this feature, the methods in this class simply don't do anything.

NOTE: This is the menu for the sclang application, not the IDE.
WARNING: The behavior of this class changed in version 3.10.2. Menu items for controlling the process and servers will not be added and updated by default, as in versions 3.10.0 and 3.10.1. Those items can still be created by calling initBuiltInMenus. This behavior may change again in a future version.

Class Methods

MainMenu.initBuiltInMenus

Initialize menu items under the main "SuperCollider" menu that enable process and server monitoring and control:

MainMenu.register(action, menu, group: 'none')

Register a MenuAction to a main application menu. This menu item will exist for the duration of the app, or until .unregister is called for the action.

Arguments:

action

A MenuAction.

menu

A String, representing the name of the top-level menu to contain the action.

group

An optional string. Action will be placed in a section of the menu with other members of the same group, with a separator between items of other groups.

Discussion:

MainMenu.register provides an easy way to register global menu items, in a way that helps avoid disrupting menus registered by other SuperCollider components.

If you want to register menus for personal use, add the registration calls to your startup.scd file. This will ensure the menus are created automatically on launch.

If you're registering menu actions for a Quark or other component intended for distribution, be sure to be polite and thoughtful about where you're registering actions.

Avoid creating new top-level menus if possible - instead, try to use one of the following canonical menus to register your actions. Add your actions to a group to ensure you don't collide with actions from another component:

If registering menu items for a Quark, consider registering as a sub-menu of the Quarks menu. This can easily be done using the *registerQuarkMenu method.

MainMenu.registerQuarkMenu(quarkName, menu)

Convenience method for registering a menu of functionality related to a Quark. It will appear as a sub-menu under the main Quarks menu.

Arguments:

quarkName

A String, the name of the quark

menu

A Menu, a menu.

MainMenu.unregister(removeAction)

Remove a MenuAction that has been registered previously.

NOTE: It is usually disruptive and confusing to add and remove menu items dynamically. If you're registering a menu item that should only sometimes be available, consider disabling it using menuAction.enabled = false; rather than removing it.

Arguments:

removeAction

A MenuAction.

MainMenu.otherMenus

A list of menus to append to the set of main application menus.

WARNING: This is intended for standalone SuperCollider applications, and should not be used to register menus during normal SC usage.

MainMenu.add(menu)

Adds a menu to otherMenus.

Arguments:

menu

A Menu.

MainMenu.remove(menu)

Removes a menu to otherMenus.

Arguments:

menu

A Menu.

MainMenu.insert(index, menu)

Inserts a menu in otherMenus at the given index.

Arguments:

index

Index. An Integer.

menu

A Menu.

MainMenu.clear

Clears otherMenus. The main application menus are unaffected.

Arguments:

(menu)

A Menu.

MainMenu.applicationMenu

The main SuperCollider application menu.

WARNING: This is intended for standalone SuperCollider applications, and should not be used to register menus during normal SC usage.

Inherited class methods

Undocumented class methods

MainMenu.buildAppMenusAction

MainMenu.buildAppMenusAction = value

MainMenu.registered

MainMenu.serversMenu

MainMenu.unregisterQuarkMenu(quarkName)

Instance Methods

Inherited instance methods

Examples