/// <summary> /// Paints cell on cairo context /// </summary> /// <param name="aArgs"> /// A <see cref="CellExposeEventArgs"/> /// </param> public override void Paint (CellExposeEventArgs aArgs) { if (Area.IsInsideArea(aArgs.ClippingArea) == false) return; /* System.Console.WriteLine("Master: {0}", ((Gtk.Widget) Master).Allocation); System.Console.WriteLine("Owner: {0}", ((IDrawingCell) Owner).Area); System.Console.WriteLine("Arrow area: {0}", Area); System.Console.WriteLine("Cell area: {0}", aArgs.CellArea);*/ object wdg = Master; if (wdg is Gtk.Widget) { Style style = Rc.GetStyle (ChameleonTemplates.Arrow); double x, y; MaxArrowSize (out x, out y); CellRectangle r = aArgs.CellArea.Copy(); if (r.Height > r.Width) while (x<r.Width) r.Shrink(1); else while (y<r.Height) r.Shrink(1); // Gdk.Rectangle rect = aArgs.CellArea.CopyToGdkRectangle(); Gdk.Rectangle rect = r.CopyToGdkRectangle(); // System.Console.WriteLine(rect); Style.PaintArrow (style, aArgs.Drawable, this.ResolveState(), ShadowType.In, rect, (wdg is Gtk.Widget) ? (Gtk.Widget) wdg : null, "arrow", ArrowType, true, rect.X, rect.Y, rect.Width, rect.Height); style.Dispose(); r = null; } else { // System.Console.WriteLine("Arrow master={0}", Master.GetType()); } }
/// <summary> /// Paints cell on cairo context /// </summary> /// <param name="aArgs"> /// A <see cref="CellExposeEventArgs"/> /// </param> public override void Paint (CellExposeEventArgs aArgs) { if (Area.IsInsideArea(aArgs.ClippingArea) == false) return; Style style = Rc.GetStyle (ChameleonTemplates.VSeparator); Widget wdg = (Widget) Master; Style.PaintVline (style, aArgs.Drawable, StateType.Normal, aArgs.CellArea.CopyToGdkRectangle(), wdg, "hseparator", System.Convert.ToInt32(aArgs.CellArea.Y), System.Convert.ToInt32(aArgs.CellArea.Y+aArgs.CellArea.Height), System.Convert.ToInt32(aArgs.CellArea.X)+1); style.Dispose(); }
/// <summary> /// Paints cell on cairo context /// </summary> /// <param name="aArgs"> /// A <see cref="CellExposeEventArgs"/> /// </param> public override void PaintBackground (CellExposeEventArgs aArgs) { Widget wdg = (Widget) Master; ResolveStyle(); System.Console.WriteLine("ENTRY"); System.Console.WriteLine(Master.GetType()); System.Console.WriteLine(aArgs.Drawable.GetType()); //aArgs.CellArea.Grow(1); Gdk.Rectangle rect = aArgs.CellArea.CopyToGdkRectangle(); Gdk.Rectangle clip = aArgs.ClippingArea.CopyToGdkRectangle(); if (aArgs.WidgetInRenderer == true) { System.Console.WriteLine("Paint entry flat"); aArgs.Context.Color = Style.Foregrounds[(int) StateType.Selected].GetCairoColor(); aArgs.CellArea.DrawPath (aArgs.Context); aArgs.Context.Fill(); } else if (wdg.IsSensitive() == false) { Gtk.Style.PaintFlatBox (Style, aArgs.Drawable, StateType.Insensitive, ShadowType.In, rect, wdg, "entry_bg", rect.X, rect.Y, rect.Width, rect.Height); Gtk.Style.PaintShadow(Style, aArgs.Drawable, StateType.Insensitive, ShadowType.In, rect, wdg, "entry", rect.X, rect.Y, rect.Width, rect.Height); } else if (MasterIsFocused == true) { Gtk.Style.PaintFlatBox (Style, aArgs.Drawable, State, ShadowType.In, rect, wdg, "entry_bg", rect.X, rect.Y, rect.Width, rect.Height); Gtk.Style.PaintFocus (Style, aArgs.Drawable, State, clip, wdg, "entry", rect.X, rect.Y, rect.Width, rect.Height); Gtk.Style.PaintShadow (Style, aArgs.Drawable, State, ShadowType.In, rect, wdg, "entry", rect.X, rect.Y, rect.Width, rect.Height); } else { Gtk.Style.PaintFlatBox (Style, aArgs.Drawable, State, ShadowType.In, rect, wdg, "entry_bg", rect.X, rect.Y, rect.Width, rect.Height); Gtk.Style.PaintShadow(Style, aArgs.Drawable, State, ShadowType.In, rect, wdg, "entry", rect.X, rect.Y, rect.Width, rect.Height); } System.Console.WriteLine("END ENTRY"); //aArgs.CellArea.Grow(-1); FreeStyle(); }
/// <summary> /// Method which paints cells /// </summary> /// <param name="aDrawable"> /// Window drawable <see cref="Gdk.Drawable"/> /// </param> /// <param name="aContext"> /// Cairo context <see cref="Cairo.Context"/> /// </param> /// <param name="aArea"> /// Area <see cref="CellRectangle"/> /// </param> /// <param name="aFlags"> /// Flags <see cref="CellRendererState"/> /// </param> protected virtual void PaintCells(Gdk.Drawable aDrawable, Cairo.Context aContext, CellRectangle aArea, CellRendererState aFlags) { if (box.IsVisible == false) { return; } box.Area.Clip(aContext); CellRectangle cliprect = aArea.Copy(); CellExposeEventArgs args = new CellExposeEventArgs(null, aContext, aDrawable, cliprect, box.Area); args.Widget = MasterWidget; args.Renderer = this; args.Flags = aFlags; args.ForceRecalculation = true; MainBox.Arguments.Start(CellAction.Paint, args); box.Paint(args); MainBox.Arguments.Stop(); args.Disconnect(); args = null; aContext.ResetClip(); }
public override void Paint (CellExposeEventArgs aArgs) { if (Area.IsInsideArea(aArgs.ClippingArea) == false) return; Style style = Rc.GetStyle (ChameleonTemplates.Button); Widget wdg = (Widget) Master; Gdk.Rectangle rect = aArgs.CellArea.CopyToGdkRectangle(); rect.Height += 2; if (this.ResolveState() == StateType.Insensitive) { Style.PaintBox (style, aArgs.Drawable, StateType.Insensitive, ShadowType.Out, rect, wdg, "button", rect.X, rect.Y, rect.Width, rect.Height); rect.Width = rect.Width-System.Convert.ToInt32(rect.Width*Progress); Style.PaintBox (style, aArgs.Drawable, StateType.Insensitive, ShadowType.Out, rect, wdg, "button", rect.X, rect.Y, rect.Width, rect.Height); } else { Style.PaintBox (style, aArgs.Drawable, StateType.Normal, ShadowType.Out, rect, wdg, "box", rect.X, rect.Y, rect.Width, rect.Height); rect.Width = rect.Width-System.Convert.ToInt32(rect.Width*Progress); Style.PaintBox (style, aArgs.Drawable, StateType.Selected, ShadowType.Out, rect, wdg, "bar", rect.X, rect.Y, rect.Width, rect.Height); } style.Dispose(); }
/// <summary> /// Method which paints cells /// </summary> /// <param name="evnt"> /// Expose event parameters <see cref="Gdk.EventExpose"/> /// </param> /// <param name="aContext"> /// Cairo context <see cref="Cairo.Context"/> /// </param> protected virtual void PaintCells (Gdk.EventExpose evnt, Gdk.Drawable aDrawable, Cairo.Context aContext, CellRectangle aArea) { if (box.IsVisible == false) return; System.Console.WriteLine("Paint"); box.Area.Clip (aContext); // aContext.Rectangle (box.Area); // aContext.Clip(); // Cairo.Rectangle cliprect = new Cairo.Rectangle (0, 0, Allocation.Width, Allocation.Height); CellRectangle cliprect = new CellRectangle (evnt.Area.X, evnt.Area.Y, evnt.Area.Width, evnt.Area.Height); // box.Paint (evnt, aContext, cliprect, box.Area); // box.Paint (new CellExposeEventArgs (evnt, aContext, evnt.Window, cliprect, box.Area)); CellExposeEventArgs args = new CellExposeEventArgs (evnt, aContext, aDrawable, cliprect, box.Area); args.WidgetInRenderer = IsCellRenderer; args.Widget = this; args.ForceRecalculation = true; box.Arguments.Start (CellAction.Paint, args); box.Paint (args); box.Arguments.Stop(); args.Disconnect(); args = null; aContext.ResetClip(); }
/// <summary> /// Paints cell on cairo context /// </summary> /// <param name="aArgs"> /// A <see cref="CellExposeEventArgs"/> /// </param> protected virtual void PaintCells (CellExposeEventArgs aArgs) { for (int i=0; i<Count; i++) { if (Cells[i].IsVisible == false) continue; if (Cells[i].Area.IsInsideArea(aArgs.ClippingArea) == false) continue; /* if (aArgs.ExposeEvent != null) { Cairo.Rectangle rct = new Cairo.Rectangle (aArgs.ExposeEvent.Area.X, aArgs.ExposeEvent.Area.Y, aArgs.ExposeEvent.Area.Width, aArgs.ExposeEvent.Area.Height); aArgs.Context.Rectangle (rct); aArgs.Context.Clip(); } aArgs.Context.Rectangle (Cells[i].Area); aArgs.Context.Clip();*/ // Cairo.Rectangle origArea = aArgs.CellArea; double[] buff = aArgs.CellArea.Store(); // aArgs.CellArea = Cells[i].Area; aArgs.CellArea.CopyFrom (Cells[i].Area); Cells[i].Paint (aArgs); //(evnt, aContext, aClippingArea, Cells[i].Area); // aArgs.CellArea = origArea; aArgs.CellArea.Restore (buff); buff = null; // aArgs.Context.ResetClip(); } }
/// <summary> /// Paints cell on cairo context /// </summary> /// <param name="aArgs"> /// A <see cref="CellExposeEventArgs"/> /// </param> public override void Paint (CellExposeEventArgs aArgs) { if (Area.IsInsideArea(aArgs.ClippingArea) == false) return; // Cairo.Rectangle origClip = aArgs.ClippingArea; // Cairo.Rectangle origArea = aArgs.CellArea; origClip.CopyFrom(aArgs.ClippingArea); origArea.CopyFrom(aArgs.CellArea); // double[] origClip = aArgs.ClippingArea.Store(); // double[] origArea = aArgs.CellArea.Store(); // Paint background // Cairo.Rectangle fakeArea = CalculateBackgroundRect (aArgs.CellArea); CellRectangle fakeArea = CalculateBackgroundRect (aArgs.CellArea); // aArgs.Context.Rectangle (aArgs.CellArea); // aArgs.Context.Clip(); aArgs.CellArea.Clip (aArgs.Context); if (aArgs.ExposeEvent != null) { // Cairo.Rectangle rct = new Cairo.Rectangle (aArgs.ExposeEvent.Area.X, aArgs.ExposeEvent.Area.Y, aArgs.ExposeEvent.Area.Width, aArgs.ExposeEvent.Area.Height); CellRectangle rct = new CellRectangle (aArgs.ExposeEvent.Area.X, aArgs.ExposeEvent.Area.Y, aArgs.ExposeEvent.Area.Width, aArgs.ExposeEvent.Area.Height); // aArgs.Context.Rectangle (rct); // aArgs.Context.Clip(); rct.Clip (aArgs.Context); rct = null; } CellRectangle fa = aArgs.CellArea; // aArgs.CellArea = fakeArea; aArgs.CellArea = fakeArea; PaintBackground (aArgs); //.ExposeEvent, aContext, aArea, fakeArea); aArgs.CellArea = fa; aArgs.Context.ResetClip(); // Paint cells // aArgs.CellArea = aArgs.CellArea.CopyAndShrink (Padding); aArgs.CellArea.Shrink (Padding); if (aArgs.NeedsRecalculation == true) if ((aArgs.ExposeEvent == null) || (TypeValidator.IsCompatible(Owner.GetType(), typeof(IDrawingCell)) == false)) { DoCalculateCellAreas (aArgs.CellArea); aArgs.ForceRecalculation = false; } if (aArgs.ForceRecalculation == true) { DoCalculateCellAreas (aArgs.CellArea); aArgs.ForceRecalculation = false; } PaintCells (aArgs); aArgs.CellArea.Shrink (-Padding); aArgs.ClippingArea.CopyFrom(origClip); aArgs.CellArea.CopyFrom(origArea); // aArgs.ClippingArea.Restore(origClip); // aArgs.CellArea.Restore(origArea); }
/// <summary> /// Paints cell on cairo context /// </summary> /// <param name="aArgs"> /// A <see cref="CellExposeEventArgs"/> /// </param> public virtual void PaintBackground (CellExposeEventArgs aArgs) { }
/// <summary> /// Paints cell on cairo context /// </summary> /// <param name="aArgs"> /// A <see cref="CellExposeEventArgs"/> /// </param> public override void Paint (CellExposeEventArgs aArgs) { if (Area.IsInsideArea(aArgs.ClippingArea) == false) return; if (pixbuf == null) return; double w,h = 0; GetSize (out w, out h); double xdiff = Area.Width - w; double ydiff = Area.Height - h; Gdk.CairoHelper.SetSourcePixbuf (aArgs.Context, Pixbuf, aArgs.CellArea.X+(xdiff*XPos), aArgs.CellArea.Y+(ydiff*YPos)); aArgs.Context.Paint(); }