[longomatch] Add anew wrapping object for drawing contexts



commit aa6e79ebefad7ea237d4f357db2501ad68b4ce50
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Jun 30 18:29:27 2014 +0200

    Add anew wrapping object for drawing contexts

 LongoMatch.Core/Config.cs                          |    1 +
 LongoMatch.Core/Handlers/Drawing.cs                |    3 +-
 LongoMatch.Core/Interfaces/Drawing/ICanvas.cs      |    2 +-
 .../Interfaces/Drawing/IDrawingToolkit.cs          |   14 +-
 LongoMatch.Drawing.Cairo/CairoBackend.cs           |  177 ++++++++++---------
 LongoMatch.Drawing.Cairo/CairoContext.cs           |   52 ++++++
 .../LongoMatch.Drawing.Cairo.mdp                   |    1 +
 LongoMatch.Drawing.Cairo/Surface.cs                |    6 +-
 LongoMatch.Drawing.Cairo/WidgetWrapper.cs          |    2 +-
 LongoMatch.Drawing/Canvas.cs                       |    4 +-
 LongoMatch.Drawing/Widgets/Blackboard.cs           |    2 +-
 LongoMatch.Drawing/Widgets/TeamTagger.cs           |    2 +-
 LongoMatch.Drawing/Widgets/Timerule.cs             |    3 +-
 13 files changed, 169 insertions(+), 100 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 757f537..f9a2dfb 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -22,6 +22,7 @@ using LongoMatch.Common;
 using LongoMatch.Interfaces;
 using LongoMatch.Interfaces.GUI;
 using LongoMatch.Interfaces.Multimedia;
