/*************************************************************
*
* Copyright (c) 2015-2016 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Abstract class of menu entries.
*
* @author volker.sorge@gmail.com (Volker Sorge)
*/
/// <reference path="entry.ts" />
/// <reference path="menu_element.ts" />
var ContextMenu;
(function (ContextMenu) {
class AbstractEntry extends ContextMenu.MenuElement {
/**
* @constructor
* @implements {Entry}
* @extends {MenuElement}
* @param {Menu} menu The context menu or sub-menu the entry belongs to.
* @param {string} type The type of the entry.
*/
constructor(menu, type) {
super();
/**
* Class name.
* @type {HtmlClass}
*/
this.className = ContextMenu.HtmlClasses['MENUITEM'];
/**
* Aria role element.
* @type {string}
*/
this.role = 'menuitem';
this.type = 'entry';
this.hidden = false;
this.menu = menu;
this.type = type;
}
/**
* @return {Menu} The context menu or sub-menu the entry belongs to.
*/
getMenu() {
return this.menu;
}
/**
* @param {Menu} menu Sets the menu.
*/
setMenu(menu) {
this.menu = menu;
}
/**
* @return {string} The type of the menu entry, used for jsonification.
*/
getType() {
return this.type;
}
/**
* @override
*/
hide() {
this.hidden = true;
this.menu.generateMenu();
}
/**
* @override
*/
show() {
this.hidden = false;
this.menu.generateMenu();
}
/**
* @override
*/
isHidden() {
return this.hidden;
}
}
ContextMenu.AbstractEntry = AbstractEntry;
})(ContextMenu || (ContextMenu = {}));