示例#1
0
        protected override void ClippedRender(Hyena.Data.Gui.CellContext context)
        {
            if (!EnsureLayout())
            {
                return;
            }

            var cr = context.Context;

            Foreground = new Brush(context.Theme.Colors.GetWidgetColor(
                                       context.TextAsForeground ? GtkColorClass.Foreground : GtkColorClass.Text, context.State));

            Brush foreground = Foreground;

            if (!foreground.IsValid)
            {
                return;
            }

            cr.Rectangle(0, 0, RenderSize.Width, RenderSize.Height);
            cr.Clip();

            bool fade = Fade && text_alloc.Width > RenderSize.Width;

            if (fade)
            {
                cr.PushGroup();
            }

            cr.MoveTo(text_alloc.X, text_alloc.Y);
            Foreground.Apply(cr);
            UpdateLayout(GetText(), RenderSize.Width, RenderSize.Height, true);
            if (Hyena.PlatformDetection.IsWindows)
            {
                // FIXME windows; working around some unknown issue with ShowLayout; bgo#644311

                cr.Antialias = Cairo.Antialias.None;
                PangoCairoHelper.LayoutPath(cr, layout, true);
            }
            else
            {
                PangoCairoHelper.ShowLayout(cr, layout);
            }
            cr.Fill();

            TooltipMarkup = layout.IsEllipsized ? last_formatted_text : null;

            if (fade)
            {
                LinearGradient mask = new LinearGradient(RenderSize.Width - 20, 0, RenderSize.Width, 0);
                mask.AddColorStop(0, new Color(0, 0, 0, 1));
                mask.AddColorStop(1, new Color(0, 0, 0, 0));

                cr.PopGroupToSource();
                cr.Mask(mask);
                mask.Dispose();
            }

            cr.ResetClip();
        }
 protected override void ClippedRender(Hyena.Data.Gui.CellContext context)
 {
     foreach (var child in Children)
     {
         if (child.Visible)
         {
             child.Render(context);
         }
     }
 }
示例#3
0
        public void Render(Hyena.Data.Gui.CellContext context)
        {
            var    alloc   = ContentAllocation;
            var    cr      = context.Context;
            double opacity = Opacity;

            if (alloc.Width <= 0 || alloc.Height <= 0 || opacity <= 0)
            {
                return;
            }

            cr.Save();

            if (opacity < 1.0)
            {
                cr.PushGroup();
            }

            MarginStyle margin_style = MarginStyle;

            if (margin_style != null && margin_style != MarginStyle.None)
            {
                cr.Translate(Math.Round(Allocation.X), Math.Round(Allocation.Y));
                cr.Save();
                margin_style.Apply(this, cr);
                cr.Restore();
                cr.Translate(Math.Round(Margin.Left), Math.Round(Margin.Top));
            }
            else
            {
                cr.Translate(Math.Round(alloc.X), Math.Round(alloc.Y));
            }

            cr.Antialias = Cairo.Antialias.Default;

            //cr.Rectangle (0, 0, alloc.Width, alloc.Height);
            //cr.Clip ();

            ClippedRender(context);

            if (PrelightRenderer != null && prelight_opacity > 0)
            {
                PrelightRenderer(context.Context, context.Theme, new Rect(0, 0, ContentAllocation.Width, ContentAllocation.Height), prelight_opacity);
            }

            //cr.ResetClip ();

            if (opacity < 1.0)
            {
                cr.PopGroupToSource();
                cr.PaintWithAlpha(Opacity);
            }

            cr.Restore();
        }
示例#4
0
 protected virtual void ClippedRender(Hyena.Data.Gui.CellContext context)
 {
     ClippedRender(context.Context);
 }