Module "wsf_menu"
=================

A module which implements a WSF Component for DHTML menus.
 
object WsfMenu WsfComponent
---------------------------

This WSF Component adds a DHTML menu to the application window. It should
be the first child of the root component and the root component shouldn't
add any content before the html code created by this component. Otherwise
it is possible that the dynamic module is rendered over that content and
covers it.

Derived from WsfComponent
 

var WsfMenu.nojsmenu = 0;
~~~~~~~~~~~~~~~~~~~~~~~~~

Create boring non-javascript menus if this is set to '1'.
Passing 'nojsmenu: 1' to the constructor sets this this variable.
	 

var WsfMenu.size_x = 200;
~~~~~~~~~~~~~~~~~~~~~~~~~

The width of a menu item.

Only adjust this if you have extraordinary long descriptions of your
menu items.
	 

var WsfMenu.size_y = 25;
~~~~~~~~~~~~~~~~~~~~~~~~

The height of a menu element.

Usuall you do not need to change this to another value;
	 

method WsfMenu.main();
~~~~~~~~~~~~~~~~~~~~~~

The overloaded WsfComponent.main().
	 

method WsfMenu.get_html();
~~~~~~~~~~~~~~~~~~~~~~~~~~

The overloaded WsfComponent.get_html().
	 

method WsfMenu.init(menu_data, %options);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The constructor.

The parameter is a pointer to a hash with the menu structure. The
hash key is the description HTML text of the entry (encode it with
encode_xml() if needed) and the value is a function pointer
for regular menu entries and hashes again for submenus. E.g.:

	function get_menu_action(text) {
		return function() {
			debug text;
		};
	}

	var menu_data = [
		'Menu 1' => [
			'Entry #1' => function() {
				debug "Hello World!";
			},
			'Entry #2' => function() {
				debug "This is a small demo!";
			}
		],
		'Menu 2' => [
			'Closure Example #1' =>
				get_menu_action("Hello World!"),
			'Closure Example #2' =>
				get_menu_action("Another Test!")
		],
		'About' => function() {
			debug "This is a demo program!";
		}
	];

	var menu = new WsfMenu(menu_data);

SPL has support for closures. In this example, the get_menu_action()
function is using the concept of closures for storing additional
data with the function pointers assigned to the items in 'Menu 2'.

Right now, 'nojsmenu: 1' is the only supported option. It sets the
nojsmenu variable.
	 
