public override void Apply (CanvasItem item, Context cr) { int steps = ShadowSize; double opacity_step = ShadowOpacity / ShadowSize; Color color = new Color (0, 0, 0); double width = Math.Round (item.Allocation.Width); double height = Math.Round (item.Allocation.Height); if (Fill != null) { cr.Rectangle (shadow_size, shadow_size, width - ShadowSize * 2, height - ShadowSize * 2); Fill.Apply (cr); cr.Fill (); } cr.LineWidth = 1.0; for (int i = 0; i < steps; i++) { CairoExtensions.RoundedRectangle (cr, i + 0.5, i + 0.5, (width - 2 * i) - 1, (height - 2 * i) - 1, steps - i); color.A = opacity_step * (i + 1); cr.Color = color; cr.Stroke (); } }
public void QueueRender (CanvasItem item, Rect rect) { if (host == null) { return; } host.QueueRender (item, rect); }
public void InvalidateMeasure() { CanvasItem root = RootAncestor; if (root != null && root.Manager != null) { root.Manager.QueueMeasure(this); } }
protected void WithChildAt(double x, double y, bool grabHasPriority, CanvasItemHandler handler) { CanvasItem child = FindChildAt(x, y, grabHasPriority); if (child != null) { handler(child); } }
public void Add(CanvasItem child) { if (Child != null) { throw new InvalidOperationException("Child is already set, remove it first"); } Child = child; }
public void Remove(CanvasItem child) { if (Child != child) { throw new InvalidOperationException("child does not already belong to host"); } Child = null; }
public void QueueRender(CanvasItem item, Rect rect) { if (host == null) { return; } host.QueueRender(item, rect); }
protected void InvalidateRender(Rect area) { CanvasItem root = RootAncestor; if (root != null && root.Manager != null) { root.Manager.QueueRender(this, area); } }
public override bool GetTooltipMarkupAt(Point pt, out string markup, out Rect area) { if (base.GetTooltipMarkupAt(pt, out markup, out area)) { return(true); } pt = ChildCoord(this, pt); CanvasItem child = FindChildAt(pt, false); return(child == null ? false : child.GetTooltipMarkupAt(ChildCoord(child, pt), out markup, out area)); }
private void OnInvalidate(Rect area) { CanvasItem root = RootAncestor; if (root != null && root.Manager != null) { root.Manager.QueueRender(this, area); } else { Hyena.Log.WarningFormat("Asked to invalidate {0} for {1} but no CanvasManager!", area, this); } }
public virtual void Apply(CanvasItem item, Cairo.Context cr) { }
public void Remove(CanvasItem child) { if (Child != child) { throw new InvalidOperationException ("child does not already belong to host"); } Child = null; }
Point ChildCoord(CanvasItem item, Point pt) { return(new Point(pt.X - item.Allocation.X, pt.Y - item.Allocation.Y)); }
public void Add(CanvasItem child) { if (Child != null) { throw new InvalidOperationException ("Child is already set, remove it first"); } Child = child; }
public void QueueRender(CanvasItem item, Rect rect) { double x = Allocation.X; double y = Allocation.Y; double w, h; if (rect.IsEmpty) { w = item.Allocation.Width; h = item.Allocation.Height; } else { x += rect.X; y += rect.Y; w = rect.Width; h = rect.Height; } while (item != null) { x += item.ContentAllocation.X; y += item.ContentAllocation.Y; item = item.Parent; } QueueDrawArea ( (int)Math.Floor (x), (int)Math.Floor (y), (int)Math.Ceiling (w), (int)Math.Ceiling (h) ); }
public virtual void Apply(CanvasItem item, Cairo.Context cr) { }
public void QueueMeasure(CanvasItem item) { item.Measure (item.ContentSize); }
public void QueueArrange(CanvasItem item) { item.Arrange(); }
public void QueueRender(Hyena.Gui.Canvas.CanvasItem item, Rect rect) { QueueDirtyRegion(rect); }
public void QueueArrange(CanvasItem item) { item.Arrange (); }
private Point ChildCoord (CanvasItem item, Point pt) { return new Point (pt.X - item.Allocation.X, pt.Y - item.Allocation.Y); }
public void QueueMeasure(CanvasItem item) { item.Measure(item.ContentSize); }