using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace vclass.whiteboard
{
	/// <summary>
	/// Summary description for DrawingObject.
	/// </summary>
	public class DrawingObject
	{
		public DrawingObject()
		{
			//
			// TODO: Add constructor logic here
			//
		}
		public DrawingObject(Pen myPen)
		{
			this.objectPen=new Pen(Color.Black, 1);
			this.objectPen=myPen;
		}

		virtual public void DrawObject(Graphics g)
		{

		}
		//private Color drawingColor;
		protected Pen objectPen;
	}

	public class MousePath : DrawingObject 
	{
		public MousePath(Pen myPen)
		{
			this.objectPen=myPen;
		}
		private System.Drawing.Drawing2D.GraphicsPath mousePath= new System.Drawing.Drawing2D.GraphicsPath();
		public override void DrawObject(Graphics g)
		{
			g.DrawPath (this.objectPen, mousePath);
		}
		public void addLine(int x1, int y1, int x2 , int y2)
		{
			this.mousePath.AddLine(x1, y1, x2, y2);
		}
	}
	public class Rect:DrawingObject
	{
		private System.Drawing.Rectangle rectangle;
		public Rect (Pen myPen)
		{
			this.objectPen=myPen;
		}
		public Rect (Pen myPen, int x, int y, int width, int height)
		{
			this.objectPen=myPen;
			this.rectangle= new Rectangle(x,y,width,height);
		}

		public override void DrawObject(Graphics g)
		{
			g.DrawRectangle (this.objectPen, rectangle);
		}
	}
	
	public class Ellips : DrawingObject
	{
		private System.Drawing.Rectangle rectangle;
		public Ellips (Pen myPen)
		{
			this.objectPen=myPen;
		}

		public Ellips (Pen myPen, int x, int y, int width, int height)
		{
			this.objectPen=myPen;
			this.rectangle= new Rectangle(x,y,width,height);
		}

		public override void DrawObject(Graphics g)
		{
			g.DrawEllipse (this.objectPen, rectangle);
		}
	}

	public class Line : DrawingObject
	{
		private Point p1;
		private Point p2;
		
		public Line (Pen myPen)
		{
			this.objectPen=myPen;
		}

		public Line (Pen myPen, int x1, int y1, int x2, int y2)
		{
			this.objectPen=myPen;
			this.p1.X=x1;
			this.p1.Y=y1;
			this.p2.X=x2;
			this.p2.Y=y2;
		}

		public override void DrawObject(Graphics g)
		{
			g.DrawLine (this.objectPen, this.p1, this.p2);
		}
	}

	public class Text :DrawingObject
	{
		private System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16);
		private System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
		private String myText;
		private Rect boundingRect;
		private PointF startPoint= new PointF(0.0f, 0.0f);
		public Text(Pen myPen, String text, Rectangle rec, Font fnt) 
		{
			this.objectPen=myPen;
			this.drawBrush= new SolidBrush(this.objectPen.Color);
			myText=text;
			this.startPoint.X=rec.X;
			this.startPoint.Y=rec.Y;
			this.drawFont=fnt;
		}

		public Text(Pen myPen, Point p)
		{
			this.objectPen=myPen;
			this.drawBrush= new SolidBrush(this.objectPen.Color);
			this.startPoint.X= (float)p.X;
			this.startPoint.Y=(float)p.Y;
			//this.myText="Recep Gürlek";
		}

		/*private void addChar(char newChar)
		{
			myText=myText+newChar.ToString();
		}
		*/

		public override void DrawObject(Graphics g)
		{
			g.DrawString (myText, this.drawFont, this.drawBrush, this.startPoint.X, this.startPoint.Y);
		}
	}
}