This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 263
JEP Menuitems
Erik Vold edited this page Aug 20, 2013
·
9 revisions
It should be possible to create menuitems for browser windows on Firefox and Fennec.
Sidebars and Toolbars require menuitems in the (View - > Sidebar/Toolbar) menu. DevTools require a menuitem in Tools -> Web Developer. Firefox itself, and many add-ons, provide toolbarbutton-menus for which other add-ons would like to extend (example: the Bookmarks toolbar button).
The design would closely match that for Context Menuitems, but leave out all of the extra context related events and message passing.
- options
-
String
label: the text displayed in the menuitem. -
Array
Integer
orString
menu: describes menu which the menuitem will live under. If a array is used then the first valid parent in the array will be used. -
Boolean
[enabled]: this should befalse
if you want the menuitem to be displayed and unclickable. -
Boolean
[visible]: this should befalse
if you want the menuitem to be hidden, default istrue
.
-
-
String
id (only getter): the id for the menuitem. -
String
label (only getter): the text displayed in the menuitem. -
Boolean
enabled (getter and setter): the enabled state of the menuitem. -
Boolean
visible (getter and setter): the visible state of the menuitem.
- destroy: destroys the menuitem
- click
var { Menuitem } = require('sdk/ui');
var menuitem = Menuitem({
label: "Not Checked",
menu: [ Menuitem.FILE_MENU, Menuitem.APP_MENU ],
onClick: function() {
// do something..
}
})
var { Menuitem } = require('sdk/ui');
var menuitem = Menuitem({
label: "Not Checked",
menu: [ 'file', 'application' ],
onClick: function() {
// do something..
}
})