TinyMCE_Menu.class.js
Summary
No overview generated for 'TinyMCE_Menu.class.js'
Method Summary
|
static void
|
TinyMCE_Menu()
Constructor for the menu layer class.
|
function TinyMCE_Menu() {
var id;
if (typeof(tinyMCE.menuCounter) == "undefined")
tinyMCE.menuCounter = 0;
id = "mc_menu_" + tinyMCE.menuCounter++;
TinyMCE_Layer.call(this, id, true);
this.id = id;
this.items = new Array();
this.needsUpdate = true;
};
TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, {
init : function(s) {
var n;
this.settings = {
separator_class : 'mceMenuSeparator',
title_class : 'mceMenuTitle',
disabled_class : 'mceMenuDisabled',
menu_class : 'mceMenu',
drop_menu : true
};
for (n in s)
this.settings[n] = s[n];
this.create('div', this.settings.menu_class);
},
clear : function() {
this.items = new Array();
},
addTitle : function(t) {
this.add({type : 'title', text : t});
},
addDisabled : function(t) {
this.add({type : 'disabled', text : t});
},
addSeparator : function() {
this.add({type : 'separator'});
},
addItem : function(t, js) {
this.add({text : t, js : js});
},
add : function(mi) {
this.items[this.items.length] = mi;
this.needsUpdate = true;
},
update : function() {
var e = this.getElement(), h = '', i, t, m = this.items, s = this.settings;
if (this.settings.drop_menu)
h += '<span class="mceMenuLine"></span>';
h += '<table border="0" cellpadding="0" cellspacing="0">';
for (i=0; i<m.length; i++) {
t = tinyMCE.xmlEncode(m[i].text);
c = m[i].class_name ? ' class="' + m[i].class_name + '"' : '';
switch (m[i].type) {
case 'separator':
h += '<tr class="' + s.separator_class + '"><td>';
break;
case 'title':
h += '<tr class="' + s.title_class + '"><td><span' + c +'>' + t + '</span>';
break;
case 'disabled':
h += '<tr class="' + s.disabled_class + '"><td><span' + c +'>' + t + '</span>';
break;
default:
h += '<tr><td><a href="javascript:void(0);" onmousedown="' + tinyMCE.xmlEncode(m[i].js) + ';return false;"><span' + c +'>' + t + '</span></a>';
}
h += '</td></tr>';
}
h += '</table>';
e.innerHTML = h;
this.needsUpdate = false;
this.updateBlocker();
},
show : function() {
var nl, i;
if (tinyMCE.lastMenu == this)
return;
if (this.needsUpdate)
this.update();
if (tinyMCE.lastMenu && tinyMCE.lastMenu != this)
tinyMCE.lastMenu.hide();
this.parent.show.call(this);
if (!tinyMCE.isOpera) {
}
tinyMCE.lastMenu = this;
}
});
Documentation generated by
JSDoc on Wed Mar 22 13:20:28 2006