using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace pcd_g1
{
	class PictureWidghet : IWidghet
	{
		public int X { get; private set; }
		public int Y { get; private set; }

		int _width;
		public int Width 
		{
			get
			{
				if (_width == -1)
				{
					if (Image != null)
					{
						return Image.Width;
					}
					else
					{
						return 0;
					}
				}
				else
				{
					return _width;
				}
			}
		}

		int _height;
		public int Height
		{
			get
			{
				if (_height == -1)
				{
					if (Image != null)
					{
						return Image.Height;
					}
					else
					{
						return 0;
					}
				}
				else
				{
					return _height;
				}
			}
		}

		public bool IsModal { get { return false; } }
		public bool IsSleeping { get { return true; } }
		public bool Visibility { get { return true; } }

		public Bitmap Image { get; set; }

		public PictureWidghet(int x, int y, int width = -1, int height = -1, Bitmap img = null)
		{
			Image = img;
			X = x;
			Y = y;
			_width = width;
			_height = height;
		}

		public bool Update(int keyStatus)
		{
			return false;
		}

		public void Draw(Graphics g, int width, int height)
		{
			g.DrawImage(Image, 0, 0, Width, Height);
		}
	}
}
