public override void DrawBorderAndBackground(System.Drawing.RectangleF cellFrame, NSView controlView) { if (DrawsBackground) { var nscontext = NSGraphicsContext.CurrentContext; var context = nscontext.GraphicsPort; context.SetFillColor(BackgroundColor.ToCG()); context.FillRect(cellFrame); } base.DrawBorderAndBackground(cellFrame, controlView); }
public override void DrawInteriorWithFrame(CGRect cellFrame, NSView inView) { var nscontext = NSGraphicsContext.CurrentContext; if (DrawsBackground) { var context = nscontext.GraphicsPort; context.SetFillColor(BackgroundColor.ToCG()); context.FillRect(cellFrame); } nscontext.ImageInterpolation = ImageInterpolation; base.DrawInteriorWithFrame(cellFrame, inView); }
public override void DrawRect(CGRect dirtyRect) { var nscontext = NSGraphicsContext.CurrentContext; var isFirstResponder = Window.FirstResponder == this; if (DrawsBackground) { var context = nscontext.GraphicsPort; context.SetFillColor(BackgroundColor.ToCG()); context.FillRect(dirtyRect); } var cellFrame = Bounds; var handler = Handler; if (handler == null) { return; } var graphicsHandler = new GraphicsHandler(null, nscontext, (float)cellFrame.Height, flipped: true); using (var graphics = new Graphics(graphicsHandler)) { var rowView = this.Superview as NSTableRowView; var state = CellStates.None; if (rowView != null && rowView.Selected) { state |= CellStates.Selected; } if (isFirstResponder) { state |= CellStates.Editing; SetKeyboardFocusRingNeedsDisplay(cellFrame); nscontext.SaveGraphicsState(); GraphicsExtensions.SetFocusRingStyle(NSFocusRingPlacement.RingOnly); NSGraphics.RectFill(cellFrame); nscontext.RestoreGraphicsState(); } var item = val as EtoCellValue; #pragma warning disable 618 var args = new DrawableCellPaintEventArgs(graphics, cellFrame.ToEto(), state, item != null ? item.Item : null); handler.Callback.OnPaint(handler.Widget, args); #pragma warning restore 618 } }
public override void DrawInteriorWithFrame(CGRect cellFrame, NSView inView) { var nscontext = NSGraphicsContext.CurrentContext; if (DrawsBackground) { var context = nscontext.GraphicsPort; context.SetFillColor(BackgroundColor.ToCG()); context.FillRect(cellFrame); } var handler = Handler; var graphicsHandler = new GraphicsHandler(null, nscontext, (float)cellFrame.Height, flipped: true); using (var graphics = new Graphics(graphicsHandler)) { var state = Highlighted ? DrawableCellStates.Selected : DrawableCellStates.None; var item = ObjectValue as EtoCellValue; var args = new DrawableCellPaintEventArgs(graphics, cellFrame.ToEto(), state, item != null ? item.Item : null); handler.Callback.OnPaint(handler.Widget, args); } }