/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2004 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */

package org.gnu.gtk;
import org.gnu.glib.Boxed;
import org.gnu.gtk.event.MenuItemListener;

/**
 * Old class replaced by {@link UIManager}. This class is provided for
 * compatibility only - it will be removed in future releases of java-gnome. Do
 * not use in new code.
 * 
 * @deprecated 2.3
 *
 * This class contains the data necessary for an {@link org.gnu.gtk.ItemFactory}
 * to create a menu.
 * @see org.gnu.gtk.ItemFactory
 */
public class ItemFactoryEntry extends Boxed {
	
	/**
	 * holds the listener for MenuEvents from this widget.
	 */
	private MenuItemListener listener;

	protected ItemFactoryEntry(int handle) {
		this.handle = handle;
	}

	/**
	 * Construct a new ItemFactoryEntry
	 * @param path A string that defines both the name and the path for a menu
	 * item, for example "/File/Open" would be the name of a menu item which would
	 * come under the ItemFactory entry with the path "/File".  Note however that
	 * "/File/Open" would be displayed in the File menu as "Open".  A letter
	 * preceded by an underscore indicates an accelerator key once the menu is
	 * open.
	 * @param accelerator A string that indicates a key combination that can be
	 * used as a shortcut to that menu item.  The string can be made up of either
	 * a single character, or a combination of modifier keys with a single character.
	 * The available modifier keys are:<BR>
	 * <pre>
	 * "&lt;ALT&gt;" - alt
	 * "&lt;CTL&gt;" or "&lt;CTRL&gt;" or "&lt;CONTROL&gt;" - control
	 * "&lt;MOD1&gt;" to "&lt;MOD5&gt;" - modn
	 * "&lt;SHFT&gt;" or "&lt;SHIFT&gt;" - shift
	 * </pre>
	 * @param listener A menu listener that will receive the MenuEvents fired
	 * from the created widgets.
	 * @param itemType A string that defines what type of widget is packed into the
	 * menu items container.  It can be:<BR>
	 * <pre>
	 * null or "&lt;Item&gt;" - create a simple item
	 * "&lt;Title&gt;"        - create a title item
	 * "&lt;CheckItem&gt;"    - create a check item
	 * "&lt;ToggleItem&gt;"   - create a toggle item
	 * "&lt;RadioItem&gt;"    - create a (root) radio item
	 * "Path"                 - create a sister radio item
	 * "&lt;Tearoff&gt;"      - create a tearoff
	 * "&lt;Separator&gt;"    - create a separator
	 * "&lt;Branch&gt;"       - create an item to hold submenus
	 * "&lt;LastBranch&gt;"   - create a right justified branch
	 * </pre>
	 * Note that "&lt;LastBranch&gt;" is only useful for one submenu of a menu.
	 */
	public static ItemFactoryEntry construct(String path, String accelerator, MenuItemListener listener, String itemType) {
		ItemFactoryEntry ife =  new ItemFactoryEntry(gtk_item_factory_entry_new(path, accelerator, itemType));
		ife.listener = listener;
		return ife;
	}
	
	/**
	 * Retrieve the MenuListener associated with this item.
	 */
	public MenuItemListener getMenuListener() {
		return listener;
	}

	// REDTAG: native method doesn't exist at this time!!
	protected native static final int gtk_item_factory_entry_new(String path, String accel, String type);

	/****************************************
	 * BEGINNING OF GENERATED CODE
	 ****************************************/
	native static final protected String getPath(int cptr);
	native static final protected String getAccelerator(int cptr);
	native static final protected String getItemType(int cptr);
	/****************************************
	 * END OF GENERATED CODE
	 ****************************************/
}
