/*
 * 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.event;

import org.gnu.gtk.TreeIter;
import org.gnu.gtk.TreePath;

/**
 * An event represeting action by a {@link org.gnu.gtk.TreeModel} class.
 */
public class TreeModelEvent extends GtkEvent {
	
	private TreePath treePath;
	private TreeIter treeIter;
	private int[] newOrder;

	/**
	 * Type of a TreeModelEvent
	 */
	public static class Type extends GtkEventType {
		private Type(int id, String name) {
			super(id, name);
		}

		public static final Type ROW_CHANGED = new Type(1, "ROW_CHANGED");
		public static final Type ROW_INSERTED = new Type(2, "ROW_INSERTED");
		public static final Type ROW_HAS_CHILD_TOGGLED = new Type(3, "ROW_HAS_CHILD_TOGGLED");
		public static final Type ROW_DELETED = new Type(4, "ROW_DELETED");
		public static final Type ROWS_REORDERED = new Type(5, "ROWS_REORDERED");

	}

	/**
	 * Creates a new TreeModelEvent. This is used internally by java-gnome. Users
	 * only have to deal with listeners.
	 */
	public TreeModelEvent(Object source, TreeModelEvent.Type type) {
		super(source, type);
	}

	/**
	 * @return True if the type of this event is the same as that stated.
	 */
	public boolean isOfType(TreeModelEvent.Type aType) {
		return (type.getID() == aType.getID());
	}
	/**
	 * @return Returns the treeIter.
	 */
	public TreeIter getTreeIter() {
		return treeIter;
	}
	/**
	 * @param treeIter The treeIter to set.
	 */
	public void setTreeIter(TreeIter treeIter) {
		this.treeIter = treeIter;
	}
	/**
	 * @return Returns the treePath.
	 */
	public TreePath getTreePath() {
		return treePath;
	}
	/**
	 * @param treePath The treePath to set.
	 */
	public void setTreePath(TreePath treePath) {
		this.treePath = treePath;
	}
	/**
	 * @return Returns the newOrder.
	 */
	public int[] getNewOrder() {
		return newOrder;
	}
	/**
	 * @param newOrder The newOrder to set.
	 */
	public void setNewOrder(int[] newOrder) {
		this.newOrder = newOrder;
	}
}
