/*********************************************************************************************
 * Copyright 2002 - Volian Enterprises, Inc. All rights reserved.
 * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
 * ------------------------------------------------------------------------------
 * $Workfile: VlnStatusBar.cs $     $Revision: 4 $
 * $Author: Jsj $   $Date: 11/26/02 4:25p $
 *
 * $History: VlnStatusBar.cs $
 * 
 * *****************  Version 4  *****************
 * User: Jsj          Date: 11/26/02   Time: 4:25p
 * Updated in $/LibSource/VlnStatus
 * fixed problem with counter
 * 
 * *****************  Version 3  *****************
 * User: Jsj          Date: 11/26/02   Time: 3:38p
 * Updated in $/LibSource/VlnStatus
 * Added overbounds check
 *********************************************************************************************/
using System;

namespace VlnStatus
{
	/// <summary>
	/// Creates a Status Window with a progression bar control.
	/// 
	/// This class has two constructors. One allows you to pass in the title
	/// of the Status Box.  The Other provides a default title of "Status".
	/// The Status Box Title can also be set/changed via the StatusBoxTitle
	/// property.
	/// 
	/// 
	/// </summary>
	public class VlnStatusBar
	{
		StatusBarFrm StatBar;
		private int Cnt;

		// Create a status window with the default title of "Status"
		public VlnStatusBar()
		{
			StatBar = new StatusBarFrm();
			StatBar.Show();
		}

		// Create a status window with the passed in title
		public VlnStatusBar(string Title)
		{
			StatBar = new StatusBarFrm(Title);
			StatBar.Show();
		}

		// Increament the the status bar by the passed in value.
		public void PerformStep(int val)
		{
//			StatBar.Value = val;
//			Cnt = val;
			BarValue = val;
			StatBar.PerformStep();
		}

		// Increament the the status bar by one
		public void PerformStep()
		{
//			StatBar.Value = StatBar.Value + 1;
			Cnt++;
			BarValue = Cnt;
			StatBar.PerformStep();
		}
		
		// This property gets or sets the current status bar value.
		public int BarValue
		{
			get
			{
				return StatBar.Value;
			}
			set
			{
				StatBar.Value = value;
				Cnt = value;
			}
		}

		// This property sets or gets the maximum value that the
		// BarValue property can be. i.e. when BarValue reaches this
		// number, the status bar is completely displayed.
		public int BarMax
		{
			get
			{
				return StatBar.Maximum;
			}
			set
			{
				StatBar.Maximum = value;
			}
		}

		// This property sets or gets the increamenting value used to
		// move the status bar.  For example, if set to 5, each tick of
		// the status bar represents a value of 5.
		public int BarStepValue
		{
			get
			{
				return StatBar.Step;
			}
			set
			{
				StatBar.Step = value;
			}
		}

		// This property sets or gets the message above the status bar.
		public string StatMsg
		{
			get
			{
				return StatBar.StatusMessage;
			}
			set
			{
				StatBar.StatusMessage = value;
			}
		}

		// This property sets or gets the Status Window Title
		public string StatusBoxTitle
		{
			get
			{
				return StatBar.StatusBoxTitle;
			}
			set
			{
				StatBar.StatusBoxTitle = value;
			}
		}

		public void Dispose()
		{
			StatBar.Dispose();
		}

	}
}

