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

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

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

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

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

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

            Child = child;
        }
Esempio n. 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)
 {
 }
Esempio n. 17
0
 public void QueueMeasure(CanvasItem item)
 {
     item.Measure (item.ContentSize);
 }
 public void QueueArrange(CanvasItem item)
 {
     item.Arrange();
 }
Esempio n. 19
0
 public void QueueRender(Hyena.Gui.Canvas.CanvasItem item, Rect rect)
 {
     QueueDirtyRegion(rect);
 }
Esempio n. 20
0
 public void QueueArrange(CanvasItem item)
 {
     item.Arrange ();
 }
Esempio n. 21
0
 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);
 }