/// <summary> /// Expose event handler, calls PaintBackground and then PaintCells /// </summary> /// <param name="evnt"> /// Arguments <see cref="Gdk.EventExpose"/> /// </param> /// <returns> /// true if successful, false if not <see cref="System.Boolean"/> /// </returns> protected override bool OnExposeEvent(Gdk.EventExpose evnt) { base.OnExposeEvent(evnt); int x, y, w, h, d = 0; GdkWindow.GetGeometry(out x, out y, out w, out h, out d); CellRectangle r = new CellRectangle(0, 0, w, h); System.Console.WriteLine("Using cellrendererwindow=" + (IsCellRenderer == true)); Gdk.Window masterDrawable = (IsCellRenderer == true) ? cellRendererWindow : evnt.Window; Gdk.Drawable buffer = null; Cairo.Context context = null; if (IsDoubleBuffered == true) { System.Console.WriteLine("DoubleBuffered"); buffer = new Gdk.Pixmap(masterDrawable, Allocation.Width, Allocation.Height, 24); context = Gdk.CairoHelper.Create(buffer); } else { masterDrawable.BeginPaintRect(evnt.Area); context = Gdk.CairoHelper.Create(masterDrawable); } Gdk.Color clr = Style.Backgrounds[(int)StateType.Normal]; // context.Color = new Cairo.Color (0, 0, 1); context.Color = clr.GetCairoColor(); r.DrawPath(context); context.Fill(); // if ((BackgroundPainted == true) && (Sensitive == true)) // PaintBackground (evnt, g, rect); // Cairo.Rectangle r = rect.CopyAndShrink (Padding); r.Shrink(Padding); CalculateCellAreas(r); if (IsDoubleBuffered == true) { PaintCells(evnt, buffer, context, r); evnt.Window.DrawDrawable(Style.BlackGC, buffer, evnt.Area.X, evnt.Area.Y, evnt.Area.X, evnt.Area.Y, evnt.Area.Width, evnt.Area.Height); buffer.Dispose(); } else { PaintCells(evnt, masterDrawable, context, r); masterDrawable.EndPaint(); } ((IDisposable)context.Target).Dispose(); ((IDisposable)context).Dispose(); context = null; return(true); }
/// <summary> /// Compares colors if they are equal /// </summary> /// <param name="aColor"> /// Original color <see cref="Cairo.Color"/> /// </param> /// <param name="aCompareTo"> /// Compared to <see cref="Gdk.Color"/> /// </param> /// <returns> /// true if equal false if not <see cref="System.Boolean"/> /// </returns> public static bool IsEqualColor(this Cairo.Color aColor, Gdk.Color aCompareTo) { return(IsEqualColor(aColor, aCompareTo.GetCairoColor())); }