package Icarus.Graphics.Animation;

import System.Collections.*;
import System.Drawing.*;

/**
 * This class provides the functionality of a frameset.
 * 
 * @author $Author: asskoala $
 * @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
 */
public class Frameset
{
	/**
	 * The list of frames in this frameset.
	 */
	private IList m_FrameList;

	/**
	 * Performs some necessary initialization.
	 */
	public Frameset()
	{
		m_FrameList = new ArrayList();
	}

	/**
	 * Returns the number of frames in the frameset.
	 */
	public int getFrameCount() 
	{
		return m_FrameList.get_Count();
	}

	/**
	 * Adds a new frame to the frameset and returns the current number of frames in the frameset.
	 */
	public int addFrame(IFrame frame) 
	{
		m_FrameList.Add(frame);

		return this.getFrameCount();
	}

	/**
	 * Adds a new frame to the frameset and returns the current number of frames in the frameset.
	 */
	public int addFrame(Bitmap img, Point anchor)
	{
		IFrame new_frame = AnimationFactory.getInstance().makeBlankFrame();
		new_frame.initialize(anchor, img);

		return this.addFrame(new_frame);
	}

	/**
	 * Returns the frame at the specified index.
	 */
	public IFrame getFrameAt(int index) 
	{
		return (IFrame) m_FrameList.get_Item(index);
	}
}
