webgui/www/extras/tinymce2/docs/tinymce_api/overview-summary-TinyMCE_Menu.class.js.html
2006-06-23 18:21:32 +00:00

361 lines
12 KiB
HTML
Raw Blame History

<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="TinyMCE_Menu.class.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>TinyMCE_Menu.class.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'TinyMCE_Menu.class.js'<BR/><BR/>
</p>
<hr>
<!-- ========== METHOD SUMMARY =========== -->
<a name="method_summary"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=2>
<font size="+2">
<b>Method Summary</b>
</font>
</td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td align="right" valign="top" width="1%">
<font size="-1">
<code>static&nbsp;void</code>
</font>
</td>
<td>
<code>
<b>
<a href="GLOBALS.html#TinyMCE_Menu">TinyMCE_Menu</a></b>()
</code>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Constructor for the menu layer class.
</td>
</tr>
</table>
<p>
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/**
* $RCSfile: overview-summary-TinyMCE_Menu.class.js.html,v $
* $Revision: 1.15 $
* $Date: 2006/04/14 20:00:30 $
*
* <span class="attrib">@author</span> Moxiecode
* <span class="attrib">@copyright</span> Copyright <20> 2004-2006, Moxiecode Systems AB, All rights reserved.
*/</span>
<span class="comment">/**
* Constructor for the menu layer class.
*/</span>
<span class="reserved">function</span> TinyMCE_Menu() {
var id;
<span class="reserved">if</span> (typeof(tinyMCE.menuCounter) == <span class="literal">"undefined"</span>)
tinyMCE.menuCounter = 0;
id = <span class="literal">"mc_menu_"</span> + tinyMCE.menuCounter++;
TinyMCE_Layer.call(<span class="reserved">this</span>, id, true);
<span class="reserved">this</span>.id = id;
<span class="reserved">this</span>.items = new Array();
<span class="reserved">this</span>.needsUpdate = true;
};
<span class="comment">// Extends the TinyMCE_Layer class</span>
TinyMCE_Menu.<span class="reserved">prototype</span> = tinyMCE.extend(TinyMCE_Layer.<span class="reserved">prototype</span>, {
<span class="comment">/**
* Initializes the Menu with settings. This will also create the menu
* as a DIV element if it doesn't exists in the DOM.
*
* <span class="attrib">@param</span> {Array} s Name/Value array with settings.
*/</span>
init : <span class="reserved">function</span>(s) {
var n;
<span class="comment">// Default params</span>
<span class="reserved">this</span>.settings = {
separator_class : <span class="literal">'mceMenuSeparator'</span>,
title_class : <span class="literal">'mceMenuTitle'</span>,
disabled_class : <span class="literal">'mceMenuDisabled'</span>,
menu_class : <span class="literal">'mceMenu'</span>,
drop_menu : true
};
<span class="reserved">for</span> (n in s)
<span class="reserved">this</span>.settings[n] = s[n];
<span class="reserved">this</span>.create(<span class="literal">'div'</span>, <span class="reserved">this</span>.settings.menu_class);
},
<span class="comment">/**
* Clears the menu.
*/</span>
clear : <span class="reserved">function</span>() {
<span class="reserved">this</span>.items = new Array();
},
<span class="comment">/**
* Adds a menu title, this is a static item that can't be clicked.
*
* <span class="attrib">@param</span> {string} t Text to add to title.
*/</span>
addTitle : <span class="reserved">function</span>(t) {
<span class="reserved">this</span>.add({type : <span class="literal">'title'</span>, text : t});
},
<span class="comment">/**
* Adds a disabled menu item, this is a static item that can't be clicked.
*
* <span class="attrib">@param</span> {string} t Text to add to title.
*/</span>
addDisabled : <span class="reserved">function</span>(t) {
<span class="reserved">this</span>.add({type : <span class="literal">'disabled'</span>, text : t});
},
<span class="comment">/**
* Adds a menu separator line.
*/</span>
addSeparator : <span class="reserved">function</span>() {
<span class="reserved">this</span>.add({type : <span class="literal">'separator'</span>});
},
<span class="comment">/**
* Adds a menu item.
*
* <span class="attrib">@param</span> {string} t Menu item text.
* <span class="attrib">@param</span> {string} js JS string to evaluate on click.
*/</span>
addItem : <span class="reserved">function</span>(t, js) {
<span class="reserved">this</span>.add({text : t, js : js});
},
<span class="comment">/**
* Adds a menu item object.
*
* <span class="attrib">@param</span> {Object} mi Menu item object to add.
*/</span>
add : <span class="reserved">function</span>(mi) {
<span class="reserved">this</span>.items[<span class="reserved">this</span>.items.length] = mi;
<span class="reserved">this</span>.needsUpdate = true;
},
<span class="comment">/**
* Update the menu with new HTML contents.
*/</span>
update : <span class="reserved">function</span>() {
var e = <span class="reserved">this</span>.getElement(), h = <span class="literal">''</span>, i, t, m = <span class="reserved">this</span>.items, s = <span class="reserved">this</span>.settings;
<span class="reserved">if</span> (<span class="reserved">this</span>.settings.drop_menu)
h += <span class="literal">'&lt;span class="mceMenuLine"&gt;&lt;/span&gt;'</span>;
h += <span class="literal">'&lt;table border="0" cellpadding="0" cellspacing="0"&gt;'</span>;
<span class="reserved">for</span> (i=0; i&lt;m.length; i++) {
t = tinyMCE.xmlEncode(m[i].text);
c = m[i].class_name ? <span class="literal">' class="'</span> + m[i].class_name + <span class="literal">'"'</span> : <span class="literal">''</span>;
switch (m[i].type) {
case <span class="literal">'separator'</span>:
h += <span class="literal">'&lt;tr class="'</span> + s.separator_class + <span class="literal">'"&gt;&lt;td&gt;'</span>;
break;
case <span class="literal">'title'</span>:
h += <span class="literal">'&lt;tr class="'</span> + s.title_class + <span class="literal">'"&gt;&lt;td&gt;&lt;span'</span> + c +<span class="literal">'&gt;'</span> + t + <span class="literal">'&lt;/span&gt;'</span>;
break;
case <span class="literal">'disabled'</span>:
h += <span class="literal">'&lt;tr class="'</span> + s.disabled_class + <span class="literal">'"&gt;&lt;td&gt;&lt;span'</span> + c +<span class="literal">'&gt;'</span> + t + <span class="literal">'&lt;/span&gt;'</span>;
break;
default:
h += <span class="literal">'&lt;tr&gt;&lt;td&gt;&lt;a href="javascript:void(0);" onmousedown="'</span> + tinyMCE.xmlEncode(m[i].js) + <span class="literal">';return false;"&gt;&lt;span'</span> + c +<span class="literal">'&gt;'</span> + t + <span class="literal">'&lt;/span&gt;&lt;/a&gt;'</span>;
}
h += <span class="literal">'&lt;/td&gt;&lt;/tr&gt;'</span>;
}
h += <span class="literal">'&lt;/table&gt;'</span>;
e.innerHTML = h;
<span class="reserved">this</span>.needsUpdate = false;
<span class="reserved">this</span>.updateBlocker();
},
<span class="comment">/**
* Displays the menu. This function will automaticly hide any previously visible menus.
*/</span>
show : <span class="reserved">function</span>() {
var nl, i;
<span class="reserved">if</span> (tinyMCE.lastMenu == <span class="reserved">this</span>)
<span class="reserved">return</span>;
<span class="reserved">if</span> (<span class="reserved">this</span>.needsUpdate)
<span class="reserved">this</span>.update();
<span class="reserved">if</span> (tinyMCE.lastMenu &amp;&amp; tinyMCE.lastMenu != <span class="reserved">this</span>)
tinyMCE.lastMenu.hide();
TinyMCE_Layer.<span class="reserved">prototype</span>.show.call(<span class="reserved">this</span>);
<span class="reserved">if</span> (!tinyMCE.isOpera) {
<span class="comment">// Accessibility stuff</span>
<span class="comment">/* nl = this.getElement().getElementsByTagName("a");
if (nl.length &gt; 0)
nl[0].focus();*/</span>
}
tinyMCE.lastMenu = <span class="reserved">this</span>;
}
});
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
</body>
</html>