diff -r 4801e9eaf979 -r 3096735e99b2 GUI/Gadget.cs --- a/GUI/Gadget.cs Wed Sep 08 19:29:58 2010 +0000 +++ b/GUI/Gadget.cs Mon Sep 13 22:34:08 2010 +0000 @@ -76,16 +76,21 @@ } } - protected virtual Size Size { + public virtual Size Size { get { return window.Size; } - set { - if (window.Size != value) { - DisposeBuffer(); - this.window.Size = value; - CreateBuffer(); - } + set { + this.window.Size = value; + } + } + + public event EventHandler SizeChanged { + add { + window.SizeChanged += value; + } + remove { + window.SizeChanged -= value; } } @@ -98,12 +103,12 @@ } } - public bool LockPosition { + public bool LockPositionAndSize { get { - return window.LockPosition; + return window.LockPositionAndSize; } set { - window.LockPosition = value; + window.LockPositionAndSize = value; } } @@ -125,6 +130,15 @@ } } + public event HitTestEventHandler HitTest { + add { + window.HitTest += value; + } + remove { + window.HitTest -= value; + } + } + private void CreateBuffer() { this.buffer = new Bitmap(window.Size.Width, window.Size.Height, PixelFormat.Format32bppArgb); @@ -160,6 +174,11 @@ } public void Redraw() { + if (window.Size != buffer.Size) { + DisposeBuffer(); + CreateBuffer(); + } + OnPaint(new PaintEventArgs(graphics, new Rectangle(Point.Empty, window.Size))); window.Update(buffer);