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 ();
            }
        }
示例#2
0
        public void QueueRender (CanvasItem item, Rect rect)
        {
            if (host == null) {
                return;
            }

            host.QueueRender (item, rect);
        }
示例#3
0
        public void InvalidateMeasure()
        {
            CanvasItem root = RootAncestor;

            if (root != null && root.Manager != null)
            {
                root.Manager.QueueMeasure(this);
            }
        }
示例#4
0
        protected void WithChildAt(double x, double y, bool grabHasPriority, CanvasItemHandler handler)
        {
            CanvasItem child = FindChildAt(x, y, grabHasPriority);

            if (child != null)
            {
                handler(child);
            }
        }
示例#5
0
        public void Add(CanvasItem child)
        {
            if (Child != null)
            {
                throw new InvalidOperationException("Child is already set, remove it first");
            }

            Child = child;
        }
示例#6
0
        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);
        }
示例#8
0
        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));
        }
示例#10
0
        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);
            }
        }
示例#11
0
 public virtual void Apply(CanvasItem item, Cairo.Context cr)
 {
 }
示例#12
0
        public void Remove(CanvasItem child)
        {
            if (Child != child) {
                throw new InvalidOperationException ("child does not already belong to host");
            }

            Child = null;
        }
示例#13
0
 Point ChildCoord(CanvasItem item, Point pt)
 {
     return(new Point(pt.X - item.Allocation.X, pt.Y - item.Allocation.Y));
 }
示例#14
0
        public void Add(CanvasItem child)
        {
            if (Child != null) {
                throw new InvalidOperationException ("Child is already set, remove it first");
            }

            Child = child;
        }
示例#15
0
        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)
 {
 }
示例#17
0
 public void QueueMeasure(CanvasItem item)
 {
     item.Measure (item.ContentSize);
 }
 public void QueueArrange(CanvasItem item)
 {
     item.Arrange();
 }
示例#19
0
 public void QueueRender(Hyena.Gui.Canvas.CanvasItem item, Rect rect)
 {
     QueueDirtyRegion(rect);
 }
示例#20
0
 public void QueueArrange(CanvasItem item)
 {
     item.Arrange ();
 }
示例#21
0
文件: Panel.cs 项目: Yetangitu/f-spot
 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);
 }