PERGOLA LOGO

pergola.MenuItem

System events: YES.

User events and functions: YES.

System component. You don't need to instantiate this class, or invoke any of its methods explicitly. Instantiation is made through a pergola.MenuList object, a component of a pergola.Menu object.

Examples in menu and window examples (maps (complex), or window (simple)).

Listed: class properties/methods; prototype properties and methods; instance properties. Prototype properties and methods inherited by the Class superclass are not listed.

class

None

prototype

PROPERTIES

parent

Node – Defaults to pergola.user. Must be overridden to designate a predefined container of this owner (pergola.MenuList object).

height

Number (user space units) – Defined in pergola.presentationAttributes.

fill

String – Defined in pergola.presentationAttributes.

textFill

String – "black".

textFillInverse

String – "white".

active

Boolean – true; if false the menu text is grayed out, the event propagation is stopped, and the events are not processed.

exclusive

Boolean – false; if true, and if this check, this has radio button behavior in respect to exclusive sibling menu items with checkmark.

METHODS

effects(evt)

Handles hovering effects. You never need to invoke this method explicitly.

activate()

An inactive menu item is grayed out. This method is invoked as a method of this, but from a context other than events triggered by this.

deactivate()

An inactive menu item is grayed out. This method is invoked as a method of this, normally from a context other than events triggered by this, but may also be invoked from this context for self deactivation.

setChecked()

Set checkmark. Invoke this method to synchronize from another scope, for actions that can be triggered by menu and by other means.

uncheck()

Remove checkmark. Invoke this method to synchronize from another scope, for actions that can be triggered by menu and by other means.

handleEvent(evt)

Manages the state of this and of its sibling items in relation to checkmark, exclusive, and submenu, where applies; invokes this fn through this checkUserFunction().

build(object)

this inherits the properties specified in object. Prototype properties specified in object are overridden. Creates elements. Returns this.

instance

name

String – If not passed to the constructor, gets a generated XML name (Class).

id

String – The return value of this name.toXML(). This container ID. Used as prefix where other elements' IDs are attributed.

owner

Object – Must be specified in the initialization object; designates the owner object (pergola.MenuList).

Must be specified in the initialization object; designates the common ascendant pergola.Menu object of first and subsequent (submenus) generations of MenuItem objects.

container

<g> element.

button

<rect> element.

width

Must be specified in the initialization object; number (user space units).

text

Must be specified in the initialization object; object specifying the required textNode string property (equal to this string) and optional text attributes using SVG vocabulary and grammar. This property is reassigned during processing to reference the produced <text> element.

string

Must be specified in the initialization object; originally specified in the menu items property, and inherited by this instatiator (pergola.MenuList) object.

"font-family"

Must be specified in the initialization object, the value inherited from this menuObject by all descendants. Used for layout geometry.

"font-size"

Must be specified in the initialization object, the value inherited from this menuObject by all descendants. Used for layout geometry.

check

Boolean – If specified, the menu item will have a chekmark; set to true if you need the initial state of the menu item to be checked (chekmark visible), or false if the initial state has to be unchecked (chekmark hidden).

checkmark

If check (true) is specified in the initialization object, chekmark symbol element.

If specified, object defining menu items.

arrow

If submenu is specified in the initialization object, arrow symbol element.

list

If submenu is specified in the initialization object, a new pergola.MenuList, which inherits and builds this submenu items in parallel scopes.

separator

If specified in the initialization object (value: new pergola.Separator()), a separator is built below the menu item.

fn

If specified (originally specified in the menu items property, and inherited by this owner (pergola.MenuList) object), callback function.