+using LongoMatch.Interfaces.Drawing;
 
 namespace LongoMatch
 {
diff --git a/LongoMatch.Core/Handlers/Drawing.cs b/LongoMatch.Core/Handlers/Drawing.cs
index 9cdca40..dc11f75 100644
--- a/LongoMatch.Core/Handlers/Drawing.cs
+++ b/LongoMatch.Core/Handlers/Drawing.cs
@@ -17,10 +17,11 @@
 //
 using System;
 using LongoMatch.Common;
+using LongoMatch.Interfaces.Drawing;
 
 namespace LongoMatch.Handlers.Drawing
 {
-       public delegate void DrawingHandler (object context, Area area);
+       public delegate void DrawingHandler (IContext context, Area area);
        public delegate void ButtonPressedHandler (Point coords, uint time, ButtonType type, ButtonModifier 
modifier);
        public delegate void ButtonReleasedHandler (Point coords, ButtonType type, ButtonModifier modifier);
        public delegate void MotionHandler (Point coords);
diff --git a/LongoMatch.Core/Interfaces/Drawing/ICanvas.cs b/LongoMatch.Core/Interfaces/Drawing/ICanvas.cs
index 3ac0bd6..5aa621c 100644
--- a/LongoMatch.Core/Interfaces/Drawing/ICanvas.cs
+++ b/LongoMatch.Core/Interfaces/Drawing/ICanvas.cs
@@ -26,7 +26,7 @@ namespace LongoMatch.Interfaces.Drawing
 
        public interface ICanvas
        {
-                void Draw (object context, Area area);
+                void Draw (IContext context, Area area);
        }
        
        public interface ICanvasObject
diff --git a/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs 
b/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
index 8f363b7..52b42d1 100644
--- a/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
+++ b/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
@@ -18,22 +18,25 @@
 using System;
 using LongoMatch.Common;
 using System.Collections.Generic;
-using LongoMatch.Interfaces.Drawing;
 
-namespace LongoMatch.Interfaces
+namespace LongoMatch.Interfaces.Drawing
 {
 
+       public interface IContext:IDisposable {
+               object Value {get;}
+       }
+       
        public interface ISurface:IDisposable  {
                Image Copy ();
                object Value {get;}
-               object Context {get;}
+               IContext Context {get;}
        }
        
        public interface IDrawingToolkit
        {
-               object Context {set;}
+               IContext Context {set;}
                int LineWidth {set;}
-               bool Clear {set;}
+               bool ClearOperation {set;}
                Color StrokeColor {set;}
                Color FillColor {set;}
                string FontFamily {set;}
@@ -46,6 +49,7 @@ namespace LongoMatch.Interfaces
                void DrawSurface (ISurface surface);
                void Begin();
                void End();
+               void Clear (Color color);
                void TranslateAndScale (Point translation, Point scale);
                void DrawLine (Point start, Point stop);
                void DrawTriangle (Point corner, double width, double height,
diff --git a/LongoMatch.Drawing.Cairo/CairoBackend.cs b/LongoMatch.Drawing.Cairo/CairoBackend.cs
index be06e90..146f42a 100644
--- a/LongoMatch.Drawing.Cairo/CairoBackend.cs
+++ b/LongoMatch.Drawing.Cairo/CairoBackend.cs
@@ -18,24 +18,24 @@
 using System;
 using System.Collections.Generic;
 using Cairo;
-using LongoMatch.Interfaces;
 using LongoMatch.Common;
+using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.Drawing;
 using Color = LongoMatch.Common.Color;
-using Point = LongoMatch.Common.Point;
-using LFontSlant = LongoMatch.Common.FontSlant;
-using LFontWeight = LongoMatch.Common.FontWeight;
 using FontSlant = Cairo.FontSlant;
 using FontWeight = Cairo.FontWeight;
 using Image = LongoMatch.Common.Image;
+using LFontSlant = LongoMatch.Common.FontSlant;
+using LFontWeight = LongoMatch.Common.FontWeight;
 using LineStyle = LongoMatch.Common.LineStyle;
+using Point = LongoMatch.Common.Point;
 using Gdk;
-using LongoMatch.Interfaces.Drawing;
 
 namespace LongoMatch.Drawing.Cairo
 {
        public class CairoBackend: IDrawingToolkit
        {
-               Context context;
+               IContext context;
                Color savedStrokeColor, savedFillColor;
                FontSlant fSlant, savedFSlant;
                FontWeight fWeight, savedFWeight;
@@ -55,12 +55,12 @@ namespace LongoMatch.Drawing.Cairo
                        FontWeight = LFontWeight.Normal;
                        FontSlant = LFontSlant.Normal;
                        LineStyle = LineStyle.Normal;
-                       Clear = false;
+                       ClearOperation = false;
                }
                
-               public object Context {
+               public IContext Context {
                        set {
-                               context = value as Context;
+                               context = value;
                        }
                }
                
@@ -124,7 +124,7 @@ namespace LongoMatch.Drawing.Cairo
                        set;
                }
                
-               public bool Clear {
+               public bool ClearOperation {
                        get;
                        set;
                }
@@ -133,6 +133,12 @@ namespace LongoMatch.Drawing.Cairo
                        return new Surface (width, height, image);
                }
                
+               public void Clear (Color color) {
+                       SetColor (color);
+                       CContext.Operator = Operator.Source;
+                       CContext.Paint ();
+               }
+               
                public void Begin() {
                        savedStrokeColor = StrokeColor;
                        savedFillColor = FillColor;
@@ -142,20 +148,20 @@ namespace LongoMatch.Drawing.Cairo
                        savedFontSize = FontSize;
                        savedFontFamily = FontFamily;
                        savedLineStyle = LineStyle;
-                       savedClear = Clear;
-                       context.Save ();
+                       savedClear = ClearOperation;
+                       CContext.Save ();
                }
                
                public void TranslateAndScale (Point translation, Point scale) {
                        if (!disableScalling) {
-                               context.Translate (translation.X, translation.Y);
-                               context.Scale (scale.X, scale.Y);
+                               CContext.Translate (translation.X, translation.Y);
+                               CContext.Scale (scale.X, scale.Y);
                        }
                }
                
                public void End() {
-                       context.Restore ();
-                       Clear = savedClear;
+                       CContext.Restore ();
+                       ClearOperation = savedClear;
                        StrokeColor = savedStrokeColor;
                        FillColor = savedFillColor;
                        fSlant = savedFSlant;
@@ -167,9 +173,9 @@ namespace LongoMatch.Drawing.Cairo
                }
                
                public void DrawLine (Point start, Point stop) {
-                       context.LineWidth = LineWidth;
-                       context.MoveTo (start.X, start.Y);
-                       context.LineTo (stop.X, stop.Y);
+                       CContext.LineWidth = LineWidth;
+                       CContext.MoveTo (start.X, start.Y);
+                       CContext.LineTo (stop.X, stop.Y);
                        StrokeAndFill ();
                }
                
@@ -197,10 +203,10 @@ namespace LongoMatch.Drawing.Cairo
                        }
                        
                        SetColor (StrokeColor);
-                       context.MoveTo (x1, y1);
-                       context.LineTo (x2, y2);
-                       context.LineTo (x3, y3);
-                       context.ClosePath();
+                       CContext.MoveTo (x1, y1);
+                       CContext.LineTo (x2, y2);
+                       CContext.LineTo (x3, y3);
+                       CContext.ClosePath();
                        StrokeAndFill ();
                }
                
@@ -213,15 +219,15 @@ namespace LongoMatch.Drawing.Cairo
                                x2 = vertices[i+1].X;
                                y2 = vertices[i+1].Y;
                                
-                               context.MoveTo (x1, y1);
-                               context.LineTo (x2, y2);
+                               CContext.MoveTo (x1, y1);
+                               CContext.LineTo (x2, y2);
                        }
-                       context.ClosePath();
+                       CContext.ClosePath();
                        StrokeAndFill ();
                }
                
                public void DrawRectangle (Point start, double width, double height) {
-                       context.Rectangle (start.X, start.Y, width, height);
+                       CContext.Rectangle (start.X, start.Y, width, height);
                        StrokeAndFill ();
                }
                
@@ -236,20 +242,20 @@ namespace LongoMatch.Drawing.Cairo
                        if((radius > height / 2) || (radius > width / 2))
                                radius = Math.Min (height / 2, width / 2);
 
-                       context.MoveTo (x, y + radius);
-                       context.Arc (x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
-                       context.LineTo (x + width - radius, y);
-                       context.Arc (x + width - radius, y + radius, radius, -Math.PI / 2, 0);
-                       context.LineTo (x + width, y + height - radius);
-                       context.Arc (x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
-                       context.LineTo (x + radius, y + height);
-                       context.Arc (x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
-                       context.ClosePath();
+                       CContext.MoveTo (x, y + radius);
+                       CContext.Arc (x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
+                       CContext.LineTo (x + width - radius, y);
+                       CContext.Arc (x + width - radius, y + radius, radius, -Math.PI / 2, 0);
+                       CContext.LineTo (x + width, y + height - radius);
+                       CContext.Arc (x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
+                       CContext.LineTo (x + radius, y + height);
+                       CContext.Arc (x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
+                       CContext.ClosePath();
                        StrokeAndFill ();
                }
 
                public void DrawCircle (Point center, double radius) {
-                       context.Arc (center.X, center.Y, radius, 0, 2 * Math.PI);
+                       CContext.Arc (center.X, center.Y, radius, 0, 2 * Math.PI);
                        StrokeAndFill ();
                }
 
@@ -266,20 +272,20 @@ namespace LongoMatch.Drawing.Cairo
                                return;
                        }
                        SetColor (StrokeColor);
-                       context.SelectFontFace (FontFamily, fSlant, fWeight);
-                       context.SetFontSize (FontSize);
-                       extents = context.TextExtents (text);
-                       fextents = context.FontExtents;
+                       CContext.SelectFontFace (FontFamily, fSlant, fWeight);
+                       CContext.SetFontSize (FontSize);
+                       extents = CContext.TextExtents (text);
+                       fextents = CContext.FontExtents;
                        x = point.X + width / 2 - (extents.Width / 2 + extents.XBearing);
                        y = point.Y + height / 2 - (extents.Height / 2 + extents.YBearing);
-                       context.MoveTo (x, y);
-                       context.ShowText (text);
+                       CContext.MoveTo (x, y);
+                       CContext.ShowText (text);
                        StrokeAndFill ();
                }
                
                public void DrawImage (Image image) {
-                       CairoHelper.SetSourcePixbuf (context, image.Value, 0, 0);
-                       context.Paint ();
+                       CairoHelper.SetSourcePixbuf (CContext, image.Value, 0, 0);
+                       CContext.Paint ();
                }
 
                public void DrawImage (Point start, double width, double height, Image image, bool scale) {
@@ -293,22 +299,22 @@ namespace LongoMatch.Drawing.Cairo
                                scaleX = width / image.Width;
                                scaleY = height / image.Height;
                        }
-                       context.Save ();
-                       context.Translate (start.X + offset.X, start.Y + offset.Y);
-                       context.Scale (scaleX, scaleY);
-                       CairoHelper.SetSourcePixbuf (context, image.Value, 0, 0);
-                       context.Paint ();
-                       context.Restore ();
+                       CContext.Save ();
+                       CContext.Translate (start.X + offset.X, start.Y + offset.Y);
+                       CContext.Scale (scaleX, scaleY);
+                       CairoHelper.SetSourcePixbuf (CContext, image.Value, 0, 0);
+                       CContext.Paint ();
+                       CContext.Restore ();
                }
 
                public void DrawEllipse (Point center, double axisX, double axisY) {
                        double max = Math.Max (axisX, axisY);
-                       context.Save ();
-                       context.Translate (center.X, center.Y);
-                       context.Scale (axisX / max, axisY / max);
-                       context.Arc (0, 0, max, 0, 2 * Math.PI);
+                       CContext.Save ();
+                       CContext.Translate (center.X, center.Y);
+                       CContext.Scale (axisX / max, axisY / max);
+                       CContext.Arc (0, 0, max, 0, 2 * Math.PI);
                        StrokeAndFill ();
-                       context.Restore ();
+                       CContext.Restore ();
                }
                
                public void DrawArrow(Point start, Point stop, int lenght, double radians, bool closed) {
@@ -320,21 +326,21 @@ namespace LongoMatch.Drawing.Cairo
                        vx2 = stop.X + (lenght + LineWidth) * Math.Cos(angle + radians);
                        vy2 = stop.Y + (lenght + LineWidth) * Math.Sin(angle + radians);
 
-                       context.MoveTo(stop.X, stop.Y);
-                       context.LineTo(vx1, vy1);
+                       CContext.MoveTo(stop.X, stop.Y);
+                       CContext.LineTo(vx1, vy1);
                        if (!closed) {
-                               context.MoveTo(stop.X, stop.Y);
-                               context.LineTo(vx2,vy2);
+                               CContext.MoveTo(stop.X, stop.Y);
+                               CContext.LineTo(vx2,vy2);
                        } else {
-                               context.LineTo(vx2,vy2);
-                               context.ClosePath ();
+                               CContext.LineTo(vx2,vy2);
+                               CContext.ClosePath ();
                        }
                        StrokeAndFill();
                }
 
                public void DrawSurface (ISurface surface) {
-                       context.SetSourceSurface (surface.Value as ImageSurface, 0, 0);
-                       context.Paint ();
+                       CContext.SetSourceSurface (surface.Value as ImageSurface, 0, 0);
+                       CContext.Paint ();
                }
                
                public Image Copy (ICanvas canvas, double width, double height) {
@@ -343,65 +349,68 @@ namespace LongoMatch.Drawing.Cairo
                        
                        pm = new Pixmap (null, (int) width, (int) height, 24);
                        disableScalling = true;
-                       using(Context c = CairoHelper.Create (pm)) {
-                               context = c;
-                               canvas.Draw (context, new Area (new Point (0, 0), width, height));
+                       using(CairoContext c = new CairoContext (CairoHelper.Create (pm))) {
+                               canvas.Draw (c, new Area (new Point (0, 0), width, height));
                        }
                        img = new Image (Gdk.Pixbuf.FromDrawable (pm, Colormap.System, 0, 0, 0, 0,
                                                                  (int) width, (int)height));
                        disableScalling = false;
-                       context = null;
+                       Context = null;
                        return img;
                }
 
                public void Save (ICanvas canvas, double width, double height, string filename) {
                        ImageSurface pngSurface = new ImageSurface(Format.ARGB32, (int) width, (int) height);
                        disableScalling = true;
-                       using(Context c = new Context(pngSurface)) {
-                               context = c;
-                               canvas.Draw (context, new Area (new Point (0, 0), width, height));
+                       using(CairoContext c = new CairoContext (new Context(pngSurface))) {
+                               canvas.Draw (c, new Area (new Point (0, 0), width, height));
                        }
                        pngSurface.WriteToPng(filename);
                        disableScalling = false;
-                       context = null;
                        pngSurface.Dispose ();
                }
 
+               Context CContext {
+                       get {
+                               return context.Value as Context;
+                       }
+               }
+               
                void SetDash() {
                        switch (LineStyle) {
                        case LineStyle.Normal:
-                               context.SetDash(new double[] {}, 0);
+                               CContext.SetDash(new double[] {}, 0);
                                break;  
                        default:
-                               context.SetDash(new double[] {10, 10}, 10);
+                               CContext.SetDash(new double[] {10, 10}, 10);
                                break;
                        }
                }
 
                void StrokeAndFill () {
                        SetDash ();
-                       if (Clear) {
-                               context.Operator = Operator.Clear;
+                       if (ClearOperation) {
+                               CContext.Operator = Operator.Clear;
                        } else {
-                               context.Operator = Operator.Over;
+                               CContext.Operator = Operator.Over;
                        }
-                       context.LineCap = LineCap.Round;
-                       context.LineJoin = LineJoin.Round;
-                       context.LineWidth = LineWidth;
+                       CContext.LineCap = LineCap.Round;
+                       CContext.LineJoin = LineJoin.Round;
+                       CContext.LineWidth = LineWidth;
                        SetColor (StrokeColor);
-                       context.StrokePreserve();
+                       CContext.StrokePreserve();
                        SetColor (FillColor);
-                       context.Fill();
+                       CContext.Fill();
                }
                
                void SetColor (Color color) {
                        if (color != null) {
-                               context.SetSourceRGBA ((double) color.R / byte.MaxValue,
+                               CContext.SetSourceRGBA ((double) color.R / byte.MaxValue,
                                                       (double) color.G / byte.MaxValue,
                                                       (double) color.B / byte.MaxValue,
                                                       (double) color.A / byte.MaxValue);
                        } else {
-                               context.SetSourceRGBA (0, 0, 0, 0);
+                               CContext.SetSourceRGBA (0, 0, 0, 0);
                        }
                }
                
diff --git a/LongoMatch.Drawing.Cairo/CairoContext.cs b/LongoMatch.Drawing.Cairo/CairoContext.cs
new file mode 100644
index 0000000..2a2f2ab
--- /dev/null
+++ b/LongoMatch.Drawing.Cairo/CairoContext.cs
@@ -0,0 +1,52 @@
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
+//  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 2 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, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using Gdk;
+using Cairo;
+using LongoMatch.Interfaces.Drawing;
+
+namespace LongoMatch.Drawing.Cairo
+{
+       public class CairoContext: IContext
+       {
+               public CairoContext (Window window)
+               {
+                       Value = CairoHelper.Create (window);
+               }
+
+               public CairoContext (global::Cairo.Surface surface)
+               {
+                       Value = new Context (surface);
+               }
+
+               public CairoContext (Context context)
+               {
+                       Value = context;
+               }
+               
+               public object Value {
+                       get;
+                       protected set;
+               }
+               
+               public void Dispose () {
+                       (Value as Context).Dispose();
+               }
+       }
+}
+
diff --git a/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp 
b/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp
index a001b93..311eb29 100644
--- a/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp
+++ b/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp
@@ -26,6 +26,7 @@
     <File subtype="Code" buildaction="Compile" name="Surface.cs" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/tools/draw-eraser.png" 
resource_id="eraser" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/tools/draw-cross.png" 
resource_id="cross" />
+    <File subtype="Code" buildaction="Compile" name="Context.cs" />
   </Contents>
   <References>
     <ProjectReference type="Package" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.Drawing.Cairo/Surface.cs b/LongoMatch.Drawing.Cairo/Surface.cs
index e5b5d1e..9a65c8b 100644
--- a/LongoMatch.Drawing.Cairo/Surface.cs
+++ b/LongoMatch.Drawing.Cairo/Surface.cs
@@ -17,7 +17,7 @@
 //
 using System;
 using Cairo;
-using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.Drawing;
 using LongoMatch.Common;
 
 namespace LongoMatch.Drawing.Cairo
@@ -43,9 +43,9 @@ namespace LongoMatch.Drawing.Cairo
                        }
                }
                
-               public object Context {
+               public IContext Context {
                        get {
-                               return new Context (surface);
+                               return new CairoContext (surface);
                        }
                }
                
diff --git a/LongoMatch.Drawing.Cairo/WidgetWrapper.cs b/LongoMatch.Drawing.Cairo/WidgetWrapper.cs
index 025a701..306d7d1 100644
--- a/LongoMatch.Drawing.Cairo/WidgetWrapper.cs
+++ b/LongoMatch.Drawing.Cairo/WidgetWrapper.cs
@@ -172,7 +172,7 @@ namespace LongoMatch.Drawing.Cairo
                
                void Draw (Area area) {
                        if (DrawEvent != null) {
-                               using (Context c = CairoHelper.Create (widget.GdkWindow)) {
+                               using (CairoContext c = new CairoContext (widget.GdkWindow)) {
                                        if (area == null) {
                                                area = new Area (new Point (0, 0), Width, Height);
                                        }
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index b48662a..105557b 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -55,7 +55,7 @@ namespace LongoMatch.Drawing
                
                }
                
-               public virtual void Draw (object context, Area area) {
+               public virtual void Draw (IContext context, Area area) {
                        tk.Context = context;
                        tk.TranslateAndScale (translation, new Point (scaleX, scaleY));
                        tk.Begin ();
@@ -288,7 +288,7 @@ namespace LongoMatch.Drawing
                        }
                }
                
-               public override void Draw (object context, Area area)
+               public override void Draw (IContext context, Area area)
                {
                        if (Background != null) {
                                tk.Context = context;
diff --git a/LongoMatch.Drawing/Widgets/Blackboard.cs b/LongoMatch.Drawing/Widgets/Blackboard.cs
index db511ea..67a194b 100644
--- a/LongoMatch.Drawing/Widgets/Blackboard.cs
+++ b/LongoMatch.Drawing/Widgets/Blackboard.cs
@@ -289,7 +289,7 @@ namespace LongoMatch.Drawing.Widgets
                        }
                }
                
-               public override void Draw (object context, Area area)
+               public override void Draw (IContext context, Area area)
                {
                        base.Draw (context, area);
                        if (backbuffer != null) {
diff --git a/LongoMatch.Drawing/Widgets/TeamTagger.cs b/LongoMatch.Drawing/Widgets/TeamTagger.cs
index 3f60584..28299f4 100644
--- a/LongoMatch.Drawing/Widgets/TeamTagger.cs
+++ b/LongoMatch.Drawing/Widgets/TeamTagger.cs
@@ -264,7 +264,7 @@ namespace LongoMatch.Drawing.Widgets
                        }
                }
                
-               public override void Draw (object context, Area area)
+               public override void Draw (IContext context, Area area)
                {
                        if (currentWidth != widget.Width || currentHeight != widget.Height) {
                                Resize ();
diff --git a/LongoMatch.Drawing/Widgets/Timerule.cs b/LongoMatch.Drawing/Widgets/Timerule.cs
index 202b8db..c99fe95 100644
--- a/LongoMatch.Drawing/Widgets/Timerule.cs
+++ b/LongoMatch.Drawing/Widgets/Timerule.cs
@@ -19,6 +19,7 @@ using System;
 using LongoMatch.Store;
 using LongoMatch.Common;
 using LongoMatch.Interfaces.Drawing;
+using LongoMatch.Interfaces;
 
 namespace LongoMatch.Drawing.Widgets
 {
@@ -55,7 +56,7 @@ namespace LongoMatch.Drawing.Widgets
                        get;
                }
                
-               public override void Draw (object context, Area area)
+               public override void Draw (IContext context, Area area)
                {
                        double height = widget.Height;
                        double width = widget.Width;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]