public override NSCellHit HitTest (NSEvent forEvent, RectangleF inRect, NSView ofView) { PointF point = ofView.ConvertPointFromView (forEvent.LocationInWindow, null); if (_image != null) { RectangleF imageFrame; inRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out inRect); imageFrame.X += 3; imageFrame.Size = _image.Size; if (ofView.MouseinRect(point, imageFrame)) return NSCellHit.ContentArea; } return base.HitTest (forEvent, inRect, ofView); }
public override void SelectWithFrame (RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, int selStart, int selLength) { RectangleF textFrame, imageFrame; aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame); base.SelectWithFrame(textFrame, inView, editor, delegateObject, selStart, selLength); }
public override void DrawWithFrame (RectangleF cellFrame, NSView inView) { //Assert (!_deallocCalled, "DrawWithFrame: Dealloc was called on object"); //Assert (!_disposeCalled, "DrawWithFrame: Dispose was called on object"); if (_image != null) { RectangleF imageFrame; cellFrame.Divide (3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out cellFrame); if (DrawsBackground) { BackgroundColor.Set (); NSGraphics.RectFill (imageFrame); } imageFrame.X += 3; imageFrame.Size = _image.Size; //if (inView.IsFlipped) { // imageFrame.Y += (float)Math.Ceiling((cellFrame.Height + imageFrame.Height) / 2); //} //else { imageFrame.Y += (float)Math.Ceiling ((cellFrame.Height - imageFrame.Height) / 2); //} _image.Draw (imageFrame, new RectangleF (PointF.Empty, _image.Size), NSCompositingOperation.SourceOver, 1f, true, null); } base.DrawWithFrame (cellFrame, inView); }
public override void EditWithFrame (RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent) { RectangleF textFrame, imageFrame; aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame); base.EditWithFrame(textFrame, inView, editor, delegateObject, theEvent); }