// LayoutFill.cs created with MonoDevelop
//
//    QuickStep: Acquire, view and identify spectra 
//    Copyright (C) 2012  Thomas Klose & Torsten Schache, Hiperscan GmbH Dresden, Germany
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.


using System;
using Gtk;

namespace HollyLibrary
{
	public class LayoutFill : Gtk.DrawingArea
	{
		private int width = 30;
		private int height = 30;
		
		private Cairo.Color background_color = new Cairo.Color(0.8, 0.8, 0.8, 1);
		
		public LayoutFill (int width, int height) : base()
		{
			this.width = width;
			this.height = height;
		}
		
		protected override bool OnExposeEvent (Gdk.EventExpose evnt)
		{
			Cairo.Context context = Gdk.CairoHelper.Create(evnt.Window);
			
			context.Rectangle(0, 0, this.Width, this.Height);
			context.Color = this.BackgroundColor;
			
			context.Fill();
			
			((IDisposable) context.Target).Dispose();                                      
        	((IDisposable) context).Dispose();
			return true;
		}
		
		public int Width
		{
			get{return this.width;}
			set
			{
				this.width = value;
				this.QueueDraw();
			}
		}
		
		public int Height
		{
			get{return this.height;}
			set
			{
				this.height = value;
				this.QueueDraw();
			}
		}
		
		public Cairo.Color BackgroundColor
		{
			get{return this.background_color;}
			set
			{
				this.background_color = value;
				this.QueueDraw();
			}
		}
	}
}

